1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-15 01:24:45 +02:00

Remove pointer to objects from TerrainTile

This commit is contained in:
Ivan Savenko
2025-03-19 14:40:45 +00:00
parent 63d00b080e
commit cd7732456a
26 changed files with 164 additions and 113 deletions

View File

@ -192,7 +192,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::BOAT)
if(t->visitableObjects.size() == 1 && cb->getObjInstance(t->topVisitableObj())->ID == Obj::BOAT)
return true;
}
return false;
@ -200,9 +200,11 @@ bool canBeEmbarkmentPoint(const TerrainTile * t, bool fromWater)
bool isBlockedBorderGate(int3 tileToHit) //TODO: is that function needed? should be handled by pathfinder
{
if(cb->getTile(tileToHit)->topVisitableId() != Obj::BORDER_GATE)
const auto * object = cb->getTopObj(tileToHit);
if( object && object->id != Obj::BORDER_GATE)
return false;
auto gate = dynamic_cast<const CGKeys *>(cb->getTile(tileToHit)->topVisitableObj());
auto gate = dynamic_cast<const CGKeys *>(object);
return !gate->passableFor(ai->playerID);
}