diff --git a/AI/Nullkiller/Pathfinding/AINodeStorage.cpp b/AI/Nullkiller/Pathfinding/AINodeStorage.cpp index 9858f872b..f119359de 100644 --- a/AI/Nullkiller/Pathfinding/AINodeStorage.cpp +++ b/AI/Nullkiller/Pathfinding/AINodeStorage.cpp @@ -35,6 +35,8 @@ const uint64_t MIN_ARMY_STRENGTH_FOR_CHAIN = 5000; const uint64_t MIN_ARMY_STRENGTH_FOR_NEXT_ACTOR = 1000; const uint64_t CHAIN_MAX_DEPTH = 4; +const bool DO_NOT_SAVE_TO_COMMITED_TILES = false; + AISharedStorage::AISharedStorage(int3 sizes) { if(!shared){ @@ -266,7 +268,8 @@ void AINodeStorage::commit( EPathNodeAction action, int turn, int movementLeft, - float cost) const + float cost, + bool saveToCommited) const { destination->action = action; destination->setCost(cost); @@ -292,7 +295,7 @@ void AINodeStorage::commit( destination->actor->armyValue); #endif - if(destination->turns <= heroChainTurn) + if(saveToCommited && destination->turns <= heroChainTurn) { commitedTiles.insert(destination->coord); } @@ -784,7 +787,14 @@ void HeroChainCalculationTask::addHeroChain(const std::vector continue; } - storage.commit(exchangeNode, carrier, carrier->action, chainInfo.turns, chainInfo.moveRemains, chainInfo.getCost()); + storage.commit( + exchangeNode, + carrier, + carrier->action, + chainInfo.turns, + chainInfo.moveRemains, + chainInfo.getCost(), + DO_NOT_SAVE_TO_COMMITED_TILES); if(carrier->specialAction || carrier->chainOther) { @@ -1076,7 +1086,8 @@ struct TowmPortalFinder EPathNodeAction::TELEPORT_NORMAL, bestNode->turns, bestNode->moveRemains - movementNeeded, - movementCost); + movementCost, + DO_NOT_SAVE_TO_COMMITED_TILES); node->theNodeBefore = bestNode; node->addSpecialAction(std::make_shared(targetTown)); diff --git a/AI/Nullkiller/Pathfinding/AINodeStorage.h b/AI/Nullkiller/Pathfinding/AINodeStorage.h index b1d4dbf00..912ac3fe2 100644 --- a/AI/Nullkiller/Pathfinding/AINodeStorage.h +++ b/AI/Nullkiller/Pathfinding/AINodeStorage.h @@ -208,7 +208,8 @@ public: EPathNodeAction action, int turn, int movementLeft, - float cost) const; + float cost, + bool saveToCommited = true) const; inline const AIPathNode * getAINode(const CGPathNode * node) const {