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:
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user