From b573bd49b38992328f082be1f7684e6a79097184 Mon Sep 17 00:00:00 2001 From: Michael Steenbeek Date: Thu, 24 May 2018 11:44:53 +0200 Subject: [PATCH] Replace all occurrences of tile_element_is_last_for_tile() --- src/openrct2-ui/windows/Footpath.cpp | 2 +- src/openrct2-ui/windows/Map.cpp | 5 +- src/openrct2-ui/windows/TileInspector.cpp | 4 +- src/openrct2/actions/WallRemoveAction.hpp | 2 +- .../interface/ViewportInteraction.cpp | 2 +- src/openrct2/paint/VirtualFloor.cpp | 2 +- .../paint/tile_element/TileElement.cpp | 10 +- src/openrct2/peep/Guest.cpp | 146 ++++++++-------- src/openrct2/peep/GuestPathfinding.cpp | 16 +- src/openrct2/peep/Peep.cpp | 8 +- src/openrct2/peep/Staff.cpp | 34 ++-- src/openrct2/rct1/S4Importer.cpp | 12 +- src/openrct2/ride/Ride.cpp | 42 ++--- src/openrct2/ride/RideRatings.cpp | 12 +- src/openrct2/ride/Station.cpp | 4 +- src/openrct2/ride/Track.cpp | 8 +- src/openrct2/ride/TrackDesign.cpp | 2 +- src/openrct2/ride/TrackDesignSave.cpp | 14 +- src/openrct2/ride/Vehicle.cpp | 6 +- src/openrct2/ride/gentle/ObservationTower.cpp | 2 +- src/openrct2/ride/thrill/LaunchedFreefall.cpp | 2 +- src/openrct2/ride/thrill/RotoDrop.cpp | 2 +- src/openrct2/ride/transport/Chairlift.cpp | 2 +- src/openrct2/scenario/Scenario.cpp | 2 +- src/openrct2/world/Banner.cpp | 10 +- src/openrct2/world/Entrance.cpp | 6 +- src/openrct2/world/Footpath.cpp | 40 ++--- src/openrct2/world/Fountain.cpp | 2 +- src/openrct2/world/Map.cpp | 158 +++++++++--------- src/openrct2/world/MapAnimation.cpp | 26 +-- src/openrct2/world/Park.cpp | 4 +- src/openrct2/world/Scenery.cpp | 10 +- src/openrct2/world/SmallScenery.cpp | 2 +- src/openrct2/world/Sprite.cpp | 2 +- src/openrct2/world/TileElement.cpp | 7 +- src/openrct2/world/TileInspector.cpp | 12 +- src/openrct2/world/Wall.cpp | 6 +- 37 files changed, 311 insertions(+), 315 deletions(-) diff --git a/src/openrct2-ui/windows/Footpath.cpp b/src/openrct2-ui/windows/Footpath.cpp index 5bc5cd13c8..8a479f42b2 100644 --- a/src/openrct2-ui/windows/Footpath.cpp +++ b/src/openrct2-ui/windows/Footpath.cpp @@ -1139,7 +1139,7 @@ static rct_tile_element * footpath_get_tile_element_to_remove() } } } - while (!tile_element_is_last_for_tile(tileElement++)); + while (!(tileElement++)->IsLastForTile()); return nullptr; } diff --git a/src/openrct2-ui/windows/Map.cpp b/src/openrct2-ui/windows/Map.cpp index 555698de06..cae023303f 100644 --- a/src/openrct2-ui/windows/Map.cpp +++ b/src/openrct2-ui/windows/Map.cpp @@ -1570,7 +1570,8 @@ static uint16 map_window_get_pixel_colour_peep(CoordsXY c) colour = MAP_COLOUR_UNOWNED(colour); const sint32 maxSupportedTileElementType = (sint32)Util::CountOf(ElementTypeAddColour); - while (!tile_element_is_last_for_tile(tileElement++)) { + while (!(tileElement++)->IsLastForTile()) + { sint32 tileElementType = tileElement->GetType() >> 2; if (tileElementType >= maxSupportedTileElementType) { tileElementType = TILE_ELEMENT_TYPE_CORRUPT >> 2; @@ -1611,7 +1612,7 @@ static uint16 map_window_get_pixel_colour_ride(CoordsXY c) colourA = RideKeyColours[RideColourKey[ride->type]]; break; } - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); if (colourA != 0) return colourA; diff --git a/src/openrct2-ui/windows/TileInspector.cpp b/src/openrct2-ui/windows/TileInspector.cpp index 1697caf77d..0c6e1ca484 100644 --- a/src/openrct2-ui/windows/TileInspector.cpp +++ b/src/openrct2-ui/windows/TileInspector.cpp @@ -623,7 +623,7 @@ static void window_tile_inspector_load_tile(rct_window* w) sint32 numItems = 0; do { numItems++; - } while (!tile_element_is_last_for_tile(element++)); + } while (!(element++)->IsLastForTile()); windowTileInspectorElementCount = numItems; @@ -2086,5 +2086,5 @@ static void window_tile_inspector_scrollpaint(rct_window *w, rct_drawpixelinfo * y -= LIST_ITEM_HEIGHT; i++; - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); } diff --git a/src/openrct2/actions/WallRemoveAction.hpp b/src/openrct2/actions/WallRemoveAction.hpp index 386e2ffee0..49678d21bd 100644 --- a/src/openrct2/actions/WallRemoveAction.hpp +++ b/src/openrct2/actions/WallRemoveAction.hpp @@ -121,7 +121,7 @@ private: continue; return tileElement; - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); return nullptr; } }; diff --git a/src/openrct2/interface/ViewportInteraction.cpp b/src/openrct2/interface/ViewportInteraction.cpp index 3a5ad71a7b..bec4f8ce53 100644 --- a/src/openrct2/interface/ViewportInteraction.cpp +++ b/src/openrct2/interface/ViewportInteraction.cpp @@ -457,7 +457,7 @@ static void viewport_interaction_remove_footpath(rct_tile_element *tileElement, footpath_remove(x, y, z, GAME_COMMAND_FLAG_APPLY); break; } - } while (!tile_element_is_last_for_tile(tileElement2++)); + } while (!(tileElement2++)->IsLastForTile()); } /** diff --git a/src/openrct2/paint/VirtualFloor.cpp b/src/openrct2/paint/VirtualFloor.cpp index edaf06619d..94e2bb7041 100644 --- a/src/openrct2/paint/VirtualFloor.cpp +++ b/src/openrct2/paint/VirtualFloor.cpp @@ -291,7 +291,7 @@ static void virtual_floor_get_tile_properties(sint16 x, sint16 y, sint16 height, *outOccupied = true; } - while (!tile_element_is_last_for_tile(tileElement++)); + while (!(tileElement++)->IsLastForTile()); } void virtual_floor_paint(paint_session * session) diff --git a/src/openrct2/paint/tile_element/TileElement.cpp b/src/openrct2/paint/tile_element/TileElement.cpp index a3a850cfd6..18f3791a93 100644 --- a/src/openrct2/paint/tile_element/TileElement.cpp +++ b/src/openrct2/paint/tile_element/TileElement.cpp @@ -222,7 +222,7 @@ static void sub_68B3FB(paint_session * session, sint32 x, sint32 y) uint16 max_height = 0; do{ max_height = Math::Max(max_height, (uint16)element->clearance_height); - } while (!tile_element_is_last_for_tile(element++)); + } while (!(element++)->IsLastForTile()); element--; @@ -269,7 +269,7 @@ static void sub_68B3FB(paint_session * session, sint32 x, sint32 y) session->PathElementOnSameHeight = nullptr; session->TrackElementOnSameHeight = nullptr; rct_tile_element * tile_element_sub_iterator = tile_element; - while (!tile_element_is_last_for_tile(tile_element_sub_iterator++)) + while (!(tile_element_sub_iterator++)->IsLastForTile()) { if (tile_element_sub_iterator->base_height != tile_element->base_height) { @@ -286,7 +286,7 @@ static void sub_68B3FB(paint_session * session, sint32 x, sint32 y) case TILE_ELEMENT_TYPE_CORRUPT: // To preserve regular behaviour, make an element hidden by // corruption also invisible to this method. - if (tile_element_is_last_for_tile(tile_element)) + if (tile_element->IsLastForTile()) { break; } @@ -327,7 +327,7 @@ static void sub_68B3FB(paint_session * session, sint32 x, sint32 y) break; // A corrupt element inserted by OpenRCT2 itself, which skips the drawing of the next element only. case TILE_ELEMENT_TYPE_CORRUPT: - if (tile_element_is_last_for_tile(tile_element)) + if (tile_element->IsLastForTile()) return; tile_element++; break; @@ -336,7 +336,7 @@ static void sub_68B3FB(paint_session * session, sint32 x, sint32 y) return; } session->MapPosition = dword_9DE574; - } while (!tile_element_is_last_for_tile(tile_element++)); + } while (!(tile_element++)->IsLastForTile()); #ifndef __TESTPAINT__ if (gConfigGeneral.use_virtual_floor && partOfVirtualFloor) diff --git a/src/openrct2/peep/Guest.cpp b/src/openrct2/peep/Guest.cpp index 7fbd6e9dfc..b3042e6a5a 100644 --- a/src/openrct2/peep/Guest.cpp +++ b/src/openrct2/peep/Guest.cpp @@ -659,7 +659,7 @@ void rct_peep::Tick128UpdateGuest(sint32 index) } } break; - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); if (found) { @@ -1635,7 +1635,7 @@ void rct_peep::PickRideToGoOn() sint32 rideIndex = track_element_get_ride_index(tileElement); rideConsideration[rideIndex >> 5] |= (1u << (rideIndex & 0x1F)); - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); } } } @@ -2782,7 +2782,7 @@ static uint8 peep_assess_surroundings(sint16 centre_x, sint16 centre_y, sint16 c } break; } - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); } } @@ -2976,7 +2976,7 @@ static void peep_head_for_nearest_ride_type(rct_peep * peep, sint32 rideType) { rideConsideration[rideIndex >> 5] |= (1u << (rideIndex & 0x1F)); } - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); } } } @@ -3105,7 +3105,7 @@ static void peep_head_for_nearest_ride_with_flags(rct_peep * peep, sint32 rideTy { rideConsideration[rideIndex >> 5] |= (1u << (rideIndex & 0x1F)); } - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); } } } @@ -4767,7 +4767,7 @@ void rct_peep::UpdateRideMazePathfinding() if (tileElement->GetType() == TILE_ELEMENT_TYPE_TRACK && stationHeight == tileElement->base_height) break; - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); uint16 mazeEntry = track_element_get_maze_entry(tileElement); uint16 openHedges = 0; @@ -4840,7 +4840,7 @@ void rct_peep::UpdateRideMazePathfinding() mazeType = maze_type::entrance_or_exit; break; } - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); switch (mazeType) { @@ -4939,7 +4939,7 @@ void rct_peep::UpdateRideLeaveExit() MoveTo(x, y, height); Invalidate(); return; - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); } /** @@ -5305,16 +5305,16 @@ void rct_peep::UpdateWalking() if (GetNextIsSurface() || GetNextIsSloped()) return; - rct_tile_element * tile_element = map_get_first_element_at(next_x / 32, next_y / 32); + rct_tile_element * tileElement = map_get_first_element_at(next_x / 32, next_y / 32); - for (;; tile_element++) + for (;; tileElement++) { - if (tile_element->GetType() == TILE_ELEMENT_TYPE_PATH) + if (tileElement->GetType() == TILE_ELEMENT_TYPE_PATH) { - if (next_z == tile_element->base_height) + if (next_z == tileElement->base_height) break; } - if (tile_element_is_last_for_tile(tile_element)) + if (tileElement->IsLastForTile()) { return; } @@ -5322,11 +5322,11 @@ void rct_peep::UpdateWalking() sint32 positions_free = 15; - if (footpath_element_has_path_scenery(tile_element)) + if (footpath_element_has_path_scenery(tileElement)) { - if (!footpath_element_path_scenery_is_ghost(tile_element)) + if (!footpath_element_path_scenery_is_ghost(tileElement)) { - rct_scenery_entry * sceneryEntry = get_footpath_item_entry(footpath_element_get_path_scenery_index(tile_element)); + rct_scenery_entry * sceneryEntry = get_footpath_item_entry(footpath_element_get_path_scenery_index(tileElement)); if (sceneryEntry == nullptr) { return; @@ -5337,7 +5337,7 @@ void rct_peep::UpdateWalking() } } - sint32 edges = (tile_element->properties.path.edges & 0xF) ^ 0xF; + sint32 edges = (tileElement->properties.path.edges & 0xF) ^ 0xF; if (edges == 0) return; @@ -5738,45 +5738,45 @@ void rct_peep::UpdateUsingBin() return; } - rct_tile_element * tile_element = map_get_first_element_at(next_x / 32, next_y / 32); + rct_tile_element * tileElement = map_get_first_element_at(next_x / 32, next_y / 32); - for (;; tile_element++) + for (;; tileElement++) { - if (tile_element->GetType() != TILE_ELEMENT_TYPE_PATH) + if (tileElement->GetType() != TILE_ELEMENT_TYPE_PATH) { continue; } - if (tile_element->base_height == next_z) + if (tileElement->base_height == next_z) break; - if (tile_element_is_last_for_tile(tile_element)) + if (tileElement->IsLastForTile()) { StateReset(); return; } } - if (!footpath_element_has_path_scenery(tile_element)) + if (!footpath_element_has_path_scenery(tileElement)) { StateReset(); return; } - rct_scenery_entry * sceneryEntry = get_footpath_item_entry(footpath_element_get_path_scenery_index(tile_element)); + rct_scenery_entry * sceneryEntry = get_footpath_item_entry(footpath_element_get_path_scenery_index(tileElement)); if (!(sceneryEntry->path_bit.flags & PATH_BIT_FLAG_IS_BIN)) { StateReset(); return; } - if (tile_element->flags & TILE_ELEMENT_FLAG_BROKEN) + if (tileElement->flags & TILE_ELEMENT_FLAG_BROKEN) { StateReset(); return; } - if (footpath_element_path_scenery_is_ghost(tile_element)) + if (footpath_element_path_scenery_is_ghost(tileElement)) { StateReset(); return; @@ -5786,7 +5786,7 @@ void rct_peep::UpdateUsingBin() uint8 selected_bin = var_37 * 2; // This counts down 2 = No rubbish, 0 = full - uint8 space_left_in_bin = 0x3 & (tile_element->properties.path.addition_status >> selected_bin); + uint8 space_left_in_bin = 0x3 & (tileElement->properties.path.addition_status >> selected_bin); uint32 empty_containers = HasEmptyContainerStandardFlag(); for (uint8 cur_container = 0; cur_container < 32; cur_container++) @@ -5853,11 +5853,11 @@ void rct_peep::UpdateUsingBin() } // Place new amount in bin by first clearing the value - tile_element->properties.path.addition_status &= ~(3 << selected_bin); + tileElement->properties.path.addition_status &= ~(3 << selected_bin); // Then placing the new value. - tile_element->properties.path.addition_status |= space_left_in_bin << selected_bin; + tileElement->properties.path.addition_status |= space_left_in_bin << selected_bin; - map_invalidate_tile_zoom0(next_x, next_y, tile_element->base_height << 3, tile_element->clearance_height << 3); + map_invalidate_tile_zoom0(next_x, next_y, tileElement->base_height << 3, tileElement->clearance_height << 3); StateReset(); break; } @@ -5909,35 +5909,35 @@ bool rct_peep::UpdateWalkingFindBench() if (!ShouldFindBench()) return false; - rct_tile_element * tile_element = map_get_first_element_at(next_x / 32, next_y / 32); + rct_tile_element * tileElement = map_get_first_element_at(next_x / 32, next_y / 32); - for (;; tile_element++) + for (;; tileElement++) { - if (tile_element->GetType() == TILE_ELEMENT_TYPE_PATH) + if (tileElement->GetType() == TILE_ELEMENT_TYPE_PATH) { - if (next_z == tile_element->base_height) + if (next_z == tileElement->base_height) break; } - if (tile_element_is_last_for_tile(tile_element)) + if (tileElement->IsLastForTile()) { return false; } } - if (!footpath_element_has_path_scenery(tile_element)) + if (!footpath_element_has_path_scenery(tileElement)) return false; - rct_scenery_entry * sceneryEntry = get_footpath_item_entry(footpath_element_get_path_scenery_index(tile_element)); + rct_scenery_entry * sceneryEntry = get_footpath_item_entry(footpath_element_get_path_scenery_index(tileElement)); if (sceneryEntry == nullptr || !(sceneryEntry->path_bit.flags & PATH_BIT_FLAG_IS_BENCH)) return false; - if (tile_element->flags & TILE_ELEMENT_FLAG_BROKEN) + if (tileElement->flags & TILE_ELEMENT_FLAG_BROKEN) return false; - if (footpath_element_path_scenery_is_ghost(tile_element)) + if (footpath_element_path_scenery_is_ghost(tileElement)) return false; - sint32 edges = (tile_element->properties.path.edges & 0xF) ^ 0xF; + sint32 edges = (tileElement->properties.path.edges & 0xF) ^ 0xF; if (edges == 0) return false; @@ -6004,24 +6004,24 @@ bool rct_peep::UpdateWalkingFindBin() if (peep->GetNextIsSurface()) return false; - rct_tile_element * tile_element = map_get_first_element_at(peep->next_x / 32, peep->next_y / 32); + rct_tile_element * tileElement = map_get_first_element_at(peep->next_x / 32, peep->next_y / 32); - for (;; tile_element++) + for (;; tileElement++) { - if (tile_element->GetType() == TILE_ELEMENT_TYPE_PATH) + if (tileElement->GetType() == TILE_ELEMENT_TYPE_PATH) { - if (peep->next_z == tile_element->base_height) + if (peep->next_z == tileElement->base_height) break; } - if (tile_element_is_last_for_tile(tile_element)) + if (tileElement->IsLastForTile()) { return false; } } - if (!footpath_element_has_path_scenery(tile_element)) + if (!footpath_element_has_path_scenery(tileElement)) return false; - rct_scenery_entry * sceneryEntry = get_footpath_item_entry(footpath_element_get_path_scenery_index(tile_element)); + rct_scenery_entry * sceneryEntry = get_footpath_item_entry(footpath_element_get_path_scenery_index(tileElement)); if (sceneryEntry == nullptr) { return false; @@ -6030,20 +6030,20 @@ bool rct_peep::UpdateWalkingFindBin() if (!(sceneryEntry->path_bit.flags & PATH_BIT_FLAG_IS_BIN)) return false; - if (tile_element->flags & TILE_ELEMENT_FLAG_BROKEN) + if (tileElement->flags & TILE_ELEMENT_FLAG_BROKEN) return false; - if (footpath_element_path_scenery_is_ghost(tile_element)) + if (footpath_element_path_scenery_is_ghost(tileElement)) return false; - sint32 edges = (tile_element->properties.path.edges & 0xF) ^ 0xF; + sint32 edges = (tileElement->properties.path.edges & 0xF) ^ 0xF; if (edges == 0) return false; uint8 chosen_edge = scenario_rand() & 0x3; // Note: Bin quantity is inverted 0 = full, 3 = empty - uint8 bin_quantities = tile_element->properties.path.addition_status; + uint8 bin_quantities = tileElement->properties.path.addition_status; // Rotate the bin to the correct edge. Makes it easier for next calc. bin_quantities = ror8(ror8(bin_quantities, chosen_edge), chosen_edge); @@ -6105,35 +6105,35 @@ static void peep_update_walking_break_scenery(rct_peep * peep) if (peep->GetNextIsSurface()) return; - rct_tile_element * tile_element = map_get_first_element_at(peep->next_x / 32, peep->next_y / 32); + rct_tile_element * tileElement = map_get_first_element_at(peep->next_x / 32, peep->next_y / 32); - for (;; tile_element++) + for (;; tileElement++) { - if (tile_element->GetType() == TILE_ELEMENT_TYPE_PATH) + if (tileElement->GetType() == TILE_ELEMENT_TYPE_PATH) { - if (peep->next_z == tile_element->base_height) + if (peep->next_z == tileElement->base_height) break; } - if (tile_element_is_last_for_tile(tile_element)) + if (tileElement->IsLastForTile()) { return; } } - if (!footpath_element_has_path_scenery(tile_element)) + if (!footpath_element_has_path_scenery(tileElement)) return; - rct_scenery_entry * sceneryEntry = get_footpath_item_entry(footpath_element_get_path_scenery_index(tile_element)); + rct_scenery_entry * sceneryEntry = get_footpath_item_entry(footpath_element_get_path_scenery_index(tileElement)); if (!(sceneryEntry->path_bit.flags & PATH_BIT_FLAG_BREAKABLE)) return; - if (tile_element->flags & TILE_ELEMENT_FLAG_BROKEN) + if (tileElement->flags & TILE_ELEMENT_FLAG_BROKEN) return; - if (footpath_element_path_scenery_is_ghost(tile_element)) + if (footpath_element_path_scenery_is_ghost(tileElement)) return; - sint32 edges = tile_element->properties.path.edges & 0xF; + sint32 edges = tileElement->properties.path.edges & 0xF; if (edges == 0xF) return; @@ -6171,9 +6171,9 @@ static void peep_update_walking_break_scenery(rct_peep * peep) return; } - tile_element->flags |= TILE_ELEMENT_FLAG_BROKEN; + tileElement->flags |= TILE_ELEMENT_FLAG_BROKEN; - map_invalidate_tile_zoom1(peep->next_x, peep->next_y, (tile_element->base_height << 3) + 32, tile_element->base_height << 3); + map_invalidate_tile_zoom1(peep->next_x, peep->next_y, (tileElement->base_height << 3) + 32, tileElement->base_height << 3); peep->angriness = 16; } @@ -6312,7 +6312,7 @@ static bool peep_find_ride_to_look_at(rct_peep * peep, uint8 edge, uint8 * rideT continue; return false; - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); uint16 x = peep->next_x + CoordsDirectionDelta[edge].x; uint16 y = peep->next_y + CoordsDirectionDelta[edge].y; @@ -6347,7 +6347,7 @@ static bool peep_find_ride_to_look_at(rct_peep * peep, uint8 edge, uint8 * rideT continue; return false; - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); // TODO: Extract loop B tileElement = surfaceElement; @@ -6392,7 +6392,7 @@ static bool peep_find_ride_to_look_at(rct_peep * peep, uint8 edge, uint8 * rideT return true; } - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); // TODO: Extract loop C tileElement = surfaceElement; @@ -6424,7 +6424,7 @@ static bool peep_find_ride_to_look_at(rct_peep * peep, uint8 edge, uint8 * rideT } return false; - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); x += CoordsDirectionDelta[edge].x; y += CoordsDirectionDelta[edge].y; @@ -6459,7 +6459,7 @@ static bool peep_find_ride_to_look_at(rct_peep * peep, uint8 edge, uint8 * rideT continue; return false; - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); // TODO: Extract loop B tileElement = surfaceElement; @@ -6504,7 +6504,7 @@ static bool peep_find_ride_to_look_at(rct_peep * peep, uint8 edge, uint8 * rideT return true; } - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); // TODO: Extract loop C tileElement = surfaceElement; @@ -6536,7 +6536,7 @@ static bool peep_find_ride_to_look_at(rct_peep * peep, uint8 edge, uint8 * rideT } return false; - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); x += CoordsDirectionDelta[edge].x; y += CoordsDirectionDelta[edge].y; @@ -6571,7 +6571,7 @@ static bool peep_find_ride_to_look_at(rct_peep * peep, uint8 edge, uint8 * rideT continue; return false; - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); // TODO: Extract loop B tileElement = surfaceElement; @@ -6615,7 +6615,7 @@ static bool peep_find_ride_to_look_at(rct_peep * peep, uint8 edge, uint8 * rideT return true; } - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); return false; } @@ -6733,7 +6733,7 @@ void rct_peep::UpdateSpriteType() if ((z / 8) < tileElement->base_height) break; - if (tile_element_is_last_for_tile(tileElement)) + if (tileElement->IsLastForTile()) { SetSpriteType(PEEP_SPRITE_TYPE_UMBRELLA); return; diff --git a/src/openrct2/peep/GuestPathfinding.cpp b/src/openrct2/peep/GuestPathfinding.cpp index d7e9a03d5d..59c450c36d 100644 --- a/src/openrct2/peep/GuestPathfinding.cpp +++ b/src/openrct2/peep/GuestPathfinding.cpp @@ -62,7 +62,7 @@ static rct_tile_element * get_banner_on_path(rct_tile_element * path_element) { // This is an improved version of original. // That only checked for one fence in the way. - if (tile_element_is_last_for_tile(path_element)) + if (path_element->IsLastForTile()) return nullptr; rct_tile_element * bannerElement = path_element + 1; @@ -75,7 +75,7 @@ static rct_tile_element * get_banner_on_path(rct_tile_element * path_element) if (bannerElement->GetType() == TILE_ELEMENT_TYPE_BANNER) return bannerElement; // Last element so there cant be any other banners - if (tile_element_is_last_for_tile(bannerElement)) + if (bannerElement->IsLastForTile()) return nullptr; } while (bannerElement++); @@ -258,7 +258,7 @@ static uint8 footpath_element_next_in_direction(TileCoordsXYZ loc, rct_tile_elem return PATH_SEARCH_RIDE_QUEUE; return PATH_SEARCH_OTHER; - } while (!tile_element_is_last_for_tile(nextTileElement++)); + } while (!(nextTileElement++)->IsLastForTile()); return PATH_SEARCH_FAILED; } @@ -371,7 +371,7 @@ static uint8 footpath_element_dest_in_dir(TileCoordsXYZ loc, rct_tile_element * } return PATH_SEARCH_DEAD_END; } - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); return PATH_SEARCH_FAILED; } @@ -1131,7 +1131,7 @@ static void peep_pathfind_heuristic_search(TileCoordsXYZ loc, rct_peep * peep, r #endif // defined(DEBUG_LEVEL_2) && DEBUG_LEVEL_2 } while ((next_test_edge = bitscanforward(edges)) != -1); - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); if (!found) { @@ -1227,7 +1227,7 @@ sint32 peep_pathfind_choose_direction(TileCoordsXYZ loc, rct_peep * peep) // Collect the permitted edges of ALL matching path elements at this location. permitted_edges |= path_get_permitted_edges(dest_tile_element); - } while (!tile_element_is_last_for_tile(dest_tile_element++)); + } while (!(dest_tile_element++)->IsLastForTile()); // Peep is not on a path. if (!found) return -1; @@ -1740,7 +1740,7 @@ static void get_ride_queue_end(TileCoordsXYZ &loc) found = true; break; - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); if (!found) return; @@ -1805,7 +1805,7 @@ static void get_ride_queue_end(TileCoordsXYZ &loc) found = true; break; } - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); if (found == false) break; diff --git a/src/openrct2/peep/Peep.cpp b/src/openrct2/peep/Peep.cpp index bb8e1fc273..15f4968537 100644 --- a/src/openrct2/peep/Peep.cpp +++ b/src/openrct2/peep/Peep.cpp @@ -516,7 +516,7 @@ bool rct_peep::CheckForPath() return true; } } - } while (!tile_element_is_last_for_tile(tile_element++)); + } while (!(tile_element++)->IsLastForTile()); // Found no suitable path SetState(PEEP_STATE_FALLING); @@ -1083,7 +1083,7 @@ void rct_peep::UpdateFalling() } // If not a path or surface go see next element else continue; - } while (!tile_element_is_last_for_tile(tile_element++)); + } while (!(tile_element++)->IsLastForTile()); } // This will be null if peep is falling @@ -2683,7 +2683,7 @@ static void peep_interact_with_entrance(rct_peep * peep, sint16 x, sint16 y, rct found = true; break; } - } while (!tile_element_is_last_for_tile(nextTileElement++)); + } while (!(nextTileElement++)->IsLastForTile()); if (!found) { @@ -3237,7 +3237,7 @@ void rct_peep::PerformNextAction(uint8 & pathing_result, rct_tile_element * & ti tile_result = tileElement; return; } - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); if (type == PEEP_TYPE_STAFF || (GetNextIsSurface())) { diff --git a/src/openrct2/peep/Staff.cpp b/src/openrct2/peep/Staff.cpp index d2f754cbd4..62fc41184e 100644 --- a/src/openrct2/peep/Staff.cpp +++ b/src/openrct2/peep/Staff.cpp @@ -744,7 +744,7 @@ bool staff_can_ignore_wide_flag(rct_peep * staff, sint32 x, sint32 y, uint8 z, r widecount++; } } - } while (!tile_element_is_last_for_tile(test_element++)); + } while (!(test_element++)->IsLastForTile()); } switch (total) @@ -931,7 +931,7 @@ static uint8 staff_handyman_direction_to_nearest_litter(rct_peep * peep) { return 0xFF; } - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); nextTile.x = (peep->x & 0xFFE0) + CoordsDirectionDelta[nextDirection].x; nextTile.y = (peep->y & 0xFFE0) + CoordsDirectionDelta[nextDirection].y; @@ -947,7 +947,7 @@ static uint8 staff_handyman_direction_to_nearest_litter(rct_peep * peep) { return 0xFF; } - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); return nextDirection; } @@ -1749,7 +1749,7 @@ void rct_peep::UpdateWatering() map_invalidate_tile_zoom0(actionX, actionY, tile_element->base_height * 8, tile_element->clearance_height * 8); staff_gardens_watered++; window_invalidate_flags |= PEEP_INVALIDATE_STAFF_STATS; - } while (!tile_element_is_last_for_tile(tile_element++)); + } while (!(tile_element++)->IsLastForTile()); StateReset(); } @@ -1807,7 +1807,7 @@ void rct_peep::UpdateEmptyingBin() if (next_z == tile_element->base_height) break; } - if (tile_element_is_last_for_tile(tile_element)) + if ((tile_element)->IsLastForTile()) { StateReset(); return; @@ -2185,7 +2185,7 @@ static sint32 peep_update_patrolling_find_watering(rct_peep * peep) peep->destination_tolerance = 3; return 1; - } while (!tile_element_is_last_for_tile(tile_element++)); + } while (!(tile_element++)->IsLastForTile()); } return 0; } @@ -2202,35 +2202,35 @@ static sint32 peep_update_patrolling_find_bin(rct_peep * peep) if (peep->GetNextIsSurface()) return 0; - rct_tile_element * tile_element = map_get_first_element_at(peep->next_x / 32, peep->next_y / 32); - if (tile_element == nullptr) + rct_tile_element * tileElement = map_get_first_element_at(peep->next_x / 32, peep->next_y / 32); + if (tileElement == nullptr) return 0; - for (;; tile_element++) + for (;; tileElement++) { - if (tile_element->GetType() == TILE_ELEMENT_TYPE_PATH && (tile_element->base_height == peep->next_z)) + if (tileElement->GetType() == TILE_ELEMENT_TYPE_PATH && (tileElement->base_height == peep->next_z)) break; - if (tile_element_is_last_for_tile(tile_element)) + if (tileElement->IsLastForTile()) return 0; } - if (!footpath_element_has_path_scenery(tile_element)) + if (!footpath_element_has_path_scenery(tileElement)) return 0; - rct_scenery_entry * sceneryEntry = get_footpath_item_entry(footpath_element_get_path_scenery_index(tile_element)); + rct_scenery_entry * sceneryEntry = get_footpath_item_entry(footpath_element_get_path_scenery_index(tileElement)); if (!(sceneryEntry->path_bit.flags & PATH_BIT_FLAG_IS_BIN)) return 0; - if (tile_element->flags & TILE_ELEMENT_FLAG_BROKEN) + if (tileElement->flags & TILE_ELEMENT_FLAG_BROKEN) return 0; - if (footpath_element_path_scenery_is_ghost(tile_element)) + if (footpath_element_path_scenery_is_ghost(tileElement)) return 0; - uint8 bin_positions = tile_element->properties.path.edges & 0xF; - uint8 bin_quantity = tile_element->properties.path.addition_status; + uint8 bin_positions = tileElement->properties.path.edges & 0xF; + uint8 bin_quantity = tileElement->properties.path.addition_status; uint8 chosen_position = 0; for (; chosen_position < 4; ++chosen_position) diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index b3a723f8fb..f30d445682 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -520,7 +520,7 @@ private: } } - if (tile_element_is_last_for_tile(tileElement++)) + if ((tileElement++)->IsLastForTile()) { tileIndex++; } @@ -2379,7 +2379,7 @@ private: rct_tile_element * nextFreeTileElement = gTileElements; for (size_t i = 0; i < RCT1_MAX_MAP_SIZE * RCT1_MAX_MAP_SIZE; i++) { - while (!tile_element_is_last_for_tile(nextFreeTileElement++)); + while (!(nextFreeTileElement++)->IsLastForTile()); } rct_tile_element * tileElement = gTileElements; @@ -2392,7 +2392,7 @@ private: for (sint32 y = 0; y < RCT1_MAX_MAP_SIZE; y++) { *tilePointer++ = tileElement; - while (!tile_element_is_last_for_tile(tileElement++)); + while (!(tileElement++)->IsLastForTile()); } // Fill the rest of the row with blank tiles @@ -2583,7 +2583,7 @@ private: break; } } - while (!tile_element_is_last_for_tile(tileElement++)); + while (!(tileElement++)->IsLastForTile()); } } @@ -2643,7 +2643,7 @@ private: ImportBanner(dst, src); } } - while (!tile_element_is_last_for_tile(tileElement++)); + while (!(tileElement++)->IsLastForTile()); } } } @@ -2832,7 +2832,7 @@ private: ride->num_block_brakes++; } } - while (!tile_element_is_last_for_tile(tileElement++)); + while (!(tileElement++)->IsLastForTile()); } } } diff --git a/src/openrct2/ride/Ride.cpp b/src/openrct2/ride/Ride.cpp index acfab32092..59b0cbdbf9 100644 --- a/src/openrct2/ride/Ride.cpp +++ b/src/openrct2/ride/Ride.cpp @@ -568,7 +568,7 @@ bool track_block_get_next_from_zero(sint16 x, sint16 y, sint16 z_start, uint8 ri output->y = y; output->element = tileElement; return 1; - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); if (direction != nullptr) *direction = direction_start; if (z != nullptr) *z = z_start; @@ -722,7 +722,7 @@ bool track_block_get_previous_from_zero(sint16 x, sint16 y, sint16 z, uint8 ride outTrackBeginEnd->begin_direction = nextRotation; outTrackBeginEnd->end_direction = directionStart ^ (1 << 1); return 1; - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); outTrackBeginEnd->end_x = x; outTrackBeginEnd->end_y = y; @@ -1218,7 +1218,7 @@ sint32 sub_6C683D(sint32* x, sint32* y, sint32* z, sint32 direction, sint32 type successTileElement = tileElement; if (tile_element_get_track_sequence(tileElement) == 0) break; - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); tileElement = successTileElement; if (tileElement == nullptr) @@ -1296,7 +1296,7 @@ sint32 sub_6C683D(sint32* x, sint32* y, sint32* z, sint32 direction, sint32 type break; } } - while (!tile_element_is_last_for_tile(tileElement++)); + while (!(tileElement++)->IsLastForTile()); if (successTileElement == nullptr) { @@ -3258,7 +3258,7 @@ static void ride_shop_connected(Ride* ride, sint32 ride_idx) do { if (tileElement->GetType() == TILE_ELEMENT_TYPE_TRACK && track_element_get_ride_index(tileElement) == ride_idx) break; - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); uint16 entrance_directions = 0; uint8 track_type = track_element_get_type(tileElement); @@ -4112,7 +4112,7 @@ static void sub_6B5952(sint32 rideIndex) sint32 direction = tile_element_get_direction(tileElement); footpath_chain_ride_queue(rideIndex, i, x, y, tileElement, direction ^ 2); - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); } } @@ -4422,7 +4422,7 @@ static void ride_set_maze_entrance_exit_points(Ride *ride) if (tileElement->base_height != z) continue; maze_entrance_hedge_removal(x, y, tileElement); - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); } } @@ -4805,7 +4805,7 @@ static void ride_create_vehicles_find_first_block(Ride *ride, CoordsXYE *outXYEl outXYElement->y = trackBeginEnd.begin_y; outXYElement->element = tileElement; return; - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); } break; case TRACK_ELEM_END_STATION: @@ -4861,7 +4861,7 @@ static bool ride_create_vehicles(Ride *ride, sint32 rideIndex, CoordsXYE *elemen if (tileElement->base_height != z) continue; if (tileElement->GetType() != TILE_ELEMENT_TYPE_TRACK) continue; break; - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); z = tileElement->base_height; direction = tile_element_get_direction(tileElement); @@ -4987,7 +4987,7 @@ static bool ride_initialise_cable_lift_track(Ride *ride, bool isApplying) } success = true; break; - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); if (!success) return false; @@ -5089,7 +5089,7 @@ static bool ride_create_cable_lift(sint32 rideIndex, bool isApplying) if (tileElement->GetType() != TILE_ELEMENT_TYPE_TRACK) continue; if (tileElement->base_height != z) continue; break; - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); sint32 direction = tile_element_get_direction(tileElement); rct_vehicle *head = nullptr; @@ -5214,7 +5214,7 @@ static rct_tile_element *loc_6B4F6B(sint32 rideIndex, sint32 x, sint32 y) if (track_element_get_ride_index(tileElement) == rideIndex) return tileElement; - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); return nullptr; } @@ -6639,7 +6639,7 @@ void ride_get_entrance_or_exit_position_from_screen_position(sint32 screenX, sin return; } } - while (!tile_element_is_last_for_tile(tileElement++)); + while (!(tileElement++)->IsLastForTile()); } direction = (direction + 1) & 3; } @@ -6687,7 +6687,7 @@ void ride_get_entrance_or_exit_position_from_screen_position(sint32 screenX, sin goToNextTile = true; } } - while (!goToNextTile && !tile_element_is_last_for_tile(tileElement++)); + while (!goToNextTile && !(tileElement++)->IsLastForTile()); if (!goToNextTile) break; @@ -7003,7 +7003,7 @@ static sint32 ride_get_track_length(Ride * ride) foundTrack = true; } - while (!foundTrack && !tile_element_is_last_for_tile(tileElement++)); + while (!foundTrack && !(tileElement++)->IsLastForTile()); } if (foundTrack) @@ -7436,7 +7436,7 @@ void sub_6CB945(sint32 rideIndex) trackFound = true; break; - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); if (trackFound == false) { break; @@ -7469,7 +7469,7 @@ void sub_6CB945(sint32 rideIndex) trackFound = true; break; - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); if (!trackFound) { break; @@ -7574,7 +7574,7 @@ void sub_6CB945(sint32 rideIndex) tileElement->properties.entrance.index &= 0x8F; tileElement->properties.entrance.index |= stationId << 4; shouldRemove = false; - } while (!tile_element_is_last_for_tile(trackElement++)); + } while (!(trackElement++)->IsLastForTile()); if (shouldRemove == true) { footpath_queue_chain_reset(); @@ -7585,7 +7585,7 @@ void sub_6CB945(sint32 rideIndex) tile_element_remove(tileElement); tileElement--; } - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); } } @@ -7777,7 +7777,7 @@ rct_tile_element *get_station_platform(sint32 x, sint32 y, sint32 z, sint32 z_to foundTileElement = true; break; - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); } if (!foundTileElement) { return nullptr; @@ -8231,7 +8231,7 @@ void determine_ride_entrance_and_exit_locations() log_verbose("Fixed disconnected exit of ride %d, station %d to x = %d, y = %d and z = %d.", rideIndex, stationIndex, x, y, tileElement->base_height); } } - while (!tile_element_is_last_for_tile(tileElement++)); + while (!(tileElement++)->IsLastForTile()); } } } diff --git a/src/openrct2/ride/RideRatings.cpp b/src/openrct2/ride/RideRatings.cpp index deec2afc63..0a69ad4f96 100644 --- a/src/openrct2/ride/RideRatings.cpp +++ b/src/openrct2/ride/RideRatings.cpp @@ -246,7 +246,7 @@ static void ride_ratings_update_state_2() gRideRatingsCalcData.proximity_track_type = track_element_get_type(tileElement); return; } - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); gRideRatingsCalcData.state = RIDE_RATINGS_STATE_FIND_NEXT_RIDE; } @@ -328,7 +328,7 @@ static void ride_ratings_update_state_5() gRideRatingsCalcData.proximity_track_type = track_element_get_type(trackBeginEnd.begin_element); return; } - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); gRideRatingsCalcData.state = RIDE_RATINGS_STATE_FIND_NEXT_RIDE; } @@ -426,7 +426,7 @@ static void ride_ratings_score_close_proximity_in_direction(rct_tile_element *in } break; } - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); } @@ -462,7 +462,7 @@ static void ride_ratings_score_close_proximity_loops_helper(rct_tile_element *in } } break; } - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); } /** @@ -615,7 +615,7 @@ static void ride_ratings_score_close_proximity(rct_tile_element *inputTileElemen } } break; } // switch tileElement->GetType - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); uint8 direction = tile_element_get_direction(inputTileElement); ride_ratings_score_close_proximity_in_direction(inputTileElement, (direction + 1) & 3); @@ -1310,7 +1310,7 @@ static sint32 ride_ratings_get_scenery_score(Ride *ride) sint32 type = tileElement->GetType(); if (type == TILE_ELEMENT_TYPE_SMALL_SCENERY || type == TILE_ELEMENT_TYPE_LARGE_SCENERY) numSceneryItems++; - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); } } diff --git a/src/openrct2/ride/Station.cpp b/src/openrct2/ride/Station.cpp index b6759c4d0a..033f0545a6 100644 --- a/src/openrct2/ride/Station.cpp +++ b/src/openrct2/ride/Station.cpp @@ -325,7 +325,7 @@ rct_tile_element * ride_get_station_start_track_element(Ride * ride, sint32 stat return tileElement; } - while (!tile_element_is_last_for_tile(tileElement++)); + while (!(tileElement++)->IsLastForTile()); return nullptr; } @@ -339,7 +339,7 @@ rct_tile_element * ride_get_station_exit_element(sint32 x, sint32 y, sint32 z) if (tileElement->GetType() == TILE_ELEMENT_TYPE_ENTRANCE && z == tileElement->base_height) return tileElement; } - while (!tile_element_is_last_for_tile(tileElement++)); + while (!(tileElement++)->IsLastForTile()); return nullptr; } diff --git a/src/openrct2/ride/Track.cpp b/src/openrct2/ride/Track.cpp index c31807439a..7191b3e832 100644 --- a/src/openrct2/ride/Track.cpp +++ b/src/openrct2/ride/Track.cpp @@ -625,7 +625,7 @@ static rct_tile_element * find_station_element(sint32 x, sint32 y, sint32 z, sin return tileElement; } - while (!tile_element_is_last_for_tile(tileElement++)); + while (!(tileElement++)->IsLastForTile()); return nullptr; } @@ -1684,7 +1684,7 @@ static money32 track_remove(uint8 type, found = 1; break; } - while (!tile_element_is_last_for_tile(tileElement++)); + while (!(tileElement++)->IsLastForTile()); if (!found) { @@ -1786,7 +1786,7 @@ static money32 track_remove(uint8 type, found = 1; break; } - while (!tile_element_is_last_for_tile(tileElement++)); + while (!(tileElement++)->IsLastForTile()); if (!found) { @@ -1994,7 +1994,7 @@ void game_command_set_brakes_speed( break; } - while (!tile_element_is_last_for_tile(tileElement++)); + while (!(tileElement++)->IsLastForTile()); *ebx = 0; } diff --git a/src/openrct2/ride/TrackDesign.cpp b/src/openrct2/ride/TrackDesign.cpp index 97434bb820..ed3545dce3 100644 --- a/src/openrct2/ride/TrackDesign.cpp +++ b/src/openrct2/ride/TrackDesign.cpp @@ -1641,7 +1641,7 @@ static bool track_design_place_ride(rct_track_td6 * td6, sint16 x, sint16 y, sin _trackDesignPlaceStateEntranceExitPlaced = true; break; } - while (!tile_element_is_last_for_tile(tile_element++)); + while (!(tile_element++)->IsLastForTile()); } else { diff --git a/src/openrct2/ride/TrackDesignSave.cpp b/src/openrct2/ride/TrackDesignSave.cpp index 9a2ca6b294..83fdc044a8 100644 --- a/src/openrct2/ride/TrackDesignSave.cpp +++ b/src/openrct2/ride/TrackDesignSave.cpp @@ -111,7 +111,7 @@ void track_design_save_select_nearby_scenery(sint32 rideIndex) track_design_save_select_nearby_scenery_for_tile(rideIndex, x, y); break; } - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); } } gfx_invalidate_screen(); @@ -611,7 +611,7 @@ static void track_design_save_select_nearby_scenery_for_tile(sint32 rideIndex, s track_design_save_add_tile_element(interactionType, x * 32, y * 32, tileElement); } } - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); } } } @@ -801,7 +801,7 @@ static bool track_design_save_to_td6_for_maze(uint8 rideIndex, rct_track_td6 *td mapFound = true; break; } - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); if (mapFound) { break; } @@ -843,7 +843,7 @@ static bool track_design_save_to_td6_for_maze(uint8 rideIndex, rct_track_td6 *td SafeFree(td6->maze_elements); return false; } - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); } x = 0; @@ -866,7 +866,7 @@ static bool track_design_save_to_td6_for_maze(uint8 rideIndex, rct_track_td6 *td if (tileElement->GetType() != TILE_ELEMENT_TYPE_ENTRANCE) continue; if (tileElement->properties.entrance.type != ENTRANCE_TYPE_RIDE_ENTRANCE) continue; if (tileElement->properties.entrance.ride_index == rideIndex) break; - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); // Add something that stops this from walking off the end uint8 entrance_direction = tile_element_get_direction(tileElement); @@ -892,7 +892,7 @@ static bool track_design_save_to_td6_for_maze(uint8 rideIndex, rct_track_td6 *td if (tileElement->GetType() != TILE_ELEMENT_TYPE_ENTRANCE) continue; if (tileElement->properties.entrance.type != ENTRANCE_TYPE_RIDE_EXIT) continue; if (tileElement->properties.entrance.ride_index == rideIndex) break; - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); // Add something that stops this from walking off the end uint8 exit_direction = tile_element_get_direction(tileElement); @@ -1049,7 +1049,7 @@ static bool track_design_save_to_td6_for_tracked_ride(uint8 rideIndex, rct_track do { if (tile_element->GetType() != TILE_ELEMENT_TYPE_ENTRANCE) continue; if (tile_element->base_height == z) break; - } while (!tile_element_is_last_for_tile(tile_element++)); + } while (!(tile_element++)->IsLastForTile()); // Add something that stops this from walking off the end uint8 entrance_direction = tile_element_get_direction(tile_element); diff --git a/src/openrct2/ride/Vehicle.cpp b/src/openrct2/ride/Vehicle.cpp index 95c48bed6e..7b12658d08 100644 --- a/src/openrct2/ride/Vehicle.cpp +++ b/src/openrct2/ride/Vehicle.cpp @@ -1867,7 +1867,7 @@ static void vehicle_update_measurements(rct_vehicle * vehicle) break; } // Iterate through each tile_element. - } while (!tile_element_is_last_for_tile(tile_element++)); + } while (!(tile_element++)->IsLastForTile()); if (cover_found == false) { @@ -4699,7 +4699,7 @@ static bool vehicle_boat_is_location_accessible(const TileCoordsXYZ &location) return false; } } - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); return true; } @@ -5211,7 +5211,7 @@ static rct_tile_element * vehicle_check_collision(sint16 x, sint16 y, sint16 z) if (tileElement->flags & bl) return tileElement; - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); return nullptr; } diff --git a/src/openrct2/ride/gentle/ObservationTower.cpp b/src/openrct2/ride/gentle/ObservationTower.cpp index 5339e2882d..a2cf84ce87 100644 --- a/src/openrct2/ride/gentle/ObservationTower.cpp +++ b/src/openrct2/ride/gentle/ObservationTower.cpp @@ -176,7 +176,7 @@ static void paint_observation_tower_section( sub_98197C(session, imageId, 0, 0, 2, 2, 30, height, 8, 8, height); const rct_tile_element * nextTileElement = tileElement + 1; - if (tile_element_is_last_for_tile(tileElement) || tileElement->clearance_height != nextTileElement->base_height) + if (tileElement->IsLastForTile() || tileElement->clearance_height != nextTileElement->base_height) { imageId = SPR_OBSERVATION_TOWER_SEGMENT_TOP | session->TrackColours[SCHEME_TRACK]; sub_98199C(session, imageId, 0, 0, 2, 2, 30, height, 8, 8, height); diff --git a/src/openrct2/ride/thrill/LaunchedFreefall.cpp b/src/openrct2/ride/thrill/LaunchedFreefall.cpp index bb9f0e2295..cb62c51690 100644 --- a/src/openrct2/ride/thrill/LaunchedFreefall.cpp +++ b/src/openrct2/ride/thrill/LaunchedFreefall.cpp @@ -185,7 +185,7 @@ static void paint_launched_freefall_tower_section( sub_98197C(session, imageId, 0, 0, 2, 2, 30, height, 8, 8, height); const rct_tile_element * nextTileElement = tileElement + 1; - if (tile_element_is_last_for_tile(tileElement) || tileElement->clearance_height != nextTileElement->base_height) + if (tileElement->IsLastForTile() || tileElement->clearance_height != nextTileElement->base_height) { imageId = SPR_LAUNCHED_FREEFALL_TOWER_SEGMENT_TOP | session->TrackColours[SCHEME_TRACK]; sub_98199C(session, imageId, 0, 0, 2, 2, 30, height, 8, 8, height); diff --git a/src/openrct2/ride/thrill/RotoDrop.cpp b/src/openrct2/ride/thrill/RotoDrop.cpp index feb6391977..e2848bf91e 100644 --- a/src/openrct2/ride/thrill/RotoDrop.cpp +++ b/src/openrct2/ride/thrill/RotoDrop.cpp @@ -192,7 +192,7 @@ static void paint_roto_drop_tower_section( sub_98197C(session, imageId, 0, 0, 2, 2, 30, height, 8, 8, height); const rct_tile_element * nextTileElement = tileElement + 1; - if (tile_element_is_last_for_tile(tileElement) || tileElement->clearance_height != nextTileElement->base_height) + if (tileElement->IsLastForTile() || tileElement->clearance_height != nextTileElement->base_height) { imageId = SPR_ROTO_DROP_TOWER_SEGMENT_TOP | session->TrackColours[SCHEME_TRACK]; sub_98199C(session, imageId, 0, 0, 2, 2, 30, height, 8, 8, height); diff --git a/src/openrct2/ride/transport/Chairlift.cpp b/src/openrct2/ride/transport/Chairlift.cpp index 29d8d13ce9..6be5229214 100644 --- a/src/openrct2/ride/transport/Chairlift.cpp +++ b/src/openrct2/ride/transport/Chairlift.cpp @@ -133,7 +133,7 @@ chairlift_paint_util_map_get_track_element_at_from_ride_fuzzy(sint32 x, sint32 y continue; return tileElement; - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); return nullptr; }; diff --git a/src/openrct2/scenario/Scenario.cpp b/src/openrct2/scenario/Scenario.cpp index 1e5e56fced..d656fcb6ae 100644 --- a/src/openrct2/scenario/Scenario.cpp +++ b/src/openrct2/scenario/Scenario.cpp @@ -706,7 +706,7 @@ void scenario_fix_ghosts(rct_s6_data *s6) } else { *destinationElement++ = *originalElement; } - } while (!tile_element_is_last_for_tile(originalElement++)); + } while (!(originalElement++)->IsLastForTile()); // Set last element flag in case the original last element was never added (destinationElement - 1)->flags |= TILE_ELEMENT_FLAG_LAST_TILE; diff --git a/src/openrct2/world/Banner.cpp b/src/openrct2/world/Banner.cpp index a4e70698f2..72279c79d2 100644 --- a/src/openrct2/world/Banner.cpp +++ b/src/openrct2/world/Banner.cpp @@ -66,7 +66,7 @@ static sint32 banner_get_ride_index_at(sint32 x, sint32 y, sint32 z) continue; resultRideIndex = rideIndex; - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); return resultRideIndex; } @@ -158,7 +158,7 @@ static money32 BannerSetColour(sint16 x, sint16 y, uint8 baseHeight, uint8 direc found = true; break; - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); if (!found) { @@ -214,7 +214,7 @@ static money32 BannerPlace(sint16 x, sint16 y, uint8 pathBaseHeight, uint8 direc pathFound = true; break; - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); if (!pathFound) { @@ -415,7 +415,7 @@ rct_tile_element *banner_get_tile_element(sint32 bannerIndex) { return tileElement; } - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); return nullptr; } @@ -543,7 +543,7 @@ void fix_duplicated_banners() // Mark banner index as in-use activeBanners[bannerIndex] = true; } - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); } } } diff --git a/src/openrct2/world/Entrance.cpp b/src/openrct2/world/Entrance.cpp index 1b5c4c1b01..4038065ece 100644 --- a/src/openrct2/world/Entrance.cpp +++ b/src/openrct2/world/Entrance.cpp @@ -403,7 +403,7 @@ static money32 RideEntranceExitRemove(sint16 x, sint16 y, uint8 rideIndex, uint8 found = true; break; } - while (!tile_element_is_last_for_tile(tileElement++)); + while (!(tileElement++)->IsLastForTile()); if (!found) { @@ -654,7 +654,7 @@ void maze_entrance_hedge_replacement(sint32 x, sint32 y, rct_tile_element *tileE map_invalidate_tile(x, y, tileElement->base_height * 8, tileElement->clearance_height * 8); return; - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); } /** @@ -691,7 +691,7 @@ void maze_entrance_hedge_removal(sint32 x, sint32 y, rct_tile_element *tileEleme map_invalidate_tile(x, y, tileElement->base_height * 8, tileElement->clearance_height * 8); return; - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); } void fix_park_entrance_locations(void) diff --git a/src/openrct2/world/Footpath.cpp b/src/openrct2/world/Footpath.cpp index 805ff31389..95e423ccad 100644 --- a/src/openrct2/world/Footpath.cpp +++ b/src/openrct2/world/Footpath.cpp @@ -160,7 +160,7 @@ rct_tile_element *map_get_footpath_element(sint32 x, sint32 y, sint32 z) do { if (tileElement->GetType() == TILE_ELEMENT_TYPE_PATH && tileElement->base_height == z) return tileElement; - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); return nullptr; } @@ -178,7 +178,7 @@ static rct_tile_element *map_get_footpath_element_slope(sint32 x, sint32 y, sint ) { return tileElement; } - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); return nullptr; } @@ -489,7 +489,7 @@ static money32 footpath_place_real(sint32 type, sint32 x, sint32 y, sint32 z, si * rct2: 0x006BA23E */ static void remove_banners_at_element(sint32 x, sint32 y, rct_tile_element* tileElement){ - while (!tile_element_is_last_for_tile(tileElement++)){ + while (!(tileElement++)->IsLastForTile()){ if (tileElement->GetType() == TILE_ELEMENT_TYPE_PATH)return; else if (tileElement->GetType() != TILE_ELEMENT_TYPE_BANNER)continue; @@ -534,7 +534,7 @@ money32 footpath_remove_real(sint32 x, sint32 y, sint32 z, sint32 flags) // If the ghost flag is present we have to make sure to only delete ghost footpaths as they may be // at the same origin. if ((flags & GAME_COMMAND_FLAG_GHOST) && tile_element_is_ghost(tileElement) == false) { - while (!tile_element_is_last_for_tile(tileElement++)) { + while (!(tileElement++)->IsLastForTile()) { if (tileElement->type != TILE_ELEMENT_TYPE_PATH && !tile_element_is_ghost(tileElement)) { continue; } @@ -1053,7 +1053,7 @@ bool fence_in_the_way(sint32 x, sint32 y, sint32 z0, sint32 z1, sint32 direction continue; return true; - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); return false; } @@ -1081,7 +1081,7 @@ static rct_tile_element *footpath_connect_corners_get_neighbour(sint32 x, sint32 continue; return tileElement; - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); return nullptr; } @@ -1249,7 +1249,7 @@ static rct_tile_element *footpath_get_element(sint32 x, sint32 y, sint32 z0, sin return tileElement; } - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); return nullptr; } @@ -1374,7 +1374,7 @@ static void loc_6A6D7E( } break; } - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); return; loc_6A6F1F: @@ -1562,7 +1562,7 @@ void footpath_chain_ride_queue(sint32 rideIndex, sint32 entranceIndex, sint32 x, z -= 2; goto foundNextPath; } - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); break; foundNextPath: @@ -1670,7 +1670,7 @@ void footpath_update_queue_chains() uint8 direction = tile_element_get_direction_with_offset(tileElement, 2); footpath_chain_ride_queue(rideIndex, i, location.x << 5, location.y << 5, tileElement, direction); - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); } } } @@ -1775,21 +1775,21 @@ static sint32 footpath_is_connected_to_map_edge_recurse( if (!(flags & (1 << 7))) { if (tileElement[1].type == TILE_ELEMENT_TYPE_BANNER) { for (sint32 i = 1; i < 4; i++) { - if (tile_element_is_last_for_tile(&tileElement[i - 1])) break; + if ((&tileElement[i - 1])->IsLastForTile()) break; if (tileElement[i].type != TILE_ELEMENT_TYPE_BANNER) break; edges &= tileElement[i].properties.banner.flags; } } if (tileElement[2].type == TILE_ELEMENT_TYPE_BANNER && tileElement[1].type != TILE_ELEMENT_TYPE_PATH) { for (sint32 i = 1; i < 6; i++) { - if (tile_element_is_last_for_tile(&tileElement[i - 1])) break; + if ((&tileElement[i - 1])->IsLastForTile()) break; if (tileElement[i].type != TILE_ELEMENT_TYPE_BANNER) break; edges &= tileElement[i].properties.banner.flags; } } } goto searchFromFootpath; - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); return level == 1 ? FOOTPATH_SEARCH_NOT_FOUND : FOOTPATH_SEARCH_INCOMPLETE; searchFromFootpath: @@ -1964,7 +1964,7 @@ static void footpath_clear_wide(sint32 x, sint32 y) continue; footpath_element_set_wide(tileElement, false); } - while (!tile_element_is_last_for_tile(tileElement++)); + while (!(tileElement++)->IsLastForTile()); } /** @@ -1986,7 +1986,7 @@ static rct_tile_element* footpath_can_be_wide(sint32 x, sint32 y, uint8 height) if (footpath_element_is_sloped(tileElement)) continue; return tileElement; - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); return nullptr; } @@ -2179,7 +2179,7 @@ void footpath_update_path_wide_flags(sint32 x, sint32 y) if ((e != 0b10101111) && (e != 0b01011111) && (e != 0b11101111)) footpath_element_set_wide(tileElement, true); } - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); } /** @@ -2250,7 +2250,7 @@ static void footpath_remove_edges_towards_here(sint32 x, sint32 y, sint32 z, sin tileElement->properties.path.edges &= ~(1 << d); map_invalidate_tile(x, y, tileElement->base_height * 8, tileElement->clearance_height * 8); break; - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); } /** @@ -2287,7 +2287,7 @@ static void footpath_remove_edges_towards(sint32 x, sint32 y, sint32 z0, sint32 footpath_remove_edges_towards_here(x, y, z1, direction, tileElement, isQueue); break; } - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); } // Returns true when there is an element at the given coordinates that want to connect to a path with the given direction (ride @@ -2354,7 +2354,7 @@ bool tile_element_wants_path_connection_towards(TileCoordsXYZD coords, const rct default: break; } - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); return false; } @@ -2394,7 +2394,7 @@ static void footpath_fix_corners_around(sint32 x, sint32 y, rct_tile_element * p const sint32 ix = xOffset + 1; const sint32 iy = yOffset + 1; tileElement->properties.path.edges &= ~(cornersTouchingTile[iy][ix] << 4); - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); } } } diff --git a/src/openrct2/world/Fountain.cpp b/src/openrct2/world/Fountain.cpp index 7dfa32c54b..ea7e89de12 100644 --- a/src/openrct2/world/Fountain.cpp +++ b/src/openrct2/world/Fountain.cpp @@ -316,7 +316,7 @@ static bool is_jumping_fountain(sint32 type, sint32 x, sint32 y, sint32 z) return true; } } - while (!tile_element_is_last_for_tile(tileElement++)); + while (!(tileElement++)->IsLastForTile()); return false; } diff --git a/src/openrct2/world/Map.cpp b/src/openrct2/world/Map.cpp index b3bf31cc44..9c4b1340d4 100644 --- a/src/openrct2/world/Map.cpp +++ b/src/openrct2/world/Map.cpp @@ -202,7 +202,7 @@ sint32 tile_element_iterator_next(tile_element_iterator *it) return 1; } - if (!tile_element_is_last_for_tile(it->element)) { + if (!it->element->IsLastForTile()) { it->element++; return 1; } @@ -250,7 +250,7 @@ rct_tile_element *map_get_nth_element_at(sint32 x, sint32 y, sint32 n) if (n == 0) { return tileElement; } - if (tile_element_is_last_for_tile(tileElement)) { + if (tileElement->IsLastForTile()) { break; } tileElement++; @@ -278,7 +278,7 @@ rct_tile_element * map_get_surface_element_at(sint32 x, sint32 y) // Find the first surface element while (tileElement->GetType() != TILE_ELEMENT_TYPE_SURFACE) { - if (tile_element_is_last_for_tile(tileElement)) + if (tileElement->IsLastForTile()) return nullptr; tileElement++; @@ -308,7 +308,7 @@ rct_tile_element* map_get_path_element_at(sint32 x, sint32 y, sint32 z){ continue; return tileElement; - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); return nullptr; } @@ -329,7 +329,7 @@ rct_tile_element* map_get_banner_element_at(sint32 x, sint32 y, sint32 z, uint8 continue; return tileElement; - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); return nullptr; } @@ -448,7 +448,7 @@ void map_update_tile_pointers() for (y = 0; y < MAXIMUM_MAP_SIZE_TECHNICAL; y++) { for (x = 0; x < MAXIMUM_MAP_SIZE_TECHNICAL; x++) { *tile++ = tileElement; - while (!tile_element_is_last_for_tile(tileElement++)); + while (!(tileElement++)->IsLastForTile()); } } @@ -648,7 +648,7 @@ void sub_68B089() tileElementFirst->base_height = 255; tileElementFirst++; - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); tileElement = gNextFreeTileElement; do { @@ -685,7 +685,7 @@ bool map_coord_is_connected(sint32 x, sint32 y, sint32 z, uint8 faceDirection) if (z == tileElement->base_height) return true; } - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); return false; } @@ -851,33 +851,33 @@ void game_command_remove_large_scenery( } bool element_found = false; - rct_tile_element* tile_element = map_get_first_element_at(x / 32, y / 32); - if (tile_element == nullptr) + rct_tile_element* tileElement = map_get_first_element_at(x / 32, y / 32); + if (tileElement == nullptr) { log_warning("Invalid game command for scenery removal, x = %d, y = %d", x, y); *ebx = MONEY32_UNDEFINED; return; } do { - if (tile_element->GetType() != TILE_ELEMENT_TYPE_LARGE_SCENERY) + if (tileElement->GetType() != TILE_ELEMENT_TYPE_LARGE_SCENERY) continue; - if (tile_element->base_height != base_height) + if (tileElement->base_height != base_height) continue; - if (scenery_large_get_sequence(tile_element) != tileIndex) + if (scenery_large_get_sequence(tileElement) != tileIndex) continue; - if ((tile_element_get_direction(tile_element)) != tile_element_direction) + if ((tile_element_get_direction(tileElement)) != tile_element_direction) continue; // If we are removing ghost elements - if((flags & GAME_COMMAND_FLAG_GHOST) && !(tile_element->flags & TILE_ELEMENT_FLAG_GHOST)) + if((flags & GAME_COMMAND_FLAG_GHOST) && !(tileElement->flags & TILE_ELEMENT_FLAG_GHOST)) continue; element_found = true; break; - } while (!tile_element_is_last_for_tile(tile_element++)); + } while (!(tileElement++)->IsLastForTile()); if (element_found == false){ *ebx = 0; @@ -885,10 +885,10 @@ void game_command_remove_large_scenery( } if (flags & GAME_COMMAND_FLAG_APPLY) { - tile_element_remove_banner_entry(tile_element); + tile_element_remove_banner_entry(tileElement); } - rct_scenery_entry* scenery_entry = get_large_scenery_entry(scenery_large_get_type(tile_element)); + rct_scenery_entry* scenery_entry = get_large_scenery_entry(scenery_large_get_type(tileElement)); LocationXYZ16 firstTile = { scenery_entry->large_scenery.tiles[tileIndex].x_offset, scenery_entry->large_scenery.tiles[tileIndex].y_offset, @@ -925,9 +925,9 @@ void game_command_remove_large_scenery( // If not applying then no need to delete the actual element if (!(flags & GAME_COMMAND_FLAG_APPLY)) { if (flags & (1 << 7)) { - if (tile_element->flags & (1 << 6)) + if (tileElement->flags & (1 << 6)) calculate_cost = false; - tile_element->flags |= (1 << 6); + tileElement->flags |= (1 << 6); } continue; } @@ -956,7 +956,7 @@ void game_command_remove_large_scenery( tile_element_remove(sceneryElement); element_found = true; break; - } while (!tile_element_is_last_for_tile(sceneryElement++)); + } while (!(sceneryElement++)->IsLastForTile()); if (element_found == false){ log_error("Tile not found when trying to remove element!"); @@ -1156,7 +1156,7 @@ restart_from_beginning: } break; } - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); return totalCost; } @@ -1175,7 +1175,7 @@ static void map_reset_clear_large_scenery_flag(){ if (tileElement->GetType() == TILE_ELEMENT_TYPE_LARGE_SCENERY) { tileElement->flags &= ~(1 << 6); } - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); } } } @@ -1568,7 +1568,7 @@ static money32 map_set_land_height(sint32 flags, sint32 x, sint32 y, sint32 heig cost += MONEY(sceneryEntry->small_scenery.removal_price, 0); if (flags & GAME_COMMAND_FLAG_APPLY) tile_element_remove(tileElement--); - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); } // Check for ride support limits @@ -1601,7 +1601,7 @@ static money32 map_set_land_height(sint32 flags, sint32 x, sint32 y, sint32 heig } } } - while(!tile_element_is_last_for_tile(tileElement++)); + while(!(tileElement++)->IsLastForTile()); } uint8 zCorner = height; //z position of highest corner of tile @@ -1671,7 +1671,7 @@ static money32 map_set_land_height(sint32 flags, sint32 x, sint32 y, sint32 heig map_obstruction_set_error_text(tileElement); return MONEY32_UNDEFINED; } - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); } for (sint32 i = 0; i < 4; i += 1) { @@ -3011,10 +3011,10 @@ void tile_element_remove(rct_tile_element *tileElement) // Replace Nth element by (N+1)th element. // This loop will make tileElement point to the old last element position, // after copy it to it's new position - if (!tile_element_is_last_for_tile(tileElement)){ + if (!tileElement->IsLastForTile()){ do{ *tileElement = *(tileElement + 1); - } while (!tile_element_is_last_for_tile(++tileElement)); + } while (!(++tileElement)->IsLastForTile()); } // Mark the latest element with the last element flag. @@ -3159,7 +3159,7 @@ void map_reorganise_elements() for (sint32 x = 0; x < MAXIMUM_MAP_SIZE_TECHNICAL; x++) { rct_tile_element *startElement = map_get_first_element_at(x, y); rct_tile_element *endElement = startElement; - while (!tile_element_is_last_for_tile(endElement++)); + while (!(endElement++)->IsLastForTile()); num_elements = (uint32)(endElement - startElement); memcpy(new_elements_pointer, startElement, num_elements * sizeof(rct_tile_element)); @@ -3340,18 +3340,18 @@ sint32 map_can_construct_with_clear_at(sint32 x, sint32 y, sint32 zLow, sint32 z gGameCommandErrorText = STR_OFF_EDGE_OF_MAP; return false; } - rct_tile_element* tile_element = map_get_first_element_at(x / 32, y / 32); + rct_tile_element* tileElement = map_get_first_element_at(x / 32, y / 32); do { - if (tile_element->GetType() != TILE_ELEMENT_TYPE_SURFACE) { - if (zLow < tile_element->clearance_height && zHigh > tile_element->base_height && !(tile_element->flags & TILE_ELEMENT_FLAG_GHOST)) { - if (tile_element->flags & (bl & 0x0F)) { + if (tileElement->GetType() != TILE_ELEMENT_TYPE_SURFACE) { + if (zLow < tileElement->clearance_height && zHigh > tileElement->base_height && !(tileElement->flags & TILE_ELEMENT_FLAG_GHOST)) { + if (tileElement->flags & (bl & 0x0F)) { goto loc_68BABC; } } continue; } - water_height = surface_get_water_height(tile_element) * 2; - if (water_height && water_height > zLow && tile_element->base_height < zHigh && !gCheatsDisableClearanceChecks) { + water_height = surface_get_water_height(tileElement) * 2; + if (water_height && water_height > zLow && tileElement->base_height < zHigh && !gCheatsDisableClearanceChecks) { gMapGroundFlags |= ELEMENT_IS_UNDERWATER; if (water_height < zHigh) { goto loc_68BAE6; @@ -3359,7 +3359,7 @@ sint32 map_can_construct_with_clear_at(sint32 x, sint32 y, sint32 zLow, sint32 z } loc_68B9B7: if (gParkFlags & PARK_FLAGS_FORBID_HIGH_CONSTRUCTION) { - al = zHigh - tile_element->base_height; + al = zHigh - tileElement->base_height; if (al >= 0) { if (al > 18) { gGameCommandErrorText = STR_LOCAL_AUTHORITY_WONT_ALLOW_CONSTRUCTION_ABOVE_TREE_HEIGHT; @@ -3369,24 +3369,24 @@ sint32 map_can_construct_with_clear_at(sint32 x, sint32 y, sint32 zLow, sint32 z } // Only allow building crossings directly on a flat surface tile. - if (tile_element->GetType() == TILE_ELEMENT_TYPE_SURFACE && - (tile_element->properties.surface.slope & TILE_ELEMENT_SURFACE_SLOPE_MASK) == TILE_ELEMENT_SLOPE_FLAT && - tile_element->base_height == zLow) + if (tileElement->GetType() == TILE_ELEMENT_TYPE_SURFACE && + (tileElement->properties.surface.slope & TILE_ELEMENT_SURFACE_SLOPE_MASK) == TILE_ELEMENT_SLOPE_FLAT && + tileElement->base_height == zLow) { canBuildCrossing = true; } if ((bl & 0xF0) != 0xF0) { - if (tile_element->base_height >= zHigh) { + if (tileElement->base_height >= zHigh) { // loc_68BA81 gMapGroundFlags |= ELEMENT_IS_UNDERGROUND; gMapGroundFlags &= ~ELEMENT_IS_ABOVE_GROUND; } else { - al = tile_element->base_height; + al = tileElement->base_height; ah = al; cl = al; ch = al; - slope = tile_element->properties.surface.slope & TILE_ELEMENT_SURFACE_SLOPE_MASK; + slope = tileElement->properties.surface.slope & TILE_ELEMENT_SURFACE_SLOPE_MASK; if (slope & TILE_ELEMENT_SLOPE_N_CORNER_UP) { al += 2; if (slope == (TILE_ELEMENT_SLOPE_S_CORNER_DN | TILE_ELEMENT_SLOPE_DOUBLE_HEIGHT)) @@ -3416,7 +3416,7 @@ sint32 map_can_construct_with_clear_at(sint32 x, sint32 y, sint32 zLow, sint32 z } loc_68BABC: if (clearFunc != nullptr) { - if (!clearFunc(&tile_element, x, y, flags, price)) { + if (!clearFunc(&tileElement, x, y, flags, price)) { continue; } } @@ -3424,21 +3424,21 @@ sint32 map_can_construct_with_clear_at(sint32 x, sint32 y, sint32 zLow, sint32 z // Crossing mode 1: building track over path if (crossingMode == 1 && canBuildCrossing && - tile_element->GetType() == TILE_ELEMENT_TYPE_PATH && - tile_element->base_height == zLow && - !footpath_element_is_queue(tile_element) && - !footpath_element_is_sloped(tile_element)) + tileElement->GetType() == TILE_ELEMENT_TYPE_PATH && + tileElement->base_height == zLow && + !footpath_element_is_queue(tileElement) && + !footpath_element_is_sloped(tileElement)) { continue; } // Crossing mode 2: building path over track else if (crossingMode == 2 && canBuildCrossing && - tile_element->GetType() == TILE_ELEMENT_TYPE_TRACK && - tile_element->base_height == zLow && - track_element_get_type(tile_element) == TRACK_ELEM_FLAT) + tileElement->GetType() == TILE_ELEMENT_TYPE_TRACK && + tileElement->base_height == zLow && + track_element_get_type(tileElement) == TRACK_ELEM_FLAT) { - Ride * ride = get_ride(track_element_get_ride_index(tile_element)); + Ride * ride = get_ride(track_element_get_ride_index(tileElement)); if (ride->type == RIDE_TYPE_MINIATURE_RAILWAY) { continue; @@ -3446,25 +3446,25 @@ sint32 map_can_construct_with_clear_at(sint32 x, sint32 y, sint32 zLow, sint32 z } - if (tile_element != nullptr) + if (tileElement != nullptr) { - map_obstruction_set_error_text(tile_element); + map_obstruction_set_error_text(tileElement); } return false; loc_68BAE6: if (clearFunc != nullptr) { - if (!clearFunc(&tile_element, x, y, flags, price)) { + if (!clearFunc(&tileElement, x, y, flags, price)) { goto loc_68B9B7; } } - if (tile_element != nullptr) { + if (tileElement != nullptr) { gGameCommandErrorText = STR_CANNOT_BUILD_PARTLY_ABOVE_AND_PARTLY_BELOW_WATER; } return false; } } - } while (!tile_element_is_last_for_tile(tile_element++)); + } while (!(tileElement++)->IsLastForTile()); return true; } @@ -3815,7 +3815,7 @@ static void clear_elements_at(sint32 x, sint32 y) rct_tile_element *tileElement = map_get_first_element_at(x >> 5, y >> 5); // Remove all elements except the last one - while(!tile_element_is_last_for_tile(tileElement)) + while(!tileElement->IsLastForTile()) clear_element_at(x, y, &tileElement); // Remove the last element @@ -3861,7 +3861,7 @@ rct_tile_element *map_get_large_scenery_segment(sint32 x, sint32 y, sint32 z, si continue; return tileElement; - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); return nullptr; } @@ -3886,7 +3886,7 @@ rct_tile_element * map_get_park_entrance_element_at(sint32 x, sint32 y, sint32 z return tileElement; } - while (!tile_element_is_last_for_tile(tileElement++)); + while (!(tileElement++)->IsLastForTile()); } return nullptr; } @@ -3912,7 +3912,7 @@ rct_tile_element * map_get_ride_entrance_element_at(sint32 x, sint32 y, sint32 z return tileElement; } - while (!tile_element_is_last_for_tile(tileElement++)); + while (!(tileElement++)->IsLastForTile()); } return nullptr; } @@ -3938,7 +3938,7 @@ rct_tile_element * map_get_ride_exit_element_at(sint32 x, sint32 y, sint32 z, bo return tileElement; } - while (!tile_element_is_last_for_tile(tileElement++)); + while (!(tileElement++)->IsLastForTile()); } return nullptr; } @@ -3961,7 +3961,7 @@ rct_tile_element *map_get_small_scenery_element_at(sint32 x, sint32 y, sint32 z, return tileElement; } - while (!tile_element_is_last_for_tile(tileElement++)); + while (!(tileElement++)->IsLastForTile()); } return nullptr; } @@ -4224,7 +4224,7 @@ bool map_surface_is_blocked(sint16 x, sint16 y){ if (tileElement->properties.surface.slope & TILE_ELEMENT_SLOPE_DOUBLE_HEIGHT) clear_z += 2; - while (!tile_element_is_last_for_tile(tileElement++)){ + while (!(tileElement++)->IsLastForTile()){ if (clear_z >= tileElement->clearance_height) continue; @@ -4282,20 +4282,20 @@ void game_command_set_sign_style( uint8 textColour = (uint8)*edi; if (*ebp == 0) { // small sign - rct_tile_element* tile_element = map_get_first_element_at(x / 32, y / 32); + rct_tile_element* tileElement = map_get_first_element_at(x / 32, y / 32); bool wall_found = false; do{ - if (tile_element->GetType() != TILE_ELEMENT_TYPE_WALL) + if (tileElement->GetType() != TILE_ELEMENT_TYPE_WALL) continue; - rct_scenery_entry* scenery_entry = get_wall_entry(tile_element->properties.wall.type); + rct_scenery_entry* scenery_entry = get_wall_entry(tileElement->properties.wall.type); if (scenery_entry->wall.scrolling_mode == 0xFF) continue; - if (tile_element->properties.wall.banner_index != bannerId) + if (tileElement->properties.wall.banner_index != bannerId) continue; wall_found = true; break; - } while (!tile_element_is_last_for_tile(tile_element++)); + } while (!(tileElement++)->IsLastForTile()); if (wall_found == false) { *ebx = MONEY32_UNDEFINED; @@ -4306,10 +4306,10 @@ void game_command_set_sign_style( *ebx = 0; return; } - wall_set_primary_colour(tile_element, mainColour); - wall_set_secondary_colour(tile_element, textColour); + wall_set_primary_colour(tileElement, mainColour); + wall_set_secondary_colour(tileElement, textColour); - map_invalidate_tile(x, y, tile_element->base_height * 8, tile_element->clearance_height * 8); + map_invalidate_tile(x, y, tileElement->base_height * 8, tileElement->clearance_height * 8); } else { // large sign rct_tile_element *tileElement = banner_get_tile_element(bannerId); if (tileElement == nullptr || tileElement->GetType() != TILE_ELEMENT_TYPE_LARGE_SCENERY) { @@ -4519,7 +4519,7 @@ rct_tile_element *map_get_track_element_at(sint32 x, sint32 y, sint32 z) if (tileElement->base_height != z) continue; return tileElement; - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); return nullptr; } @@ -4540,7 +4540,7 @@ rct_tile_element *map_get_track_element_at_of_type(sint32 x, sint32 y, sint32 z, if (track_element_get_type(tileElement) != trackType) continue; return tileElement; - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); return nullptr; } @@ -4564,7 +4564,7 @@ rct_tile_element *map_get_track_element_at_of_type_seq(sint32 x, sint32 y, sint3 if (tile_element_get_track_sequence(tileElement) != sequence) continue; return tileElement; - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); return nullptr; } @@ -4586,7 +4586,7 @@ rct_tile_element *map_get_track_element_at_of_type_from_ride(sint32 x, sint32 y, if (track_element_get_type(tileElement) != trackType) continue; return tileElement; - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); return nullptr; }; @@ -4606,7 +4606,7 @@ rct_tile_element *map_get_track_element_at_from_ride(sint32 x, sint32 y, sint32 if (track_element_get_ride_index(tileElement) != rideIndex) continue; return tileElement; - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); return nullptr; }; @@ -4629,7 +4629,7 @@ rct_tile_element *map_get_track_element_at_with_direction_from_ride(sint32 x, si if (tile_element_get_direction(tileElement) != direction) continue; return tileElement; - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); return nullptr; }; @@ -4668,7 +4668,7 @@ rct_tile_element *map_get_wall_element_at(sint32 x, sint32 y, sint32 z, sint32 d continue; return tileElement; - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); return nullptr; } @@ -4710,7 +4710,7 @@ uint16 check_max_allowable_land_rights_for_tile(uint8 x, uint8 y, uint8 base_z) } } } - while (!tile_element_is_last_for_tile(tileElement++)); + while (!(tileElement++)->IsLastForTile()); return destOwnership; } diff --git a/src/openrct2/world/MapAnimation.cpp b/src/openrct2/world/MapAnimation.cpp index 27fc06a5bc..0740cd0c0a 100644 --- a/src/openrct2/world/MapAnimation.cpp +++ b/src/openrct2/world/MapAnimation.cpp @@ -121,7 +121,7 @@ static bool map_animation_invalidate_ride_entrance(sint32 x, sint32 y, sint32 ba sint32 height = (tileElement->base_height * 8) + entranceDefinition->height + 8; map_invalidate_tile_zoom1(x, y, height, height + 16); return false; - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); return true; } @@ -151,7 +151,7 @@ static bool map_animation_invalidate_queue_banner(sint32 x, sint32 y, sint32 bas map_invalidate_tile_zoom1(x, y, baseZ + 16, baseZ + 30); } return false; - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); return true; } @@ -217,7 +217,7 @@ static bool map_animation_invalidate_small_scenery(sint32 x, sint32 y, sint32 ba return false; } - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); return true; } @@ -243,7 +243,7 @@ static bool map_animation_invalidate_park_entrance(sint32 x, sint32 y, sint32 ba baseZ = tileElement->base_height * 8; map_invalidate_tile_zoom1(x, y, baseZ + 32, baseZ + 64); return false; - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); return true; } @@ -268,7 +268,7 @@ static bool map_animation_invalidate_track_waterfall(sint32 x, sint32 y, sint32 map_invalidate_tile_zoom1(x, y, z + 14, z + 46); return false; } - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); return true; } @@ -293,7 +293,7 @@ static bool map_animation_invalidate_track_rapids(sint32 x, sint32 y, sint32 bas map_invalidate_tile_zoom1(x, y, z + 14, z + 18); return false; } - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); return true; } @@ -327,7 +327,7 @@ static bool map_animation_invalidate_track_onridephoto(sint32 x, sint32 y, sint3 return true; } } - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); return true; } @@ -352,7 +352,7 @@ static bool map_animation_invalidate_track_whirlpool(sint32 x, sint32 y, sint32 map_invalidate_tile_zoom1(x, y, z + 14, z + 18); return false; } - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); return true; } @@ -377,7 +377,7 @@ static bool map_animation_invalidate_track_spinningtunnel(sint32 x, sint32 y, si map_invalidate_tile_zoom1(x, y, z + 14, z + 32); return false; } - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); return true; } @@ -409,7 +409,7 @@ static bool map_animation_invalidate_banner(sint32 x, sint32 y, sint32 baseZ) baseZ = tileElement->base_height * 8; map_invalidate_tile_zoom1(x, y, baseZ, baseZ + 16); return false; - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); return true; } @@ -437,7 +437,7 @@ static bool map_animation_invalidate_large_scenery(sint32 x, sint32 y, sint32 ba map_invalidate_tile_zoom1(x, y, z, z + 16); wasInvalidated = true; } - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); return !wasInvalidated; } @@ -492,7 +492,7 @@ static bool map_animation_invalidate_wall_door(sint32 x, sint32 y, sint32 baseZ) sint32 z = tileElement->base_height * 8; map_invalidate_tile_zoom1(x, y, z, z + 32); } - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); return removeAnimation; } @@ -522,7 +522,7 @@ static bool map_animation_invalidate_wall(sint32 x, sint32 y, sint32 baseZ) sint32 z = tileElement->base_height * 8; map_invalidate_tile_zoom1(x, y, z, z + 16); wasInvalidated = true; - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); return !wasInvalidated; } diff --git a/src/openrct2/world/Park.cpp b/src/openrct2/world/Park.cpp index 8ad736ef7e..ec1dcb13e0 100644 --- a/src/openrct2/world/Park.cpp +++ b/src/openrct2/world/Park.cpp @@ -198,7 +198,7 @@ void update_park_fences(sint32 x, sint32 y) fence_required = 0; break; } - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); if (fence_required) { // As map_is_location_in_park sets the error text @@ -349,7 +349,7 @@ static money32 map_buy_land_rights_for_tile(sint32 x, sint32 y, sint32 setting, tileElement->base_height < surfaceElement->base_height)) return 0; } - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); if (!(flags & GAME_COMMAND_FLAG_APPLY)) { return gLandPrice; diff --git a/src/openrct2/world/Scenery.cpp b/src/openrct2/world/Scenery.cpp index 18f452c3ce..db6ac97a97 100644 --- a/src/openrct2/world/Scenery.cpp +++ b/src/openrct2/world/Scenery.cpp @@ -109,7 +109,7 @@ void scenery_update_tile(sint32 x, sint32 y) } } } - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); } /** @@ -222,14 +222,14 @@ void scenery_remove_ghost_tool_placement(){ if (gSceneryGhostType & SCENERY_ENTRY_FLAG_1) { gSceneryGhostType &= ~SCENERY_ENTRY_FLAG_1; - rct_tile_element * tile_element = map_get_first_element_at(x / 32, y / 32); + rct_tile_element * tileElement = map_get_first_element_at(x / 32, y / 32); do { - if (tile_element->GetType() != TILE_ELEMENT_TYPE_PATH) + if (tileElement->GetType() != TILE_ELEMENT_TYPE_PATH) continue; - if (tile_element->base_height != z) + if (tileElement->base_height != z) continue; game_do_command( @@ -241,7 +241,7 @@ void scenery_remove_ghost_tool_placement(){ gSceneryGhostPathObjectType & 0xFFFF0000, 0); break; - } while (!tile_element_is_last_for_tile(tile_element++)); + } while (!(tileElement++)->IsLastForTile()); } if (gSceneryGhostType & SCENERY_ENTRY_FLAG_2) diff --git a/src/openrct2/world/SmallScenery.cpp b/src/openrct2/world/SmallScenery.cpp index aca84a92d8..f64a6ff386 100644 --- a/src/openrct2/world/SmallScenery.cpp +++ b/src/openrct2/world/SmallScenery.cpp @@ -94,7 +94,7 @@ static money32 SmallSceneryRemove(sint16 x, sint16 y, uint8 baseHeight, uint8 qu sceneryFound = true; break; - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); if (!sceneryFound) { diff --git a/src/openrct2/world/Sprite.cpp b/src/openrct2/world/Sprite.cpp index 5f5c925504..36778d1e13 100644 --- a/src/openrct2/world/Sprite.cpp +++ b/src/openrct2/world/Sprite.cpp @@ -660,7 +660,7 @@ static bool litter_can_be_at(sint32 x, sint32 y, sint32 z) return false; return true; - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); return false; } diff --git a/src/openrct2/world/TileElement.cpp b/src/openrct2/world/TileElement.cpp index 41e741d751..5d1abec1b0 100644 --- a/src/openrct2/world/TileElement.cpp +++ b/src/openrct2/world/TileElement.cpp @@ -84,17 +84,12 @@ bool tile_element_is_underground(rct_tile_element * tileElement) { do { tileElement++; - if (tile_element_is_last_for_tile(tileElement - 1)) + if ((tileElement - 1)->IsLastForTile()) return false; } while (tileElement->GetType() != TILE_ELEMENT_TYPE_SURFACE); return true; } -bool tile_element_is_last_for_tile(const rct_tile_element * element) -{ - return element->IsLastForTile(); -} - sint32 tile_element_get_banner_index(rct_tile_element * tileElement) { rct_scenery_entry* sceneryEntry; diff --git a/src/openrct2/world/TileInspector.cpp b/src/openrct2/world/TileInspector.cpp index 0ed79e9ce9..5b403ac6bb 100644 --- a/src/openrct2/world/TileInspector.cpp +++ b/src/openrct2/world/TileInspector.cpp @@ -78,7 +78,7 @@ static bool map_swap_elements_at(sint32 x, sint32 y, sint16 first, sint16 second *secondElement = temp; // Swap the 'last map element for tile' flag if either one of them was last - if (tile_element_is_last_for_tile(firstElement) || tile_element_is_last_for_tile(secondElement)) + if ((firstElement)->IsLastForTile() || (secondElement)->IsLastForTile()) { firstElement->flags ^= TILE_ELEMENT_FLAG_LAST_TILE; secondElement->flags ^= TILE_ELEMENT_FLAG_LAST_TILE; @@ -352,7 +352,7 @@ sint32 tile_inspector_paste_element_at(sint32 x, sint32 y, rct_tile_element elem rct_tile_element * const pastedElement = tile_element_insert(x, y, element.base_height, 0); - bool lastForTile = tile_element_is_last_for_tile(pastedElement); + bool lastForTile = pastedElement->IsLastForTile(); *pastedElement = element; pastedElement->flags &= ~TILE_ELEMENT_FLAG_LAST_TILE; if (lastForTile) @@ -394,7 +394,7 @@ sint32 tile_inspector_sort_elements_at(sint32 x, sint32 y, sint32 flags) do { numElement++; - } while (!tile_element_is_last_for_tile(elementIterator++)); + } while (!(elementIterator++)->IsLastForTile()); // Bubble sort for (sint32 loopStart = 1; loopStart < numElement; loopStart++) @@ -826,7 +826,7 @@ sint32 tile_inspector_track_base_height_offset(sint32 x, sint32 y, sint32 elemen found = true; break; - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); if (!found) { @@ -959,7 +959,7 @@ sint32 tile_inspector_track_set_chain(sint32 x, sint32 y, sint32 elementIndex, b found = true; break; - } while (!tile_element_is_last_for_tile(tileElement++)); + } while (!(tileElement++)->IsLastForTile()); if (!found) { @@ -1063,7 +1063,7 @@ sint32 tile_inspector_corrupt_clamp(sint32 x, sint32 y, sint32 elementIndex, sin if (corruptElement == nullptr || corruptElement->GetType() != TILE_ELEMENT_TYPE_CORRUPT) return MONEY32_UNDEFINED; - if (tile_element_is_last_for_tile(corruptElement)) + if (corruptElement->IsLastForTile()) return MONEY32_UNDEFINED; if (flags & GAME_COMMAND_FLAG_APPLY) diff --git a/src/openrct2/world/Wall.cpp b/src/openrct2/world/Wall.cpp index 73d9243506..d78583db1b 100644 --- a/src/openrct2/world/Wall.cpp +++ b/src/openrct2/world/Wall.cpp @@ -244,7 +244,7 @@ static bool WallCheckObstruction(rct_scenery_entry * wall, break; } } - while (!tile_element_is_last_for_tile(tileElement++)); + while (!(tileElement++)->IsLastForTile()); return true; } @@ -704,7 +704,7 @@ repeat: tile_element_remove(tileElement); goto repeat; } - while (!tile_element_is_last_for_tile(tileElement++)); + while (!(tileElement++)->IsLastForTile()); } /** @@ -741,7 +741,7 @@ void wall_remove_intersecting_walls(sint32 x, sint32 y, sint32 z0, sint32 z1, si tile_element_remove(tileElement); tileElement--; } - while (!tile_element_is_last_for_tile(tileElement++)); + while (!(tileElement++)->IsLastForTile()); } /**