From 2c29190ff810dd32cb60ddf2b0e67d93c2c8d535 Mon Sep 17 00:00:00 2001 From: duncanspumpkin Date: Tue, 4 Oct 2022 07:38:00 +0100 Subject: [PATCH] Remove snakes from entrance --- src/openrct2-ui/windows/Map.cpp | 8 ++++---- src/openrct2-ui/windows/RideConstruction.cpp | 2 +- src/openrct2-ui/windows/TileInspector.cpp | 2 +- src/openrct2/Game.cpp | 2 +- .../actions/ParkEntranceRemoveAction.cpp | 4 ++-- .../actions/RideEntranceExitPlaceAction.cpp | 2 +- .../actions/RideEntranceExitRemoveAction.cpp | 2 +- src/openrct2/park/ParkFile.cpp | 2 +- src/openrct2/ride/Ride.cpp | 2 +- src/openrct2/ride/Ride.h | 2 +- src/openrct2/ride/RideConstruction.cpp | 4 ++-- src/openrct2/ride/RideConstruction.h | 4 ++-- src/openrct2/world/Entrance.cpp | 20 +++++++++---------- src/openrct2/world/Entrance.h | 12 +++++------ src/openrct2/world/Map.cpp | 4 ++-- src/openrct2/world/Park.cpp | 2 +- src/openrct2/world/Park.h | 2 +- 17 files changed, 38 insertions(+), 38 deletions(-) diff --git a/src/openrct2-ui/windows/Map.cpp b/src/openrct2-ui/windows/Map.cpp index 35df97ec56..e5a7afd6e3 100644 --- a/src/openrct2-ui/windows/Map.cpp +++ b/src/openrct2-ui/windows/Map.cpp @@ -410,7 +410,7 @@ public: hide_construction_rights(); break; case WIDX_BUILD_PARK_ENTRANCE: - park_entrance_remove_ghost(); + ParkEntranceRemoveGhost(); Invalidate(); hide_gridlines(); hide_land_rights(); @@ -492,7 +492,7 @@ public: CoordsXYZD parkEntrancePosition = PlaceParkEntranceGetMapPosition(screenCoords); if (parkEntrancePosition.IsNull()) { - park_entrance_remove_ghost(); + ParkEntranceRemoveGhost(); return; } @@ -514,7 +514,7 @@ public: return; } - park_entrance_remove_ghost(); + ParkEntranceRemoveGhost(); auto gameAction = PlaceParkEntranceAction(parkEntrancePosition, gFootpathSelectedId); gameAction.SetFlags(GAME_COMMAND_FLAG_GHOST); @@ -529,7 +529,7 @@ public: void PlaceParkEntranceToolDown(const ScreenCoordsXY& screenCoords) { - park_entrance_remove_ghost(); + ParkEntranceRemoveGhost(); CoordsXYZD parkEntrancePosition = PlaceParkEntranceGetMapPosition(screenCoords); if (!parkEntrancePosition.IsNull()) diff --git a/src/openrct2-ui/windows/RideConstruction.cpp b/src/openrct2-ui/windows/RideConstruction.cpp index 9765965b88..aac5162898 100644 --- a/src/openrct2-ui/windows/RideConstruction.cpp +++ b/src/openrct2-ui/windows/RideConstruction.cpp @@ -3453,7 +3453,7 @@ void ride_construction_toolupdate_entrance_exit(const ScreenCoordsXY& screenCoor auto ride = get_ride(_currentRideIndex); if (ride != nullptr) { - _currentTrackPrice = ride_entrance_exit_place_ghost( + _currentTrackPrice = RideEntranceExitPlaceGhost( ride, entranceOrExitCoords, entranceOrExitCoords.direction, gRideEntranceExitPlaceType, stationNum); } window_ride_construction_update_active_elements(); diff --git a/src/openrct2-ui/windows/TileInspector.cpp b/src/openrct2-ui/windows/TileInspector.cpp index 7500a15a08..6b4f417f42 100644 --- a/src/openrct2-ui/windows/TileInspector.cpp +++ b/src/openrct2-ui/windows/TileInspector.cpp @@ -1320,7 +1320,7 @@ public: { // TODO: Make this work with Left/Right park entrance parts ft = Formatter(); - ft.Add(park_entrance_get_index({ _toolMap, tileElement->GetBaseZ() })); + ft.Add(ParkEntranceGetIndex({ _toolMap, tileElement->GetBaseZ() })); DrawTextBasic( &dpi, screenCoords + ScreenCoordsXY{ 0, 11 }, STR_TILE_INSPECTOR_ENTRANCE_ENTRANCE_ID, ft, { colours[1] }); diff --git a/src/openrct2/Game.cpp b/src/openrct2/Game.cpp index 0e9891048a..e26cb3d2f2 100644 --- a/src/openrct2/Game.cpp +++ b/src/openrct2/Game.cpp @@ -450,7 +450,7 @@ void game_fix_save_vars() fix_invalid_vehicle_sprite_sizes(); // Fix gParkEntrance locations for which the tile_element no longer exists - fix_park_entrance_locations(); + ParkEntranceFixLocations(); UpdateConsolidatedPatrolAreas(); } diff --git a/src/openrct2/actions/ParkEntranceRemoveAction.cpp b/src/openrct2/actions/ParkEntranceRemoveAction.cpp index b712205925..053d37648c 100644 --- a/src/openrct2/actions/ParkEntranceRemoveAction.cpp +++ b/src/openrct2/actions/ParkEntranceRemoveAction.cpp @@ -43,7 +43,7 @@ GameActions::Result ParkEntranceRemoveAction::Query() const res.Position = _loc; res.ErrorTitle = STR_CANT_REMOVE_THIS; - auto entranceIndex = park_entrance_get_index(_loc); + auto entranceIndex = ParkEntranceGetIndex(_loc); if (!LocationValid(_loc) || entranceIndex == -1) { log_error("Could not find entrance at x = %d, y = %d, z = %d", _loc.x, _loc.y, _loc.z); @@ -59,7 +59,7 @@ GameActions::Result ParkEntranceRemoveAction::Execute() const res.Position = _loc; res.ErrorTitle = STR_CANT_REMOVE_THIS; - auto entranceIndex = park_entrance_get_index(_loc); + auto entranceIndex = ParkEntranceGetIndex(_loc); if (entranceIndex == -1) { log_error("Could not find entrance at x = %d, y = %d, z = %d", _loc.x, _loc.y, _loc.z); diff --git a/src/openrct2/actions/RideEntranceExitPlaceAction.cpp b/src/openrct2/actions/RideEntranceExitPlaceAction.cpp index 45965ab296..0516f34873 100644 --- a/src/openrct2/actions/RideEntranceExitPlaceAction.cpp +++ b/src/openrct2/actions/RideEntranceExitPlaceAction.cpp @@ -209,7 +209,7 @@ GameActions::Result RideEntranceExitPlaceAction::Execute() const if (!(GetFlags() & GAME_COMMAND_FLAG_GHOST)) { - maze_entrance_hedge_removal({ _loc, entranceElement->as() }); + MazeEntranceHedgeRemoval({ _loc, entranceElement->as() }); } footpath_connect_edges(_loc, entranceElement->as(), GetFlags()); diff --git a/src/openrct2/actions/RideEntranceExitRemoveAction.cpp b/src/openrct2/actions/RideEntranceExitRemoveAction.cpp index f58540ea21..640cc293e0 100644 --- a/src/openrct2/actions/RideEntranceExitRemoveAction.cpp +++ b/src/openrct2/actions/RideEntranceExitRemoveAction.cpp @@ -141,7 +141,7 @@ GameActions::Result RideEntranceExitRemoveAction::Execute() const res.Position.z = tile_element_height(res.Position); footpath_queue_chain_reset(); - maze_entrance_hedge_replacement({ _loc, entranceElement }); + MazeEntranceHedgeReplacement({ _loc, entranceElement }); footpath_remove_edges_at(_loc, entranceElement); tile_element_remove(entranceElement); diff --git a/src/openrct2/park/ParkFile.cpp b/src/openrct2/park/ParkFile.cpp index a5fb0a39a1..5f30b7aa60 100644 --- a/src/openrct2/park/ParkFile.cpp +++ b/src/openrct2/park/ParkFile.cpp @@ -1013,7 +1013,7 @@ namespace OpenRCT2 } } } - UpdateParkEntranceLocations(); + ParkEntranceUpdateLocations(); } else { diff --git a/src/openrct2/ride/Ride.cpp b/src/openrct2/ride/Ride.cpp index 353be2f659..d5df981ab0 100644 --- a/src/openrct2/ride/Ride.cpp +++ b/src/openrct2/ride/Ride.cpp @@ -3010,7 +3010,7 @@ static void ride_set_maze_entrance_exit_points(Ride* ride) if (tileElement->GetBaseZ() != entranceExitMapPos.z) continue; - maze_entrance_hedge_removal({ entranceExitMapPos, tileElement }); + MazeEntranceHedgeRemoval({ entranceExitMapPos, tileElement }); } while (!(tileElement++)->IsLastForTile()); } } diff --git a/src/openrct2/ride/Ride.h b/src/openrct2/ride/Ride.h index f88ccaf482..3950ec1317 100644 --- a/src/openrct2/ride/Ride.h +++ b/src/openrct2/ride/Ride.h @@ -1057,7 +1057,7 @@ bool track_block_get_previous_from_zero( void ride_get_start_of_track(CoordsXYE* output); void window_ride_construction_update_active_elements(); -money32 ride_entrance_exit_place_ghost( +money32 RideEntranceExitPlaceGhost( Ride* ride, const CoordsXY& entranceExitCoords, Direction direction, int32_t placeType, StationIndex stationNum); ResultWithMessage ride_are_all_possible_entrances_and_exits_built(Ride* ride); diff --git a/src/openrct2/ride/RideConstruction.cpp b/src/openrct2/ride/RideConstruction.cpp index c34ea33e1a..c490bcb135 100644 --- a/src/openrct2/ride/RideConstruction.cpp +++ b/src/openrct2/ride/RideConstruction.cpp @@ -534,7 +534,7 @@ void ride_construction_remove_ghosts() { if (_currentTrackSelectionFlags & TRACK_SELECTION_FLAG_ENTRANCE_OR_EXIT) { - ride_entrance_exit_remove_ghost(); + RideEntranceExitRemoveGhost(); _currentTrackSelectionFlags &= ~TRACK_SELECTION_FLAG_ENTRANCE_OR_EXIT; } if (_currentTrackSelectionFlags & TRACK_SELECTION_FLAG_TRACK) @@ -1573,7 +1573,7 @@ void Ride::ValidateStations() if (shouldRemove) { footpath_queue_chain_reset(); - maze_entrance_hedge_replacement({ location, tileElement }); + MazeEntranceHedgeReplacement({ location, tileElement }); footpath_remove_edges_at(location, tileElement); footpath_update_queue_chains(); map_invalidate_tile_full(location); diff --git a/src/openrct2/ride/RideConstruction.h b/src/openrct2/ride/RideConstruction.h index 58bd9ce3be..731616754e 100644 --- a/src/openrct2/ride/RideConstruction.h +++ b/src/openrct2/ride/RideConstruction.h @@ -72,8 +72,8 @@ extern uint8_t gRideEntranceExitPlaceDirection; std::optional GetTrackElementOriginAndApplyChanges( const CoordsXYZD& location, track_type_t type, uint16_t extra_params, TileElement** output_element, uint16_t flags); -void ride_entrance_exit_place_provisional_ghost(); -void ride_entrance_exit_remove_ghost(); +void RideEntranceExitPlaceProvisionalGhost(); +void RideEntranceExitRemoveGhost(); void ride_restore_provisional_track_piece(); void ride_remove_provisional_track_piece(); diff --git a/src/openrct2/world/Entrance.cpp b/src/openrct2/world/Entrance.cpp index 92cef6fb8b..ac4f651738 100644 --- a/src/openrct2/world/Entrance.cpp +++ b/src/openrct2/world/Entrance.cpp @@ -54,7 +54,7 @@ static money32 RideEntranceExitPlaceGhost( * * rct2: 0x00666F9E */ -void park_entrance_remove_ghost() +void ParkEntranceRemoveGhost() { if (gParkEntranceGhostExists) { @@ -65,7 +65,7 @@ void park_entrance_remove_ghost() } } -int32_t park_entrance_get_index(const CoordsXYZ& entrancePos) +int32_t ParkEntranceGetIndex(const CoordsXYZ& entrancePos) { int32_t i = 0; for (const auto& entrance : gParkEntrances) @@ -79,12 +79,12 @@ int32_t park_entrance_get_index(const CoordsXYZ& entrancePos) return -1; } -void reset_park_entrance() +void PartEntranceReset() { gParkEntrances.clear(); } -void ride_entrance_exit_place_provisional_ghost() +void RideEntranceExitPlaceProvisionalGhost() { if (_currentTrackSelectionFlags & TRACK_SELECTION_FLAG_ENTRANCE_OR_EXIT) { @@ -94,7 +94,7 @@ void ride_entrance_exit_place_provisional_ghost() } } -void ride_entrance_exit_remove_ghost() +void RideEntranceExitRemoveGhost() { if (_currentTrackSelectionFlags & TRACK_SELECTION_FLAG_ENTRANCE_OR_EXIT) { @@ -111,7 +111,7 @@ void ride_entrance_exit_remove_ghost() * * rct2: 0x006CA28C */ -money32 ride_entrance_exit_place_ghost( +money32 RideEntranceExitPlaceGhost( Ride* ride, const CoordsXY& entranceExitCoords, Direction direction, int32_t placeType, StationIndex stationNum) { ride_construction_remove_ghosts(); @@ -132,7 +132,7 @@ money32 ride_entrance_exit_place_ghost( * Replaces the outer hedge walls for an entrance placement removal. * rct2: 0x00666D6F */ -void maze_entrance_hedge_replacement(const CoordsXYE& entrance) +void MazeEntranceHedgeReplacement(const CoordsXYE& entrance) { int32_t direction = entrance.element->GetDirection(); auto hedgePos = entrance + CoordsDirectionDelta[direction]; @@ -169,7 +169,7 @@ void maze_entrance_hedge_replacement(const CoordsXYE& entrance) * Removes the hedge walls for an entrance placement. * rct2: 0x00666CBE */ -void maze_entrance_hedge_removal(const CoordsXYE& entrance) +void MazeEntranceHedgeRemoval(const CoordsXYE& entrance) { int32_t direction = entrance.element->GetDirection(); auto hedgePos = entrance + CoordsDirectionDelta[direction]; @@ -208,7 +208,7 @@ void maze_entrance_hedge_removal(const CoordsXYE& entrance) } while (!(tileElement++)->IsLastForTile()); } -void fix_park_entrance_locations(void) +void ParkEntranceFixLocations(void) { // Fix gParkEntrance locations for which the tile_element no longer exists gParkEntrances.erase( @@ -218,7 +218,7 @@ void fix_park_entrance_locations(void) gParkEntrances.end()); } -void UpdateParkEntranceLocations() +void ParkEntranceUpdateLocations() { gParkEntrances.clear(); tile_element_iterator it; diff --git a/src/openrct2/world/Entrance.h b/src/openrct2/world/Entrance.h index b719311c46..584b75da10 100644 --- a/src/openrct2/world/Entrance.h +++ b/src/openrct2/world/Entrance.h @@ -55,11 +55,11 @@ extern std::vector gParkEntrances; extern CoordsXYZD gRideEntranceExitGhostPosition; extern StationIndex gRideEntranceExitGhostStationIndex; -void park_entrance_remove_ghost(); +void ParkEntranceRemoveGhost(); -void reset_park_entrance(); -void maze_entrance_hedge_replacement(const CoordsXYE& entrance); -void maze_entrance_hedge_removal(const CoordsXYE& entrance); +void PartEntranceReset(); +void MazeEntranceHedgeReplacement(const CoordsXYE& entrance); +void MazeEntranceHedgeRemoval(const CoordsXYE& entrance); -void fix_park_entrance_locations(); -void UpdateParkEntranceLocations(); +void ParkEntranceFixLocations(); +void ParkEntranceUpdateLocations(); diff --git a/src/openrct2/world/Map.cpp b/src/openrct2/world/Map.cpp index 349972ba77..c6b375812c 100644 --- a/src/openrct2/world/Map.cpp +++ b/src/openrct2/world/Map.cpp @@ -1356,7 +1356,7 @@ void map_remove_provisional_elements() if (window_find_by_class(WindowClass::RideConstruction) != nullptr) { ride_remove_provisional_track_piece(); - ride_entrance_exit_remove_ghost(); + RideEntranceExitRemoveGhost(); } // This is in non performant so only make network games suffer for it // non networked games do not need this as its to prevent desyncs. @@ -1381,7 +1381,7 @@ void map_restore_provisional_elements() if (window_find_by_class(WindowClass::RideConstruction) != nullptr) { ride_restore_provisional_track_piece(); - ride_entrance_exit_place_provisional_ghost(); + RideEntranceExitPlaceProvisionalGhost(); } // This is in non performant so only make network games suffer for it // non networked games do not need this as its to prevent desyncs. diff --git a/src/openrct2/world/Park.cpp b/src/openrct2/world/Park.cpp index bb916060cd..07c1323f80 100644 --- a/src/openrct2/world/Park.cpp +++ b/src/openrct2/world/Park.cpp @@ -278,7 +278,7 @@ void Park::Initialise() gParkEntranceFee = 10.00_GBP; gPeepSpawns.clear(); - reset_park_entrance(); + PartEntranceReset(); gResearchPriorities = EnumsToFlags( ResearchCategory::Transport, ResearchCategory::Gentle, ResearchCategory::Rollercoaster, ResearchCategory::Thrill, diff --git a/src/openrct2/world/Park.h b/src/openrct2/world/Park.h index e2130c9bd2..30c0fc85d4 100644 --- a/src/openrct2/world/Park.h +++ b/src/openrct2/world/Park.h @@ -121,7 +121,7 @@ void update_park_fences_around_tile(const CoordsXY& coords); uint8_t calculate_guest_initial_happiness(uint8_t percentage); void park_set_open(bool open); -int32_t park_entrance_get_index(const CoordsXYZ& entrancePos); +int32_t ParkEntranceGetIndex(const CoordsXYZ& entrancePos); money16 park_get_entrance_fee(); bool park_ride_prices_unlocked();