summaryrefslogtreecommitdiffhomepage
path: root/src/world.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/world.cpp
parentb3b770bffcd9f330ab171a7c74558e861e824c9e (diff)
src/{world,dijkstra}: get rid of extra indirection in neighbor list
Diffstat (limited to 'src/world.cpp')
-rw-r--r--src/world.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/world.cpp b/src/world.cpp
index 759b9060..a28db7d3 100644
--- a/src/world.cpp
+++ b/src/world.cpp
@@ -188,14 +188,11 @@ void world::throw_on_wrong_object_type(object_id id, object_type actual, object_
fm_throw("object '{}' has wrong object type '{}', should be '{}'"_cf, id, (size_t)actual, (size_t)expected);
}
-auto world::neighbors(chunk_coords_ coord) -> std::array<neighbor_pair, 8>
+auto world::neighbors(chunk_coords_ coord) -> std::array<chunk*, 8>
{
- std::array<neighbor_pair, 8> ret;
- for (auto i = 0uz; const auto& x : neighbor_offsets)
- {
- auto ch = coord + x;
- ret[i++] = { at(ch), ch };
- }
+ std::array<chunk*, 8> ret;
+ for (auto i = 0u; i < 8; i++)
+ ret[i] = at(coord + neighbor_offsets[i]);
return ret;
}