diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2022-10-16 21:51:07 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2022-10-16 21:51:07 +0200 |
commit | 7ab99aabe8509e84b9b5b04aafa1e1ae20b40512 (patch) | |
tree | e86c02ccaa195b0dc239ff04e50f9efa8cb54a34 /src | |
parent | 0db5306c483c718076b14349f223840cce2862bd (diff) |
a
Diffstat (limited to 'src')
-rw-r--r-- | src/world.hpp | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/src/world.hpp b/src/world.hpp index 0d28429e..b21502e0 100644 --- a/src/world.hpp +++ b/src/world.hpp @@ -9,21 +9,12 @@ struct chunk_coords final { }; struct global_coords final { + std::int16_t cx = 0, cy = 0; std::int32_t x = 0, y = 0; - constexpr chunk_coords chunk() const noexcept; - constexpr chunk_coords local() const noexcept; -}; - -constexpr chunk_coords global_coords::chunk() const noexcept { - constexpr std::uint32_t mask = 0xffff0000u; - const auto x_ = (std::int16_t)(std::uint16_t)((std::uint32_t)x & mask >> 24), - y_ = (std::int16_t)(std::uint16_t)((std::uint32_t)y & mask >> 24); - return {x_, y_}; -} -constexpr chunk_coords global_coords::local() const noexcept { - const auto x_ = (std::uint8_t)x, y_ = (std::uint8_t)y; - return {x_, y_}; -} + constexpr global_coords(chunk_coords c, local_coords xy) + : cx{c.x}, cy{c.y}, x{xy.x}, y{xy.y} + {} +}; } // namespace floormat |