From 610ed8153aa576aa60137a67edb6af2e45a5a205 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 29 Nov 2022 23:04:08 +0100 Subject: editor: fix hovering scenery on non-center chunk --- src/global-coords.hpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/global-coords.hpp b/src/global-coords.hpp index 5453662e..94b0d48e 100644 --- a/src/global-coords.hpp +++ b/src/global-coords.hpp @@ -10,8 +10,14 @@ struct chunk_coords final { std::int16_t x = 0, y = 0; constexpr bool operator==(const chunk_coords& other) const noexcept = default; + constexpr Vector2i operator-(chunk_coords other) const noexcept; }; +constexpr Vector2i chunk_coords::operator-(chunk_coords other) const noexcept +{ + return { Int{x} - other.x, Int{y} - other.y }; +} + struct global_coords final { static constexpr std::uint32_t _0u = 1 << 15; static constexpr auto _0s = std::int32_t(_0u); -- cgit v1.2.3