From 4eadbe3c6ea8333466e3edec3a197ef08ce1fb7f Mon Sep 17 00:00:00 2001 From: aaruel Date: Tue, 9 Jul 2019 21:10:57 -0400 Subject: [PATCH] Cleaned up location duplication check --- src/openrct2/ride/Ride.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/openrct2/ride/Ride.cpp b/src/openrct2/ride/Ride.cpp index c0ae247732..bcad8e20ed 100644 --- a/src/openrct2/ride/Ride.cpp +++ b/src/openrct2/ride/Ride.cpp @@ -7132,15 +7132,16 @@ void sub_6CB945(Ride* ride) } } - for (auto locationList = locations.cbegin(); locationList != locations.cend(); locationList++) + auto locationListIter = locations.cbegin(); + for (const TileCoordsXYZD& locationCoords : locations) { - auto locationList2 = locationList; - locationList2++; + auto locationList = ++locationListIter; bool duplicateLocation = false; - for (; locationList2 != locations.cend(); locationList2++) + while (locationList != locations.cend()) { - if ((*locationList).x == (*locationList2).x && (*locationList).y == (*locationList2).y) + const TileCoordsXYZD& locationCoords2 = *locationList++; + if (locationCoords.x == locationCoords2.x && locationCoords.y == locationCoords2.y) { duplicateLocation = true; break; @@ -7152,7 +7153,7 @@ void sub_6CB945(Ride* ride) continue; } - CoordsXY location = { (*locationList).x * 32, (*locationList).y * 32 }; + CoordsXY location = { locationCoords.x * 32, locationCoords.y * 32 }; TileElement* tileElement = map_get_first_element_at(location.x >> 5, location.y >> 5); do