1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-06 09:09:40 +02:00

- Fixed Border Gates logic

- VCAI may now walk onto removable objects when exploring
This commit is contained in:
DJWarmonger
2018-08-08 10:52:52 +02:00
parent 6fd403d7cf
commit a9ef8fe32f
5 changed files with 42 additions and 13 deletions

View File

@@ -357,6 +357,26 @@ bool isSafeToVisit(HeroPtr h, crint3 tile)
return true; //there's no danger
}
bool isObjectRemovable(const CGObjectInstance * obj)
{
//FIXME: move logic to object property!
switch (obj->ID)
{
case Obj::MONSTER:
case Obj::RESOURCE:
case Obj::CAMPFIRE:
case Obj::TREASURE_CHEST:
case Obj::ARTIFACT:
case Obj::BORDERGUARD:
return true;
break;
default:
return false;
break;
}
}
bool canBeEmbarkmentPoint(const TerrainTile * t, bool fromWater)
{
// TODO: Such information should be provided by pathfinder
@@ -422,7 +442,7 @@ bool isBlockedBorderGate(int3 tileToHit) //TODO: is that function needed? should
if(cb->getTile(tileToHit)->topVisitableId() != Obj::BORDER_GATE)
return false;
auto gate = dynamic_cast<const CGKeys *>(cb->getTile(tileToHit)->topVisitableObj());
return !gate->wasMyColorVisited(ai->playerID);
return !gate->passableFor(ai->playerID);
}
bool isBlockVisitObj(const int3 & pos)
{