mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Rename boats
This commit is contained in:
parent
9dbac414fc
commit
de159df481
@ -228,7 +228,7 @@ bool canBeEmbarkmentPoint(const TerrainTile * t, bool fromWater)
|
||||
}
|
||||
else if(!fromWater) // do not try to board when in water sector
|
||||
{
|
||||
if(t->visitableObjects.size() == 1 && t->topVisitableId() == Obj::TRANSPORT)
|
||||
if(t->visitableObjects.size() == 1 && t->topVisitableId() == Obj::BOAT)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -450,7 +450,7 @@ bool shouldVisit(const Nullkiller * ai, const CGHeroInstance * h, const CGObject
|
||||
return ai->cb->getHeroesInfo().size() < VLC->settings()->getInteger(EGameSettings::HEROES_PER_PLAYER_ON_MAP_CAP);
|
||||
case Obj::TAVERN:
|
||||
case Obj::EYE_OF_MAGI:
|
||||
case Obj::TRANSPORT:
|
||||
case Obj::BOAT:
|
||||
case Obj::SIGN:
|
||||
return false;
|
||||
}
|
||||
|
@ -193,7 +193,7 @@ void ObjectClusterizer::clusterize()
|
||||
blockedObjects.clear();
|
||||
|
||||
Obj ignoreObjects[] = {
|
||||
Obj::TRANSPORT,
|
||||
Obj::BOAT,
|
||||
Obj::EYE_OF_MAGI,
|
||||
Obj::MONOLITH_ONE_WAY_ENTRANCE,
|
||||
Obj::MONOLITH_ONE_WAY_EXIT,
|
||||
|
@ -198,7 +198,7 @@ bool canBeEmbarkmentPoint(const TerrainTile * t, bool fromWater)
|
||||
}
|
||||
else if(!fromWater) // do not try to board when in water sector
|
||||
{
|
||||
if(t->visitableObjects.size() == 1 && t->topVisitableId() == Obj::TRANSPORT)
|
||||
if(t->visitableObjects.size() == 1 && t->topVisitableId() == Obj::BOAT)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -2863,7 +2863,7 @@ bool shouldVisit(HeroPtr h, const CGObjectInstance * obj)
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
case Obj::TRANSPORT:
|
||||
case Obj::BOAT:
|
||||
return false;
|
||||
//Boats are handled by pathfinder
|
||||
case Obj::EYE_OF_MAGI:
|
||||
|
@ -1490,14 +1490,14 @@ void CPlayerInterface::showShipyardDialog(const IShipyard *obj)
|
||||
auto state = obj->shipyardStatus();
|
||||
TResources cost;
|
||||
obj->getBoatCost(cost);
|
||||
GH.pushIntT<CShipyardWindow>(cost, state, obj->getTransportType(), [=](){ cb->buildBoat(obj); });
|
||||
GH.pushIntT<CShipyardWindow>(cost, state, obj->getBoatType(), [=](){ cb->buildBoat(obj); });
|
||||
}
|
||||
|
||||
void CPlayerInterface::newObject( const CGObjectInstance * obj )
|
||||
{
|
||||
EVENT_HANDLER_CALLED_BY_CLIENT;
|
||||
//we might have built a boat in shipyard in opened town screen
|
||||
if (obj->ID == Obj::TRANSPORT
|
||||
if (obj->ID == Obj::BOAT
|
||||
&& LOCPLINT->castleInt
|
||||
&& obj->visitablePos() == LOCPLINT->castleInt->town->bestLocation())
|
||||
{
|
||||
|
@ -1083,7 +1083,7 @@ void CAdvMapInt::onTileLeftClicked(const int3 &mapPos)
|
||||
switch(spellBeingCasted->id)
|
||||
{
|
||||
case SpellID::SCUTTLE_BOAT: //Scuttle Boat
|
||||
if(topBlocking && topBlocking->ID == Obj::TRANSPORT)
|
||||
if(topBlocking && topBlocking->ID == Obj::BOAT)
|
||||
leaveCastingMode(true, mapPos);
|
||||
break;
|
||||
case SpellID::DIMENSION_DOOR:
|
||||
@ -1179,7 +1179,7 @@ void CAdvMapInt::onTileHovered(const int3 &mapPos)
|
||||
switch(spellBeingCasted->id)
|
||||
{
|
||||
case SpellID::SCUTTLE_BOAT:
|
||||
if(objAtTile && objAtTile->ID == Obj::TRANSPORT)
|
||||
if(objAtTile && objAtTile->ID == Obj::BOAT)
|
||||
CCS->curh->set(Cursor::Map::SCUTTLE_BOAT);
|
||||
else
|
||||
CCS->curh->set(Cursor::Map::POINTER);
|
||||
|
@ -393,11 +393,11 @@ std::shared_ptr<CAnimation> MapRendererObjects::getBaseAnimation(const CGObjectI
|
||||
return std::shared_ptr<CAnimation>();
|
||||
}
|
||||
|
||||
bool generateMovementGroups = (info->id == Obj::TRANSPORT) || (info->id == Obj::HERO);
|
||||
bool generateMovementGroups = (info->id == Obj::BOAT) || (info->id == Obj::HERO);
|
||||
|
||||
// Boat appearance files only contain single, unanimated image
|
||||
// proper boat animations are actually in different file
|
||||
if (info->id == Obj::TRANSPORT)
|
||||
if (info->id == Obj::BOAT)
|
||||
if(auto boat = dynamic_cast<const CGBoat*>(obj); boat && !boat->actualAnimation.empty())
|
||||
return getAnimation(boat->actualAnimation, generateMovementGroups);
|
||||
|
||||
@ -442,7 +442,7 @@ std::shared_ptr<CAnimation> MapRendererObjects::getFlagAnimation(const CGObjectI
|
||||
return getAnimation(heroFlags[obj->tempOwner.getNum()], true);
|
||||
}
|
||||
|
||||
if(obj->ID == Obj::TRANSPORT)
|
||||
if(obj->ID == Obj::BOAT)
|
||||
{
|
||||
const auto * boat = dynamic_cast<const CGBoat *>(obj);
|
||||
if(boat && boat->hero && !boat->flagAnimations[boat->hero->tempOwner.getNum()].empty())
|
||||
@ -454,7 +454,7 @@ std::shared_ptr<CAnimation> MapRendererObjects::getFlagAnimation(const CGObjectI
|
||||
|
||||
std::shared_ptr<CAnimation> MapRendererObjects::getOverlayAnimation(const CGObjectInstance * obj)
|
||||
{
|
||||
if(obj->ID == Obj::TRANSPORT)
|
||||
if(obj->ID == Obj::BOAT)
|
||||
{
|
||||
// Boats have additional animation with waves around boat
|
||||
const auto * boat = dynamic_cast<const CGBoat *>(obj);
|
||||
|
@ -39,7 +39,7 @@ uint32_t MapRendererBaseContext::getObjectRotation(ObjectInstanceID objectID) co
|
||||
return hero->moveDir;
|
||||
}
|
||||
|
||||
if(obj->ID == Obj::TRANSPORT)
|
||||
if(obj->ID == Obj::BOAT)
|
||||
{
|
||||
const auto * boat = dynamic_cast<const CGBoat *>(obj);
|
||||
|
||||
|
@ -276,7 +276,7 @@ void MapViewController::fadeInObject(const CGObjectInstance * obj)
|
||||
|
||||
void MapViewController::removeObject(const CGObjectInstance * obj)
|
||||
{
|
||||
if (obj->ID == Obj::TRANSPORT)
|
||||
if (obj->ID == Obj::BOAT)
|
||||
{
|
||||
auto * boat = dynamic_cast<const CGBoat*>(obj);
|
||||
if (boat->hero)
|
||||
|
@ -595,7 +595,7 @@ void CCastleBuildings::recreate()
|
||||
logGlobal->warn("Shipyard in non-coastal town!");
|
||||
std::vector <const CGObjectInstance *> vobjs = LOCPLINT->cb->getVisitableObjs(bayPos, false);
|
||||
//there is visitable obj at shipyard output tile and it's a boat or hero (on boat)
|
||||
if(!vobjs.empty() && (vobjs.front()->ID == Obj::TRANSPORT || vobjs.front()->ID == Obj::HERO))
|
||||
if(!vobjs.empty() && (vobjs.front()->ID == Obj::BOAT || vobjs.front()->ID == Obj::HERO))
|
||||
{
|
||||
buildingsCopy.insert(BuildingID::SHIP);
|
||||
}
|
||||
|
@ -1079,7 +1079,7 @@ void CExchangeWindow::updateWidgets()
|
||||
}
|
||||
}
|
||||
|
||||
CShipyardWindow::CShipyardWindow(const TResources & cost, int state, TransportId boatType, const std::function<void()> & onBuy)
|
||||
CShipyardWindow::CShipyardWindow(const TResources & cost, int state, BoatId boatType, const std::function<void()> & onBuy)
|
||||
: CStatusbarWindow(PLAYER_COLORED, "TPSHIP")
|
||||
{
|
||||
OBJECT_CONSTRUCTION_CAPTURING(255-DISPOSE);
|
||||
|
@ -358,7 +358,7 @@ class CShipyardWindow : public CStatusbarWindow
|
||||
std::shared_ptr<CButton> quit;
|
||||
|
||||
public:
|
||||
CShipyardWindow(const TResources & cost, int state, TransportId boatType, const std::function<void()> & onBuy);
|
||||
CShipyardWindow(const TResources & cost, int state, BoatId boatType, const std::function<void()> & onBuy);
|
||||
};
|
||||
|
||||
/// Creature transformer window
|
||||
|
@ -668,10 +668,10 @@ PathfinderBlockingRule::BlockingReason MovementToDestinationRule::getBlockingRea
|
||||
if(!destination.isNodeObjectVisitable())
|
||||
return BlockingReason::DESTINATION_BLOCKED;
|
||||
|
||||
if(destination.nodeObject->ID != Obj::TRANSPORT && !destination.nodeHero)
|
||||
if(destination.nodeObject->ID != Obj::BOAT && !destination.nodeHero)
|
||||
return BlockingReason::DESTINATION_BLOCKED;
|
||||
}
|
||||
else if(destination.isNodeObjectVisitable() && destination.nodeObject->ID == Obj::TRANSPORT)
|
||||
else if(destination.isNodeObjectVisitable() && destination.nodeObject->ID == Obj::BOAT)
|
||||
{
|
||||
/// Hero in boat can't visit empty boats
|
||||
return BlockingReason::DESTINATION_BLOCKED;
|
||||
@ -810,7 +810,7 @@ void DestinationActionRule::process(
|
||||
{
|
||||
auto objRel = destination.objectRelations;
|
||||
|
||||
if(destination.nodeObject->ID == Obj::TRANSPORT)
|
||||
if(destination.nodeObject->ID == Obj::BOAT)
|
||||
action = CGPathNode::EMBARK;
|
||||
else if(destination.nodeHero)
|
||||
{
|
||||
|
@ -756,7 +756,7 @@ public:
|
||||
ARTIFACT = 5,
|
||||
PANDORAS_BOX = 6,
|
||||
BLACK_MARKET = 7,
|
||||
TRANSPORT = 8,
|
||||
BOAT = 8,
|
||||
BORDERGUARD = 9,
|
||||
KEYMASTER = 10,
|
||||
BUOY = 11,
|
||||
@ -1241,26 +1241,15 @@ class BattleField : public BaseForID<BattleField, si32>
|
||||
DLL_LINKAGE static BattleField fromString(const std::string & identifier);
|
||||
};
|
||||
|
||||
class TransportId
|
||||
enum class EBoatId
|
||||
{
|
||||
public:
|
||||
enum ETransportId
|
||||
{
|
||||
NONE = -1,
|
||||
BOAT_EVIL = 0,
|
||||
BOAT_GOOD,
|
||||
BOAT_NEUTRAL
|
||||
};
|
||||
|
||||
TransportId(ETransportId _num = NONE) : num(_num)
|
||||
{}
|
||||
|
||||
ID_LIKE_CLASS_COMMON(TransportId, ETransportId)
|
||||
|
||||
ETransportId num;
|
||||
NONE = -1,
|
||||
BOAT_EVIL = 0,
|
||||
BOAT_GOOD,
|
||||
BOAT_NEUTRAL
|
||||
};
|
||||
|
||||
ID_LIKE_OPERATORS(TransportId, TransportId::ETransportId)
|
||||
using BoatId = Identifier<EBoatId>;
|
||||
|
||||
enum class ETerrainId {
|
||||
NATIVE_TERRAIN = -4,
|
||||
|
@ -1286,7 +1286,7 @@ void TryMoveHero::applyGs(CGameState *gs)
|
||||
if(result == EMBARK) //hero enters boat at destination tile
|
||||
{
|
||||
const TerrainTile &tt = gs->map->getTile(h->convertToVisitablePos(end));
|
||||
assert(tt.visitableObjects.size() >= 1 && tt.visitableObjects.back()->ID == Obj::TRANSPORT); //the only visitable object at destination is Boat
|
||||
assert(tt.visitableObjects.size() >= 1 && tt.visitableObjects.back()->ID == Obj::BOAT); //the only visitable object at destination is Boat
|
||||
auto * boat = dynamic_cast<CGBoat *>(tt.visitableObjects.back());
|
||||
assert(boat);
|
||||
|
||||
@ -1460,7 +1460,7 @@ void NewObject::applyGs(CGameState *gs)
|
||||
{
|
||||
TerrainId terrainType = ETerrainId::NONE;
|
||||
|
||||
if(ID == Obj::TRANSPORT && !gs->isInTheMap(pos)) //special handling for bug #3060 - pos outside map but visitablePos is not
|
||||
if(ID == Obj::BOAT && !gs->isInTheMap(pos)) //special handling for bug #3060 - pos outside map but visitablePos is not
|
||||
{
|
||||
CGObjectInstance testObject = CGObjectInstance();
|
||||
testObject.pos = pos;
|
||||
@ -1478,7 +1478,7 @@ void NewObject::applyGs(CGameState *gs)
|
||||
CGObjectInstance *o = nullptr;
|
||||
switch(ID)
|
||||
{
|
||||
case Obj::TRANSPORT:
|
||||
case Obj::BOAT:
|
||||
o = new CGBoat();
|
||||
terrainType = ETerrainId::WATER; //TODO: either boat should only spawn on water, or all water objects should be handled this way
|
||||
break;
|
||||
|
@ -935,14 +935,14 @@ si32 CGHeroInstance::getManaNewTurn() const
|
||||
// ai->putAt(this, ai->firstAvailableSlot(this));
|
||||
// }
|
||||
|
||||
TransportId CGHeroInstance::getTransportType() const
|
||||
BoatId CGHeroInstance::getBoatType() const
|
||||
{
|
||||
switch(type->heroClass->getAlignment())
|
||||
{
|
||||
case EAlignment::EVIL : return TransportId::ETransportId::BOAT_EVIL;
|
||||
case EAlignment::GOOD : return TransportId::ETransportId::BOAT_GOOD;
|
||||
case EAlignment::NEUTRAL : return TransportId::ETransportId::BOAT_NEUTRAL;
|
||||
default: return TransportId::ETransportId::NONE;
|
||||
case EAlignment::EVIL : return EBoatId::BOAT_EVIL;
|
||||
case EAlignment::GOOD : return EBoatId::BOAT_GOOD;
|
||||
case EAlignment::NEUTRAL : return EBoatId::BOAT_NEUTRAL;
|
||||
default: return EBoatId::NONE;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -133,7 +133,7 @@ public:
|
||||
int getSightRadius() const override; //sight distance (should be used if player-owned structure)
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
TransportId getTransportType() const override; //0 - evil (if a ship can be evil...?), 1 - good, 2 - neutral
|
||||
BoatId getBoatType() const override; //0 - evil (if a ship can be evil...?), 1 - good, 2 - neutral
|
||||
void getOutOffsets(std::vector<int3> &offsets) const override; //offsets to obj pos when we boat can be placed
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
@ -1085,14 +1085,14 @@ void CGTownInstance::clearArmy() const
|
||||
}
|
||||
}
|
||||
|
||||
TransportId CGTownInstance::getTransportType() const
|
||||
BoatId CGTownInstance::getBoatType() const
|
||||
{
|
||||
switch (town->faction->alignment)
|
||||
{
|
||||
case EAlignment::EVIL : return TransportId::ETransportId::BOAT_EVIL;
|
||||
case EAlignment::GOOD : return TransportId::ETransportId::BOAT_GOOD;
|
||||
case EAlignment::NEUTRAL : return TransportId::ETransportId::BOAT_NEUTRAL;
|
||||
default: return TransportId::ETransportId::NONE;
|
||||
case EAlignment::EVIL : return EBoatId::BOAT_EVIL;
|
||||
case EAlignment::GOOD : return EBoatId::BOAT_GOOD;
|
||||
case EAlignment::NEUTRAL : return EBoatId::BOAT_NEUTRAL;
|
||||
default: return EBoatId::NONE;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -293,7 +293,7 @@ public:
|
||||
bool passableFor(PlayerColor color) const override;
|
||||
//int3 getSightCenter() const override; //"center" tile from which the sight distance is calculated
|
||||
int getSightRadius() const override; //returns sight distance
|
||||
TransportId getTransportType() const override; //0 - evil (if a ship can be evil...?), 1 - good, 2 - neutral
|
||||
BoatId getBoatType() const override; //0 - evil (if a ship can be evil...?), 1 - good, 2 - neutral
|
||||
void getOutOffsets(std::vector<int3> &offsets) const override; //offsets to obj pos when we boat can be placed. Parameter will be cleared
|
||||
int getMarketEfficiency() const override; //=market count
|
||||
bool allowsTrade(EMarketMode::EMarketMode mode) const override;
|
||||
|
@ -442,7 +442,7 @@ int3 IBoatGenerator::bestLocation() const
|
||||
{
|
||||
if(const TerrainTile *tile = IObjectInterface::cb->getTile(o->pos + offset, false)) //tile is in the map
|
||||
{
|
||||
if(tile->terType->isWater() && (!tile->blocked || tile->blockingObjects.front()->ID == Obj::TRANSPORT)) //and is water and is not blocked or is blocked by boat
|
||||
if(tile->terType->isWater() && (!tile->blocked || tile->blockingObjects.front()->ID == Obj::BOAT)) //and is water and is not blocked or is blocked by boat
|
||||
return o->pos + offset;
|
||||
}
|
||||
}
|
||||
@ -457,16 +457,16 @@ IBoatGenerator::EGeneratorState IBoatGenerator::shipyardStatus() const
|
||||
return TILE_BLOCKED; //no available water
|
||||
else if(t->blockingObjects.empty())
|
||||
return GOOD; //OK
|
||||
else if(t->blockingObjects.front()->ID == Obj::TRANSPORT)
|
||||
else if(t->blockingObjects.front()->ID == Obj::BOAT)
|
||||
return BOAT_ALREADY_BUILT; //blocked with boat
|
||||
else
|
||||
return TILE_BLOCKED; //blocked
|
||||
}
|
||||
|
||||
TransportId IBoatGenerator::getTransportType() const
|
||||
BoatId IBoatGenerator::getBoatType() const
|
||||
{
|
||||
//We make good ships by default
|
||||
return TransportId::ETransportId::BOAT_GOOD;
|
||||
return EBoatId::BOAT_GOOD;
|
||||
}
|
||||
|
||||
|
||||
|
@ -86,7 +86,7 @@ public:
|
||||
IBoatGenerator(const CGObjectInstance *O);
|
||||
virtual ~IBoatGenerator() = default;
|
||||
|
||||
virtual TransportId getTransportType() const; //0 - evil (if a ship can be evil...?), 1 - good, 2 - neutral
|
||||
virtual BoatId getBoatType() const; //0 - evil (if a ship can be evil...?), 1 - good, 2 - neutral
|
||||
virtual void getOutOffsets(std::vector<int3> &offsets) const =0; //offsets to obj pos when we boat can be placed
|
||||
int3 bestLocation() const; //returns location when the boat should be placed
|
||||
|
||||
|
@ -36,7 +36,7 @@ static bool isOnVisitableFromTopList(int identifier, int type)
|
||||
Obj::SHIPWRECK_SURVIVOR,
|
||||
Obj::BUOY,
|
||||
Obj::OCEAN_BOTTLE,
|
||||
Obj::TRANSPORT,
|
||||
Obj::BOAT,
|
||||
Obj::WHIRLPOOL,
|
||||
Obj::GARRISON,
|
||||
Obj::GARRISON2,
|
||||
|
@ -209,8 +209,8 @@ bool WaterProxy::placeBoat(Zone & land, const Lake & lake, RouteInfo & info)
|
||||
if(!manager)
|
||||
return false;
|
||||
|
||||
auto subObjects = VLC->objtypeh->knownSubObjects(Obj::TRANSPORT);
|
||||
auto * boat = dynamic_cast<CGBoat *>(VLC->objtypeh->getHandlerFor(Obj::TRANSPORT, *RandomGeneratorUtil::nextItem(subObjects, generator.rand))->create());
|
||||
auto subObjects = VLC->objtypeh->knownSubObjects(Obj::BOAT);
|
||||
auto * boat = dynamic_cast<CGBoat *>(VLC->objtypeh->getHandlerFor(Obj::BOAT, *RandomGeneratorUtil::nextItem(subObjects, generator.rand))->create());
|
||||
|
||||
rmg::Object rmgObject(*boat);
|
||||
rmgObject.setTemplate(zone.getTerrainType());
|
||||
|
@ -182,7 +182,7 @@ ESpellCastResult SummonBoatMechanics::applyAdventureEffects(SpellCastEnvironment
|
||||
double dist = 0;
|
||||
for(const CGObjectInstance * obj : env->getMap()->objects)
|
||||
{
|
||||
if(obj && obj->ID == Obj::TRANSPORT)
|
||||
if(obj && obj->ID == Obj::BOAT)
|
||||
{
|
||||
const auto * b = dynamic_cast<const CGBoat *>(obj);
|
||||
if(b->hero || b->layer != EPathfindingLayer::SAIL)
|
||||
@ -214,8 +214,8 @@ ESpellCastResult SummonBoatMechanics::applyAdventureEffects(SpellCastEnvironment
|
||||
else //create boat
|
||||
{
|
||||
NewObject no;
|
||||
no.ID = Obj::TRANSPORT;
|
||||
no.subID = parameters.caster->getHeroCaster()->getTransportType().getNum();
|
||||
no.ID = Obj::BOAT;
|
||||
no.subID = parameters.caster->getHeroCaster()->getBoatType().getNum();
|
||||
no.pos = summonPos + int3(1,0,0);
|
||||
env->apply(&no);
|
||||
}
|
||||
@ -250,7 +250,7 @@ ESpellCastResult ScuttleBoatMechanics::applyAdventureEffects(SpellCastEnvironmen
|
||||
|
||||
//TODO: test range, visibility
|
||||
const TerrainTile *t = &env->getMap()->getTile(parameters.pos);
|
||||
if(t->visitableObjects.empty() || t->visitableObjects.back()->ID != Obj::TRANSPORT)
|
||||
if(t->visitableObjects.empty() || t->visitableObjects.back()->ID != Obj::BOAT)
|
||||
{
|
||||
env->complain("There is no boat to scuttle!");
|
||||
return ESpellCastResult::ERROR;
|
||||
|
@ -663,7 +663,7 @@ void MainWindow::loadObjectsTree()
|
||||
addGroupIntoCatalog("HEROES", false, false, Obj::HERO);
|
||||
addGroupIntoCatalog("HEROES", false, false, Obj::RANDOM_HERO);
|
||||
addGroupIntoCatalog("HEROES", false, false, Obj::HERO_PLACEHOLDER);
|
||||
addGroupIntoCatalog("HEROES", false, false, Obj::TRANSPORT);
|
||||
addGroupIntoCatalog("HEROES", false, false, Obj::BOAT);
|
||||
addGroupIntoCatalog("ARTIFACTS", true, false, Obj::ARTIFACT);
|
||||
addGroupIntoCatalog("ARTIFACTS", false, false, Obj::RANDOM_ART);
|
||||
addGroupIntoCatalog("ARTIFACTS", false, false, Obj::RANDOM_TREASURE_ART);
|
||||
|
@ -187,7 +187,7 @@ void MapHandler::initObjectRects()
|
||||
CGObjectInstance *obj = const_cast<CGObjectInstance *>(elem);
|
||||
if( !obj
|
||||
|| (obj->ID==Obj::HERO && static_cast<const CGHeroInstance*>(obj)->inTownGarrison) //garrisoned hero
|
||||
|| (obj->ID==Obj::TRANSPORT && static_cast<const CGBoat*>(obj)->hero)) //boat with hero (hero graphics is used)
|
||||
|| (obj->ID==Obj::BOAT && static_cast<const CGBoat*>(obj)->hero)) //boat with hero (hero graphics is used)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@ -2263,7 +2263,7 @@ bool CGameHandler::moveHero(ObjectInstanceID hid, int3 dst, ui8 teleporting, boo
|
||||
const TerrainTile t = *getTile(hmpos);
|
||||
const int3 guardPos = gs->guardingCreaturePosition(hmpos);
|
||||
|
||||
const bool embarking = !h->boat && !t.visitableObjects.empty() && t.visitableObjects.back()->ID == Obj::TRANSPORT;
|
||||
const bool embarking = !h->boat && !t.visitableObjects.empty() && t.visitableObjects.back()->ID == Obj::BOAT;
|
||||
const bool disembarking = h->boat
|
||||
&& t.terType->isLand()
|
||||
&& (dst == h->pos
|
||||
@ -2289,7 +2289,7 @@ bool CGameHandler::moveHero(ObjectInstanceID hid, int3 dst, ui8 teleporting, boo
|
||||
//OR hero is on land and dest is water and (there is not present only one object - boat)
|
||||
if (((!t.terType->isPassable() || (t.blocked && !t.visitable && !canFly))
|
||||
&& complain("Cannot move hero, destination tile is blocked!"))
|
||||
|| ((!h->boat && !canWalkOnSea && !canFly && t.terType->isWater() && (t.visitableObjects.size() < 1 || (t.visitableObjects.back()->ID != Obj::TRANSPORT && t.visitableObjects.back()->ID != Obj::HERO))) //hero is not on boat/water walking and dst water tile doesn't contain boat/hero (objs visitable from land) -> we test back cause boat may be on top of another object (#276)
|
||||
|| ((!h->boat && !canWalkOnSea && !canFly && t.terType->isWater() && (t.visitableObjects.size() < 1 || (t.visitableObjects.back()->ID != Obj::BOAT && t.visitableObjects.back()->ID != Obj::HERO))) //hero is not on boat/water walking and dst water tile doesn't contain boat/hero (objs visitable from land) -> we test back cause boat may be on top of another object (#276)
|
||||
&& complain("Cannot move hero, destination tile is on water!"))
|
||||
|| ((h->boat && h->boat->layer == EPathfindingLayer::SAIL && t.terType->isLand() && t.blocked)
|
||||
&& complain("Cannot disembark hero, tile is blocked!"))
|
||||
@ -5637,8 +5637,8 @@ bool CGameHandler::buildBoat(ObjectInstanceID objid, PlayerColor playerID)
|
||||
|
||||
//create boat
|
||||
NewObject no;
|
||||
no.ID = Obj::TRANSPORT;
|
||||
no.subID = obj->getTransportType().getNum();
|
||||
no.ID = Obj::BOAT;
|
||||
no.subID = obj->getBoatType().getNum();
|
||||
no.pos = tile + int3(1,0,0);
|
||||
sendAndApply(&no);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user