1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-26 22:57:00 +02:00

VCAI will now not be confused by Border Gates and attempt to find Keymaster to cross them.

This commit is contained in:
DjWarmonger 2012-07-18 13:23:46 +00:00
parent 624908e403
commit 6a7327d38a

View File

@ -1781,15 +1781,15 @@ void VCAI::tryRealize(CGoal g)
//cb->recalculatePaths(); //cb->recalculatePaths();
if(!g.hero->movement) if(!g.hero->movement)
throw cannotFulfillGoalException("Cannot visit tile: hero is out of MPs!"); throw cannotFulfillGoalException("Cannot visit tile: hero is out of MPs!");
if(!g.isBlockedBorderGate(g.tile)) //if(!g.isBlockedBorderGate(g.tile))
{ //{
if (ai->moveHeroToTile(g.tile, g.hero.get())) if (ai->moveHeroToTile(g.tile, g.hero.get()))
{ {
throw goalFulfilledException(""); throw goalFulfilledException("");
} }
} //}
else //else
throw cannotFulfillGoalException("There's a blocked gate!"); //TODO: get keymaster tent // throw cannotFulfillGoalException("There's a blocked gate!, we should never be here"); //CLEAR_WAY_TO should get keymaster tent
} }
break; break;
case BUILD_STRUCTURE: case BUILD_STRUCTURE:
@ -2710,7 +2710,9 @@ TSubgoal CGoal::whatToDoToAchieve()
int3 tileToHit = sm.firstTileToGet(h, tile); int3 tileToHit = sm.firstTileToGet(h, tile);
//if(isSafeToVisit(h, tileToHit)) //if(isSafeToVisit(h, tileToHit))
if(isBlockedBorderGate(tileToHit)) if(isBlockedBorderGate(tileToHit))
throw cannotFulfillGoalException("There's blocked border gate!"); { //FIXME: this way we'll not visit gate and activate quest :?
return CGoal(FIND_OBJ).setobjid(Obj::KEYMASTER).setresID(cb->getTile(tileToHit)->visitableObjects.back()->subID);
}
if(tileToHit == tile) if(tileToHit == tile)
{ {