mirror of https://github.com/OpenRCT2/OpenRCT2.git
Add multiply and divide to coordinate components
This commit is contained in:
parent
e7adf19f62
commit
a2ebec8676
|
@ -139,6 +139,20 @@ struct CoordsXY
|
||||||
return *this;
|
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
|
constexpr bool operator>=(const CoordsXY& rhs) const
|
||||||
{
|
{
|
||||||
return x >= rhs.x && y >= rhs.y;
|
return x >= rhs.x && y >= rhs.y;
|
||||||
|
@ -159,6 +173,16 @@ struct CoordsXY
|
||||||
return { x - rhs.x, y - rhs.y };
|
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
|
constexpr CoordsXY Rotate(int32_t direction) const
|
||||||
{
|
{
|
||||||
CoordsXY rotatedCoords;
|
CoordsXY rotatedCoords;
|
||||||
|
|
Loading…
Reference in New Issue