1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-16 10:19:47 +02:00

Sorting tasks after buildPlan

Tasks need to be sorted again after buildPlan as otherwise the correct order isn't guaranteed. This led to inconsistent behavior by the AI.
This commit is contained in:
Xilmi 2024-07-07 15:12:05 +02:00
parent f414336243
commit 734f815e67

View File

@ -399,6 +399,11 @@ void Nullkiller::makeTurn()
auto selectedTasks = buildPlan(bestTasks);
std::sort(selectedTasks.begin(), selectedTasks.end(), [](const TTask& a, const TTask& b)
{
return a->priority > b->priority;
});
logAi->debug("Decision madel in %ld", timeElapsed(start));
if(selectedTasks.empty())