Codechange: use std::vector for the available neighbours

This commit is contained in:
Rubidium
2024-05-30 23:15:38 +02:00
committed by rubidium42
parent 2864f3b3eb
commit 31085230a6
3 changed files with 8 additions and 10 deletions
+4 -4
View File
@@ -1223,13 +1223,13 @@ static void River_GetNeighbours(AyStar *aystar, PathNode *current)
{
TileIndex tile = current->GetTile();
aystar->num_neighbours = 0;
aystar->neighbours.clear();
for (DiagDirection d = DIAGDIR_BEGIN; d < DIAGDIR_END; d++) {
TileIndex t2 = tile + TileOffsByDiagDir(d);
if (IsValidTile(t2) && FlowsDown(tile, t2)) {
aystar->neighbours[aystar->num_neighbours].m_tile = t2;
aystar->neighbours[aystar->num_neighbours].m_td = INVALID_TRACKDIR;
aystar->num_neighbours++;
auto &neighbour = aystar->neighbours.emplace_back();
neighbour.m_tile = t2;
neighbour.m_td = INVALID_TRACKDIR;
}
}
}