1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-16 03:23:15 +01:00

Add multiply and divide to coordinate components

This commit is contained in:
Matt
2021-02-09 14:25:46 +02:00
parent e7adf19f62
commit a2ebec8676

View File

@@ -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;