1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +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

@@ -60,29 +60,29 @@ void NodeStorage::initialize(const PathfinderOptions & options, const CGameState
}
}
std::vector<CGPathNode *> NodeStorage::calculateNeighbours(
void NodeStorage::calculateNeighbours(
std::vector<CGPathNode *> & result,
const PathNodeInfo & source,
EPathfindingLayer layer,
const PathfinderConfig * pathfinderConfig,
const CPathfinderHelper * pathfinderHelper)
{
std::vector<CGPathNode *> neighbours;
neighbours.reserve(16);
auto accessibleNeighbourTiles = pathfinderHelper->getNeighbourTiles(source);
std::vector<int3> accessibleNeighbourTiles;
result.clear();
accessibleNeighbourTiles.reserve(8);
pathfinderHelper->calculateNeighbourTiles(accessibleNeighbourTiles, source);
for(auto & neighbour : accessibleNeighbourTiles)
{
for(EPathfindingLayer i = EPathfindingLayer::LAND; i < EPathfindingLayer::NUM_LAYERS; i.advance(1))
{
auto * node = getNode(neighbour, i);
auto * node = getNode(neighbour, layer);
if(node->accessible == EPathAccessibility::NOT_SET)
continue;
if(node->accessible == EPathAccessibility::NOT_SET)
continue;
neighbours.push_back(node);
}
result.push_back(node);
}
return neighbours;
}
std::vector<CGPathNode *> NodeStorage::calculateTeleportations(