From 6cf28269e6c4dc2a9cb09c8013a3cc21a190f31a Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 15 Sep 2023 11:25:11 +0200 Subject: src: fix chunk_coords_::operator[+-]= typo for Vector[23] --- src/global-coords.hpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/global-coords.hpp b/src/global-coords.hpp index 4a4d2d4d..9df9e5de 100644 --- a/src/global-coords.hpp +++ b/src/global-coords.hpp @@ -36,25 +36,27 @@ struct chunk_coords_ final { template constexpr chunk_coords_ operator+(Math::Vector2 off) const noexcept { return { int16_t(x + int{off.x()}), int16_t(y + int{off.y()}), z }; } - template constexpr chunk_coords_ operator-(Math::Vector2 off) const noexcept { return { int16_t(x - int{off.x()}), int16_t(y - int{off.y()}), z }; } + template constexpr chunk_coords_& operator+=(Math::Vector2 off) noexcept { + x = int16_t(x + int{off.x()}); y = int16_t(y + int{off.y()}); return *this; + } + template constexpr chunk_coords_& operator-=(Math::Vector2 off) noexcept { + x = int16_t(x - int{off.x()}); y = int16_t(y - int{off.y()}); return *this; + } template constexpr chunk_coords_ operator+(Math::Vector3 off) const noexcept { return { int16_t(x + int{off.x()}), int16_t(y + int{off.y()}), int8_t(z + int{off.z()}) }; } - template constexpr chunk_coords_ operator-(Math::Vector3 off) const noexcept { return { int16_t(x - int{off.x()}), int16_t(y - int{off.y()}), int8_t(z - int{off.z()}) }; } - - template constexpr chunk_coords_& operator+=(Math::Vector2 off) noexcept { - x = int16_t(x + int{off.x()}); y = int16_t(y + int{off.y()}); z = int8_t(z + off.z()); return *this; + template constexpr chunk_coords_& operator+=(Math::Vector3 off) noexcept { + x = int16_t(x + int{off.x()}); y = int16_t(y + int{off.y()}); z = int8_t(z + int{off.z()}); return *this; } - - template constexpr chunk_coords_& operator-=(Math::Vector2 off) noexcept { - x = int16_t(x - int{off.x()}); y = int16_t(y - int{off.y()}); z = int8_t(z - off.z()); return *this; + template constexpr chunk_coords_& operator-=(Math::Vector3 off) noexcept { + x = int16_t(x - int{off.x()}); y = int16_t(y - int{off.y()}); z = int8_t(z + int{off.z()}); return *this; } constexpr Vector3i operator-(chunk_coords_ other) const noexcept { return Vector3i{x - other.x, y - other.y, z - other.z}; } -- cgit v1.2.3