summaryrefslogtreecommitdiffhomepage
path: root/src/dijkstra.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2024-02-22 19:41:55 +0100
committerStanislaw Halik <sthalik@misaki.pl>2024-02-22 19:43:02 +0100
commit96c9743e65ac95706be3f49da3254d8db4c3afba (patch)
treea839dea2f7c8c79b054d82b99cc794dd0e0f818b /src/dijkstra.cpp
parentb3b770bffcd9f330ab171a7c74558e861e824c9e (diff)
src/{world,dijkstra}: get rid of extra indirection in neighbor list
Diffstat (limited to 'src/dijkstra.cpp')
-rw-r--r--src/dijkstra.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/dijkstra.cpp b/src/dijkstra.cpp
index d303960a..9fa348b3 100644
--- a/src/dijkstra.cpp
+++ b/src/dijkstra.cpp
@@ -487,15 +487,12 @@ chunk* cache::try_get_chunk(world& w, floormat::chunk_coords_ ch)
return page.chunk;
}
-std::array<world::neighbor_pair, 8> cache::get_neighbors(world& w, chunk_coords_ ch0)
+std::array<chunk*, 8> cache::get_neighbors(world& w, chunk_coords_ ch0)
{
fm_debug_assert(!size.isZero());
- std::array<world::neighbor_pair, 8> neighbors;
- for (auto i = 0uz; const auto& x : world::neighbor_offsets)
- {
- auto ch = ch0 + x;
- neighbors[i++] = { try_get_chunk(w, ch), ch0 };
- }
+ std::array<chunk*, 8> neighbors;
+ for (auto i = 0u; i < 8; i++)
+ neighbors[i] = try_get_chunk(w, ch0 + world::neighbor_offsets[i]);
return neighbors;
}