From 05742afd60a17fc6d25af8b2c2947fd0ff004eff Mon Sep 17 00:00:00 2001 From: DjWarmonger Date: Tue, 8 May 2012 09:38:01 +0000 Subject: [PATCH] Final fix. AI heroes won't loose their turn when visiting adjacent objects. --- AI/VCAI/VCAI.cpp | 10 ++++++---- server/VCMI_server.vcxproj | 8 ++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/AI/VCAI/VCAI.cpp b/AI/VCAI/VCAI.cpp index 017d7a6b0..8eac4f2aa 100644 --- a/AI/VCAI/VCAI.cpp +++ b/AI/VCAI/VCAI.cpp @@ -1554,12 +1554,12 @@ bool VCAI::moveHeroToTile(int3 dst, const CGHeroInstance * h) performObjectInteraction (visitedObject, h); } - if(h->tempOwner == playerID) //lost hero after last move + if(h->tempOwner == playerID) //we could have lost hero after last move { cb->recalculatePaths(); - if (startHpos == h->visitablePos()) + if (startHpos == h->visitablePos() && !ret) //we didn't move and didn't reach the target { - throw cannotFulfillGoalException("Invalid path found!"); //FIXME + throw cannotFulfillGoalException("Invalid path found!"); } } BNLOG("Hero %s moved from %s to %s", h->name % startHpos % h->visitablePos()); @@ -2364,7 +2364,9 @@ TSubgoal CGoal::whatToDoToAchieve() case EXPLORE: { if (hero) + { return CGoal(VISIT_TILE).settile(whereToExplore(hero)).sethero(hero); + } auto hs = cb->getHeroesInfo(); int howManyHeroes = hs.size(); @@ -2902,7 +2904,7 @@ int3 SectorMap::firstTileToGet(const CGHeroInstance *h, crint3 dst) if(!preds[dst]) { write("test.txt"); - throw cannotFulfillGoalException(str(format("Cannot found connection between sectors %d and %d") % src->id % dst->id)); + throw cannotFulfillGoalException(str(format("Cannot find connection between sectors %d and %d") % src->id % dst->id)); } std::vector toTraverse; diff --git a/server/VCMI_server.vcxproj b/server/VCMI_server.vcxproj index aad8f5ef5..3838b7823 100644 --- a/server/VCMI_server.vcxproj +++ b/server/VCMI_server.vcxproj @@ -63,11 +63,11 @@ <_ProjectFileVersion>10.0.30128.1 - $(SolutionDir) + ..\.. $(SolutionDir) $(Configuration)\ $(Configuration)\ - $(SolutionDir)$(Configuration)\bin\ + ..\..\RD $(SolutionDir)$(Configuration)\bin\ $(Configuration)\ $(Configuration)\ @@ -108,7 +108,7 @@ VCMI_lib.lib;zlib.lib;%(AdditionalDependencies) - $(OutDir);%(AdditionalLibraryDirectories) + G:\Programowanie\VCMI\AI;../..;../../libs;../;%(AdditionalLibraryDirectories) true MachineX86 @@ -155,7 +155,7 @@ VCMI_lib.lib;zlib.lib;%(AdditionalDependencies) - $(OutDir);%(AdditionalLibraryDirectories) + G:\Programowanie\VCMI\libs;G:\Programowanie\VCMI;$(OutDir);%(AdditionalLibraryDirectories) true true true