From 8b44178ab0ce155db89ff9ef93dc02944149414e Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 1 Sep 2023 23:02:59 +0200 Subject: src: convert global_coords to chunk_coords_ --- src/global-coords.hpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/global-coords.hpp b/src/global-coords.hpp index d1fd2b8d..3ed4a855 100644 --- a/src/global-coords.hpp +++ b/src/global-coords.hpp @@ -90,6 +90,7 @@ struct global_coords final { constexpr local_coords local() const noexcept; constexpr chunk_coords chunk() const noexcept; + constexpr operator chunk_coords_() const noexcept; constexpr int8_t z() const noexcept; constexpr Vector2i to_signed() const noexcept; @@ -113,6 +114,11 @@ constexpr chunk_coords global_coords::chunk() const noexcept return { int16_t(int32_t(((x & ~z_mask::value)>>4) - u0::value)), int16_t(int32_t((y>>4) - u0::value)), }; } +constexpr global_coords::operator chunk_coords_() const noexcept +{ + return chunk_coords_{ chunk(), z() }; +} + constexpr int8_t global_coords::z() const noexcept { return ((x >> 20) & 0x0f) - z0::value; -- cgit v1.2.3