diff options
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 |
