mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Nullkiller: thread interuption point
This commit is contained in:
parent
0d5ae20e64
commit
f2c26d7553
@ -46,6 +46,8 @@ void DangerHitMapAnalyzer::updateHitMap()
|
||||
{
|
||||
ai->pathfinder->updatePaths(pair.second, PathfinderSettings());
|
||||
|
||||
boost::this_thread::interruption_point();
|
||||
|
||||
foreach_tile_pos([&](const int3 & pos)
|
||||
{
|
||||
for(AIPath & path : ai->pathfinder->getPathInfo(pos))
|
||||
|
@ -44,7 +44,7 @@ void Nullkiller::init(std::shared_ptr<CCallback> cb, PlayerColor playerID)
|
||||
|
||||
priorityEvaluator.reset(new PriorityEvaluator(this));
|
||||
dangerHitMap.reset(new DangerHitMapAnalyzer(this));
|
||||
buildAnalyzer.reset(new BuildAnalyzer());
|
||||
buildAnalyzer.reset(new BuildAnalyzer(this));
|
||||
objectClusterizer.reset(new ObjectClusterizer(this));
|
||||
dangerEvaluator.reset(new FuzzyHelper(this));
|
||||
pathfinder.reset(new AIPathfinder(cb.get(), this));
|
||||
@ -70,6 +70,8 @@ Goals::TTask Nullkiller::choseBestTask(Goals::TSubgoal behavior, int decompositi
|
||||
|
||||
Goals::TGoalVec elementarGoals = decomposer->decompose(behavior, decompositionMaxDepth);
|
||||
Goals::TTaskVec tasks;
|
||||
|
||||
boost::this_thread::interruption_point();
|
||||
|
||||
for(auto goal : elementarGoals)
|
||||
{
|
||||
@ -109,6 +111,8 @@ void Nullkiller::resetAiState()
|
||||
|
||||
void Nullkiller::updateAiState(int pass)
|
||||
{
|
||||
boost::this_thread::interruption_point();
|
||||
|
||||
auto start = boost::chrono::high_resolution_clock::now();
|
||||
|
||||
activeHero = nullptr;
|
||||
@ -116,6 +120,8 @@ void Nullkiller::updateAiState(int pass)
|
||||
memory->removeInvisibleObjects(cb.get());
|
||||
dangerHitMap->updateHitMap();
|
||||
|
||||
boost::this_thread::interruption_point();
|
||||
|
||||
heroManager->update();
|
||||
logAi->trace("Updating paths");
|
||||
|
||||
@ -216,6 +222,7 @@ void Nullkiller::makeTurn()
|
||||
return;
|
||||
}
|
||||
|
||||
boost::this_thread::interruption_point();
|
||||
logAi->debug("Trying to realize %s (value %2.3f)", bestTask->toString(), bestTask->priority);
|
||||
|
||||
try
|
||||
|
@ -78,6 +78,8 @@ void AIPathfinder::updatePaths(std::map<const CGHeroInstance *, HeroRole> heroes
|
||||
{
|
||||
while(storage->calculateHeroChain())
|
||||
{
|
||||
boost::this_thread::interruption_point();
|
||||
|
||||
logAi->trace("Recalculate paths pass %d", pass++);
|
||||
cb->calculatePaths(config);
|
||||
}
|
||||
@ -87,6 +89,8 @@ void AIPathfinder::updatePaths(std::map<const CGHeroInstance *, HeroRole> heroes
|
||||
|
||||
if(storage->calculateHeroChainFinal())
|
||||
{
|
||||
boost::this_thread::interruption_point();
|
||||
|
||||
logAi->trace("Recalculate paths pass final");
|
||||
cb->calculatePaths(config);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user