diff --git a/src/openrct2-ui/interface/Graph.cpp b/src/openrct2-ui/interface/Graph.cpp index 19e876f07d..3435b2f9db 100644 --- a/src/openrct2-ui/interface/Graph.cpp +++ b/src/openrct2-ui/interface/Graph.cpp @@ -189,41 +189,6 @@ struct FinancialTooltipInfo const money32 money{}; }; -struct ScreenRect -{ - const ScreenCoordsXY LeftTop; - const ScreenCoordsXY RightBottom; - - int32_t GetLeft() const - { - return LeftTop.x; - } - int32_t GetTop() const - { - return LeftTop.y; - } - int32_t GetRight() const - { - return RightBottom.x; - } - int32_t GetBottom() const - { - return RightBottom.y; - } - int32_t GetWidth() const - { - return RightBottom.x - LeftTop.x; - } - int32_t GetHeight() const - { - return RightBottom.y - LeftTop.y; - } - bool Contains(const ScreenCoordsXY& coords) const - { - return coords.x >= GetLeft() && coords.x <= GetRight() && coords.y >= GetTop() && coords.y <= GetBottom(); - } -}; - static constexpr auto CHART_MAX_DATA_COUNT = 64; static constexpr auto CHART_MAX_INDEX = CHART_MAX_DATA_COUNT - 1; static constexpr auto CHART_DATA_WIDTH = 6; diff --git a/src/openrct2/world/Location.hpp b/src/openrct2/world/Location.hpp index af9a0b8787..54c0a02eb1 100644 --- a/src/openrct2/world/Location.hpp +++ b/src/openrct2/world/Location.hpp @@ -689,3 +689,31 @@ struct ScreenLine : public CoordsRange assert((std::abs(GetLeft() - GetRight()) > 0) || (std::abs(GetTop() - GetBottom()) > 0)); } }; + +/** + * Represents a rectangular range on the screen + */ + +struct ScreenRect : public CoordsRange +{ + ScreenRect(const ScreenCoordsXY& leftTop, const ScreenCoordsXY& rightBottom) + : CoordsRange(leftTop, rightBottom) + { + // Make sure it's a rectangle + assert(std::abs(GetLeft() - GetRight()) > 0); + assert(std::abs(GetTop() - GetBottom()) > 0); + } + + int32_t GetWidth() const + { + return RightBottom.x - LeftTop.x; + } + int32_t GetHeight() const + { + return RightBottom.y - LeftTop.y; + } + bool Contains(const ScreenCoordsXY& coords) const + { + return coords.x >= GetLeft() && coords.x <= GetRight() && coords.y >= GetTop() && coords.y <= GetBottom(); + } +};