1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +02:00

#1228 - prevent second AI activation on AI defeat due to wrong EndTurn packet

This commit is contained in:
Andrii Danylchenko
2022-12-14 22:13:26 +02:00
parent bd7f78b8d5
commit 56bf8ec2c4
6 changed files with 36 additions and 2 deletions

View File

@@ -74,6 +74,8 @@ Goals::TTask Nullkiller::choseBestTask(Goals::TTaskVec & tasks) const
Goals::TTask Nullkiller::choseBestTask(Goals::TSubgoal behavior, int decompositionMaxDepth) const
{
boost::this_thread::interruption_point();
logAi->debug("Checking behavior %s", behavior->toString());
auto start = std::chrono::high_resolution_clock::now();
@@ -160,8 +162,12 @@ void Nullkiller::updateAiState(int pass, bool fast)
cfg.mainTurnDistanceLimit = MAIN_TURN_DISTANCE_LIMIT * ((int)scanDepth + 1);
}
boost::this_thread::interruption_point();
pathfinder->updatePaths(activeHeroes, cfg);
boost::this_thread::interruption_point();
objectClusterizer->clusterize();
}
@@ -212,6 +218,8 @@ HeroLockedReason Nullkiller::getHeroLockedReason(const CGHeroInstance * hero) co
void Nullkiller::makeTurn()
{
boost::lock_guard<boost::mutex> sharedStorageLock(AISharedStorage::locker);
const int MAX_DEPTH = 10;
resetAiState();