diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2023-09-15 11:25:11 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2023-09-15 17:39:32 +0200 |
commit | 6cf28269e6c4dc2a9cb09c8013a3cc21a190f31a (patch) | |
tree | 6e30976ca567b938a4b9fb9348e7534de34aa6b6 | |
parent | 7e21f1168aa30defa51f88b4f921aa0b0b7bd708 (diff) |
src: fix chunk_coords_::operator[+-]= typo for Vector[23]
-rw-r--r-- | src/global-coords.hpp | 18 |
1 files 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<std::integral T> constexpr chunk_coords_ operator+(Math::Vector2<T> off) const noexcept { return { int16_t(x + int{off.x()}), int16_t(y + int{off.y()}), z }; } - template<std::integral T> constexpr chunk_coords_ operator-(Math::Vector2<T> off) const noexcept { return { int16_t(x - int{off.x()}), int16_t(y - int{off.y()}), z }; } + template<std::integral T> constexpr chunk_coords_& operator+=(Math::Vector2<T> off) noexcept { + x = int16_t(x + int{off.x()}); y = int16_t(y + int{off.y()}); return *this; + } + template<std::integral T> constexpr chunk_coords_& operator-=(Math::Vector2<T> off) noexcept { + x = int16_t(x - int{off.x()}); y = int16_t(y - int{off.y()}); return *this; + } template<std::integral T> constexpr chunk_coords_ operator+(Math::Vector3<T> off) const noexcept { return { int16_t(x + int{off.x()}), int16_t(y + int{off.y()}), int8_t(z + int{off.z()}) }; } - template<std::integral T> constexpr chunk_coords_ operator-(Math::Vector3<T> off) const noexcept { return { int16_t(x - int{off.x()}), int16_t(y - int{off.y()}), int8_t(z - int{off.z()}) }; } - - template<std::integral T> constexpr chunk_coords_& operator+=(Math::Vector2<T> 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<std::integral T> constexpr chunk_coords_& operator+=(Math::Vector3<T> 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<std::integral T> constexpr chunk_coords_& operator-=(Math::Vector2<T> 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<std::integral T> constexpr chunk_coords_& operator-=(Math::Vector3<T> 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}; } |