1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-29 23:07:48 +02:00

Battle AI: add some comments + refactoring

This commit is contained in:
Andrii Danylchenko
2022-10-17 19:47:16 +03:00
parent 601ced3749
commit ebf4854801
8 changed files with 174 additions and 144 deletions

View File

@@ -180,13 +180,14 @@ std::vector<CGPathNode *> AINodeStorage::getInitialNodes()
for(auto actorPtr : actors)
{
ChainActor * actor = actorPtr.get();
AIPathNode * initialNode =
getOrCreateNode(actor->initialPosition, actor->layer, actor)
.get();
if(!initialNode)
auto allocated = getOrCreateNode(actor->initialPosition, actor->layer, actor);
if(!allocated)
continue;
AIPathNode * initialNode = allocated.get();
initialNode->inPQ = false;
initialNode->pq = nullptr;
initialNode->turns = actor->initialTurn;