1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-06 09:09:40 +02:00

NKAI: remove 5th dimension

This commit is contained in:
Andrii Danylchenko
2024-03-23 11:44:15 +02:00
parent e66ceff154
commit 017fb204a1
10 changed files with 387 additions and 274 deletions

View File

@@ -155,15 +155,21 @@ void AINodeStorage::commit(CDestinationNodeInfo & destination, const PathNodeInf
});
}
std::vector<CGPathNode *> AINodeStorage::calculateNeighbours(
void AINodeStorage::calculateNeighbours(
std::vector<CGPathNode *> & result,
const PathNodeInfo & source,
EPathfindingLayer layer,
const PathfinderConfig * pathfinderConfig,
const CPathfinderHelper * pathfinderHelper)
{
std::vector<CGPathNode *> neighbours;
neighbours.reserve(16);
std::vector<int3> accessibleNeighbourTiles;
result.clear();
accessibleNeighbourTiles.reserve(8);
pathfinderHelper->calculateNeighbourTiles(accessibleNeighbourTiles, source);
const AIPathNode * srcNode = getAINode(source.node);
auto accessibleNeighbourTiles = pathfinderHelper->getNeighbourTiles(source);
for(auto & neighbour : accessibleNeighbourTiles)
{
@@ -174,11 +180,9 @@ std::vector<CGPathNode *> AINodeStorage::calculateNeighbours(
if(!nextNode || nextNode.value()->accessible == EPathAccessibility::NOT_SET)
continue;
neighbours.push_back(nextNode.value());
result.push_back(nextNode.value());
}
}
return neighbours;
}
void AINodeStorage::setHero(HeroPtr heroPtr, const VCAI * _ai)

View File

@@ -89,8 +89,10 @@ public:
std::vector<CGPathNode *> getInitialNodes() override;
virtual std::vector<CGPathNode *> calculateNeighbours(
virtual void calculateNeighbours(
std::vector<CGPathNode *> & result,
const PathNodeInfo & source,
EPathfindingLayer layer,
const PathfinderConfig * pathfinderConfig,
const CPathfinderHelper * pathfinderHelper) override;