From 9ae72f0269ff5ea6cdcbc15751a2b3eb84f36a6c Mon Sep 17 00:00:00 2001 From: Gleb Mazovetskiy Date: Sun, 20 Aug 2023 14:20:20 +0900 Subject: [PATCH] Remove `PointsInRectangle` factory functions These are no longer needed in C++17 thanks to CTAD. --- Source/engine/points_in_rectangle_range.hpp | 20 ++++---------------- Source/objects.cpp | 2 +- Source/qol/stash.cpp | 2 +- 3 files changed, 6 insertions(+), 18 deletions(-) diff --git a/Source/engine/points_in_rectangle_range.hpp b/Source/engine/points_in_rectangle_range.hpp index bb7669845..959035258 100644 --- a/Source/engine/points_in_rectangle_range.hpp +++ b/Source/engine/points_in_rectangle_range.hpp @@ -67,7 +67,7 @@ protected: }; template -class PointsInRectangleRange { +class PointsInRectangle { public: using const_iterator = class PointsInRectangleIterator : public PointsInRectangleIteratorBase { public: @@ -188,7 +188,7 @@ public: } }; - constexpr PointsInRectangleRange(RectangleOf region) + constexpr PointsInRectangle(RectangleOf region) : region(region) { } @@ -240,13 +240,7 @@ protected: }; template -constexpr PointsInRectangleRange PointsInRectangle(RectangleOf region) -{ - return PointsInRectangleRange { region }; -} - -template -class PointsInRectangleColMajorRange { +class PointsInRectangleColMajor { public: using const_iterator = class PointsInRectangleIteratorColMajor : public PointsInRectangleIteratorBase { public: @@ -368,7 +362,7 @@ public: }; // gcc6 needs a defined constructor? - constexpr PointsInRectangleColMajorRange(RectangleOf region) + constexpr PointsInRectangleColMajor(RectangleOf region) : region(region) { } @@ -419,10 +413,4 @@ protected: RectangleOf region; }; -template -constexpr PointsInRectangleColMajorRange PointsInRectangleColMajor(RectangleOf region) -{ - return PointsInRectangleColMajorRange { region }; -} - } // namespace devilution diff --git a/Source/objects.cpp b/Source/objects.cpp index b94508343..c0e19b2d6 100644 --- a/Source/objects.cpp +++ b/Source/objects.cpp @@ -3579,7 +3579,7 @@ void ResyncDoors(WorldTilePosition p1, WorldTilePosition p2, bool sendmsg) const WorldTileSize size { static_cast(p2.x - p1.x), static_cast(p2.y - p1.y) }; const WorldTileRectangle area { p1, size }; - for (WorldTilePosition p : PointsInRectangleRange { area }) { + for (const WorldTilePosition p : PointsInRectangle { area }) { Object *obj = FindObjectAtPosition(p); if (obj == nullptr) continue; diff --git a/Source/qol/stash.cpp b/Source/qol/stash.cpp index 19149a07a..40a7f8f35 100644 --- a/Source/qol/stash.cpp +++ b/Source/qol/stash.cpp @@ -50,7 +50,7 @@ constexpr Rectangle StashButtonRect[] = { // clang-format on }; -constexpr PointsInRectangleRange StashGridRange { { { 0, 0 }, Size { 10, 10 } } }; +constexpr PointsInRectangle StashGridRange { { { 0, 0 }, Size { 10, 10 } } }; OptionalOwnedClxSpriteList StashPanelArt; OptionalOwnedClxSpriteList StashNavButtonArt;