From a2ebec8676a9f5a07ea18be829f99cb7a47a5fb1 Mon Sep 17 00:00:00 2001 From: Matt Date: Tue, 9 Feb 2021 14:25:46 +0200 Subject: [PATCH] Add multiply and divide to coordinate components --- src/openrct2/world/Location.hpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/openrct2/world/Location.hpp b/src/openrct2/world/Location.hpp index c677b834e8..fae9ba192a 100644 --- a/src/openrct2/world/Location.hpp +++ b/src/openrct2/world/Location.hpp @@ -139,6 +139,20 @@ struct CoordsXY return *this; } + constexpr CoordsXY& operator*=(const int32_t rhs) + { + x *= rhs; + y *= rhs; + return *this; + } + + constexpr CoordsXY& operator/=(const int32_t rhs) + { + x /= rhs; + y /= rhs; + return *this; + } + constexpr bool operator>=(const CoordsXY& rhs) const { return x >= rhs.x && y >= rhs.y; @@ -159,6 +173,16 @@ struct CoordsXY return { x - rhs.x, y - rhs.y }; } + constexpr const CoordsXY operator*(const int32_t rhs) const + { + return { x * rhs, y * rhs }; + } + + constexpr const CoordsXY operator/(const int32_t rhs) const + { + return { x / rhs, y / rhs }; + } + constexpr CoordsXY Rotate(int32_t direction) const { CoordsXY rotatedCoords;