diff --git a/src/openrct2/park/ParkFile.cpp b/src/openrct2/park/ParkFile.cpp index e90efff4e5..ac67147ac4 100644 --- a/src/openrct2/park/ParkFile.cpp +++ b/src/openrct2/park/ParkFile.cpp @@ -951,9 +951,9 @@ namespace OpenRCT2 void UpdateTrackElementsRideType() { - for (int32_t x = 0; x < MAXIMUM_MAP_SIZE_TECHNICAL; x++) + for (int32_t y = 0; y < MAXIMUM_MAP_SIZE_TECHNICAL; y++) { - for (int32_t y = 0; y < MAXIMUM_MAP_SIZE_TECHNICAL; y++) + for (int32_t x = 0; x < MAXIMUM_MAP_SIZE_TECHNICAL; x++) { TileElement* tileElement = map_get_first_element_at(TileCoordsXY{ x, y }); if (tileElement == nullptr) diff --git a/src/openrct2/ride/Ride.cpp b/src/openrct2/ride/Ride.cpp index 06387e27c6..bb65c054b6 100644 --- a/src/openrct2/ride/Ride.cpp +++ b/src/openrct2/ride/Ride.cpp @@ -5582,9 +5582,9 @@ void determine_ride_entrance_and_exit_locations() // Search the map to find it. Skip the outer ring of invisible tiles. bool alreadyFoundEntrance = false; bool alreadyFoundExit = false; - for (int32_t x = 1; x < MAXIMUM_MAP_SIZE_TECHNICAL - 1; x++) + for (int32_t y = 1; y < MAXIMUM_MAP_SIZE_TECHNICAL - 1; y++) { - for (int32_t y = 1; y < MAXIMUM_MAP_SIZE_TECHNICAL - 1; y++) + for (int32_t x = 1; x < MAXIMUM_MAP_SIZE_TECHNICAL - 1; x++) { TileElement* tileElement = map_get_first_element_at(TileCoordsXY{ x, y }); diff --git a/src/openrct2/world/Map.cpp b/src/openrct2/world/Map.cpp index e9fcb4ea26..f11020ba02 100644 --- a/src/openrct2/world/Map.cpp +++ b/src/openrct2/world/Map.cpp @@ -298,17 +298,17 @@ int32_t tile_element_iterator_next(tile_element_iterator* it) return 1; } - if (it->x < (MAXIMUM_MAP_SIZE_TECHNICAL - 1)) + if (it->y < (MAXIMUM_MAP_SIZE_TECHNICAL - 1)) { - it->x++; + it->y++; it->element = map_get_first_element_at(TileCoordsXY{ it->x, it->y }); return 1; } - if (it->y < (MAXIMUM_MAP_SIZE_TECHNICAL - 1)) + if (it->x < (MAXIMUM_MAP_SIZE_TECHNICAL - 1)) { - it->x = 0; - it->y++; + it->y = 0; + it->x++; it->element = map_get_first_element_at(TileCoordsXY{ it->x, it->y }); return 1; } @@ -462,9 +462,9 @@ void map_count_remaining_land_rights() gLandRemainingOwnershipSales = 0; gLandRemainingConstructionSales = 0; - for (int32_t x = 0; x < MAXIMUM_MAP_SIZE_TECHNICAL; x++) + for (int32_t y = 0; y < MAXIMUM_MAP_SIZE_TECHNICAL; y++) { - for (int32_t y = 0; y < MAXIMUM_MAP_SIZE_TECHNICAL; y++) + for (int32_t x = 0; x < MAXIMUM_MAP_SIZE_TECHNICAL; x++) { auto* surfaceElement = map_get_surface_element_at(TileCoordsXY{ x, y }.ToCoordsXY()); // Surface elements are sometimes hacked out to save some space for other map elements diff --git a/test/tests/TileElementsView.cpp b/test/tests/TileElementsView.cpp index d70cb57efa..b1aae0b7db 100644 --- a/test/tests/TileElementsView.cpp +++ b/test/tests/TileElementsView.cpp @@ -116,9 +116,9 @@ template bool CompareLists(const CoordsXY& pos) template void CheckMapTiles() { - for (int x = 0; x < MAXIMUM_MAP_SIZE_TECHNICAL; ++x) + for (int y = 0; y < MAXIMUM_MAP_SIZE_TECHNICAL; ++y) { - for (int y = 0; y < MAXIMUM_MAP_SIZE_TECHNICAL; ++y) + for (int x = 0; x < MAXIMUM_MAP_SIZE_TECHNICAL; ++x) { auto pos = TileCoordsXY(x, y).ToCoordsXY();