mirror of https://github.com/OpenRCT2/OpenRCT2.git
Add Coords constructor to Map and CoordsRange
This commit is contained in:
parent
701f7f6d67
commit
70e245a1c3
|
@ -636,8 +636,13 @@ template<class T> struct CoordsRange
|
||||||
|
|
||||||
CoordsRange() = default;
|
CoordsRange() = default;
|
||||||
CoordsRange(int32_t left, int32_t top, int32_t right, int32_t bottom)
|
CoordsRange(int32_t left, int32_t top, int32_t right, int32_t bottom)
|
||||||
: LeftTop(left, top)
|
: CoordsRange({ left, top }, { right, bottom })
|
||||||
, RightBottom(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;
|
using CoordsRange::CoordsRange;
|
||||||
MapRange(int32_t left, int32_t top, int32_t right, int32_t bottom)
|
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
|
// Make sure it's a rectangle
|
||||||
assert(std::abs(GetLeft() - GetRight()) > 0);
|
assert(std::abs(GetLeft() - GetRight()) > 0);
|
||||||
|
|
Loading…
Reference in New Issue