Browse Source

Remove `PointsInRectangle` factory functions

These are no longer needed in C++17 thanks to CTAD.
pull/6490/head
Gleb Mazovetskiy 3 years ago
parent
commit
9ae72f0269
  1. 20
      Source/engine/points_in_rectangle_range.hpp
  2. 2
      Source/objects.cpp
  3. 2
      Source/qol/stash.cpp

20
Source/engine/points_in_rectangle_range.hpp

@ -67,7 +67,7 @@ protected:
}; };
template <typename CoordT> template <typename CoordT>
class PointsInRectangleRange { class PointsInRectangle {
public: public:
using const_iterator = class PointsInRectangleIterator : public PointsInRectangleIteratorBase<CoordT> { using const_iterator = class PointsInRectangleIterator : public PointsInRectangleIteratorBase<CoordT> {
public: public:
@ -188,7 +188,7 @@ public:
} }
}; };
constexpr PointsInRectangleRange(RectangleOf<CoordT> region) constexpr PointsInRectangle(RectangleOf<CoordT> region)
: region(region) : region(region)
{ {
} }
@ -240,13 +240,7 @@ protected:
}; };
template <typename CoordT> template <typename CoordT>
constexpr PointsInRectangleRange<CoordT> PointsInRectangle(RectangleOf<CoordT> region) class PointsInRectangleColMajor {
{
return PointsInRectangleRange<CoordT> { region };
}
template <typename CoordT>
class PointsInRectangleColMajorRange {
public: public:
using const_iterator = class PointsInRectangleIteratorColMajor : public PointsInRectangleIteratorBase<CoordT> { using const_iterator = class PointsInRectangleIteratorColMajor : public PointsInRectangleIteratorBase<CoordT> {
public: public:
@ -368,7 +362,7 @@ public:
}; };
// gcc6 needs a defined constructor? // gcc6 needs a defined constructor?
constexpr PointsInRectangleColMajorRange(RectangleOf<CoordT> region) constexpr PointsInRectangleColMajor(RectangleOf<CoordT> region)
: region(region) : region(region)
{ {
} }
@ -419,10 +413,4 @@ protected:
RectangleOf<CoordT> region; RectangleOf<CoordT> region;
}; };
template <typename CoordT = int>
constexpr PointsInRectangleColMajorRange<CoordT> PointsInRectangleColMajor(RectangleOf<CoordT> region)
{
return PointsInRectangleColMajorRange<CoordT> { region };
}
} // namespace devilution } // namespace devilution

2
Source/objects.cpp

@ -3579,7 +3579,7 @@ void ResyncDoors(WorldTilePosition p1, WorldTilePosition p2, bool sendmsg)
const WorldTileSize size { static_cast<WorldTileCoord>(p2.x - p1.x), static_cast<WorldTileCoord>(p2.y - p1.y) }; const WorldTileSize size { static_cast<WorldTileCoord>(p2.x - p1.x), static_cast<WorldTileCoord>(p2.y - p1.y) };
const WorldTileRectangle area { p1, size }; const WorldTileRectangle area { p1, size };
for (WorldTilePosition p : PointsInRectangleRange<WorldTileCoord> { area }) { for (const WorldTilePosition p : PointsInRectangle { area }) {
Object *obj = FindObjectAtPosition(p); Object *obj = FindObjectAtPosition(p);
if (obj == nullptr) if (obj == nullptr)
continue; continue;

2
Source/qol/stash.cpp

@ -50,7 +50,7 @@ constexpr Rectangle StashButtonRect[] = {
// clang-format on // clang-format on
}; };
constexpr PointsInRectangleRange<int> StashGridRange { { { 0, 0 }, Size { 10, 10 } } }; constexpr PointsInRectangle<int> StashGridRange { { { 0, 0 }, Size { 10, 10 } } };
OptionalOwnedClxSpriteList StashPanelArt; OptionalOwnedClxSpriteList StashPanelArt;
OptionalOwnedClxSpriteList StashNavButtonArt; OptionalOwnedClxSpriteList StashNavButtonArt;

Loading…
Cancel
Save