summaryrefslogtreecommitdiffhomepage
path: root/src/global-coords.hpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2022-11-29 23:04:08 +0100
committerStanislaw Halik <sthalik@misaki.pl>2022-11-29 23:21:16 +0100
commit610ed8153aa576aa60137a67edb6af2e45a5a205 (patch)
tree97dd20392efdf4d07e5bb757cb50f36fa494e2b6 /src/global-coords.hpp
parent9c5027215e1052adb0131362207b78ec89822985 (diff)
editor: fix hovering scenery on non-center chunk
Diffstat (limited to 'src/global-coords.hpp')
-rw-r--r--src/global-coords.hpp6
1 files changed, 6 insertions, 0 deletions
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);