1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-16 19:43:06 +01:00

Add Coords constructor to Map and CoordsRange

This commit is contained in:
Tulio Leao
2020-06-30 09:12:14 -03:00
parent 701f7f6d67
commit 70e245a1c3

View File

@@ -636,8 +636,13 @@ template<class T> struct CoordsRange
CoordsRange() = default;
CoordsRange(int32_t left, int32_t top, int32_t right, int32_t bottom)
: LeftTop(left, top)
, RightBottom(right, bottom)
: CoordsRange({ left, top }, { right, bottom })
{
}
CoordsRange(const T& leftTop, const T& rightBottom)
: LeftTop(leftTop)
, RightBottom(rightBottom)
{
}
};
@@ -650,7 +655,12 @@ struct MapRange : public CoordsRange<CoordsXY>
{
using CoordsRange::CoordsRange;
MapRange(int32_t left, int32_t top, int32_t right, int32_t bottom)
: CoordsRange<CoordsXY>(left, top, right, bottom)
: MapRange({ left, top }, { right, bottom })
{
}
MapRange(const CoordsXY& leftTop, const CoordsXY& rightBottom)
: CoordsRange<CoordsXY>(leftTop, rightBottom)
{
// Make sure it's a rectangle
assert(std::abs(GetLeft() - GetRight()) > 0);