diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2023-04-11 14:31:36 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2023-04-11 14:31:36 +0200 |
commit | 1dc1da05808f92ba7d26d539818e9aaf98725be5 (patch) | |
tree | 29cdefb7dd9774821b19019c69a843a1168f3d3a /src/world.cpp | |
parent | a77135dcc85bfa28a783fadc0c682d30f9c2b02e (diff) |
src: add more chunk_coords operators
Diffstat (limited to 'src/world.cpp')
-rw-r--r-- | src/world.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/world.cpp b/src/world.cpp index 9c3f8276..6749210a 100644 --- a/src/world.cpp +++ b/src/world.cpp @@ -199,4 +199,15 @@ void world::throw_on_wrong_entity_type(object_id id, entity_type actual, entity_ fm_throw("object '{}' has wrong entity type '{}', should be '{}'"_cf, id, (size_t)actual, (size_t)expected); } +auto world::neighbors(floormat::chunk_coords_ coord) -> std::array<neighbor_pair, 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 }; + } + return ret; +} + } // namespace floormat |