From 245a7fe64d016816e7741c88df129b37398a1285 Mon Sep 17 00:00:00 2001 From: duncanspumpkin Date: Sun, 24 Feb 2019 09:12:59 +0000 Subject: [PATCH] Remove old game command --- src/openrct2/Game.cpp | 2 +- src/openrct2/Game.h | 2 +- .../actions/RideEntranceExitRemoveAction.hpp | 2 +- src/openrct2/ride/Ride.h | 2 - src/openrct2/world/Entrance.cpp | 123 ------------------ 5 files changed, 3 insertions(+), 128 deletions(-) diff --git a/src/openrct2/Game.cpp b/src/openrct2/Game.cpp index 9532fb7250..3fd0fdd4ad 100644 --- a/src/openrct2/Game.cpp +++ b/src/openrct2/Game.cpp @@ -1273,7 +1273,7 @@ GAME_COMMAND_POINTER* new_game_command_table[GAME_COMMAND_COUNT] = { game_command_set_ride_name, nullptr, game_command_place_ride_entrance_or_exit, - game_command_remove_ride_entrance_or_exit, + nullptr, nullptr, nullptr, game_command_set_water_height, diff --git a/src/openrct2/Game.h b/src/openrct2/Game.h index 8d1ed6d0c9..f0821f9f2a 100644 --- a/src/openrct2/Game.h +++ b/src/openrct2/Game.h @@ -31,7 +31,7 @@ enum GAME_COMMAND GAME_COMMAND_SET_RIDE_NAME, // GA GAME_COMMAND_SET_RIDE_SETTING, // GA GAME_COMMAND_PLACE_RIDE_ENTRANCE_OR_EXIT, - GAME_COMMAND_REMOVE_RIDE_ENTRANCE_OR_EXIT, + GAME_COMMAND_REMOVE_RIDE_ENTRANCE_OR_EXIT, // GA GAME_COMMAND_REMOVE_SCENERY, // GA GAME_COMMAND_PLACE_SCENERY, // GA GAME_COMMAND_SET_WATER_HEIGHT, diff --git a/src/openrct2/actions/RideEntranceExitRemoveAction.hpp b/src/openrct2/actions/RideEntranceExitRemoveAction.hpp index e0ca328a1f..1aaa7ddc10 100644 --- a/src/openrct2/actions/RideEntranceExitRemoveAction.hpp +++ b/src/openrct2/actions/RideEntranceExitRemoveAction.hpp @@ -104,7 +104,7 @@ public: if (tileElement->AsEntrance()->GetStationIndex() != _stationNum) continue; - if ((GetFlags() & GAME_COMMAND_FLAG_5) && !(tileElement->flags & TILE_ELEMENT_FLAG_GHOST)) + if ((GetFlags() & GAME_COMMAND_FLAG_5) && !tileElement->IsGhost()) continue; if (tileElement->AsEntrance()->GetEntranceType() == ENTRANCE_TYPE_PARK_ENTRANCE) diff --git a/src/openrct2/ride/Ride.h b/src/openrct2/ride/Ride.h index fc444d5b35..a5729f007a 100644 --- a/src/openrct2/ride/Ride.h +++ b/src/openrct2/ride/Ride.h @@ -1144,8 +1144,6 @@ void game_command_set_ride_vehicles( void game_command_place_ride_entrance_or_exit( int32_t* eax, int32_t* ebx, int32_t* ecx, int32_t* edx, int32_t* esi, int32_t* edi, int32_t* ebp); -void game_command_remove_ride_entrance_or_exit( - int32_t* eax, int32_t* ebx, int32_t* ecx, int32_t* edx, int32_t* esi, int32_t* edi, int32_t* ebp); void ride_set_to_default_inspection_interval(Ride* ride); diff --git a/src/openrct2/world/Entrance.cpp b/src/openrct2/world/Entrance.cpp index 13a2d78111..d9d49581eb 100644 --- a/src/openrct2/world/Entrance.cpp +++ b/src/openrct2/world/Entrance.cpp @@ -311,118 +311,6 @@ static money32 RideEntranceExitPlace( return cost; } -static money32 RideEntranceExitRemove(int16_t x, int16_t y, ride_id_t rideIndex, uint8_t stationNum, uint8_t flags, bool isExit) -{ - if (rideIndex >= MAX_RIDES) - { - log_warning("Invalid game command for ride %u", rideIndex); - return MONEY32_UNDEFINED; - } - - Ride* ride = get_ride(rideIndex); - if (ride->type == RIDE_TYPE_NULL) - { - log_warning("Invalid ride id %u for entrance/exit removal", rideIndex); - return MONEY32_UNDEFINED; - } - - if (!(flags & GAME_COMMAND_FLAG_GHOST)) - { - if (!(flags & GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED) && game_is_paused() && !gCheatsBuildInPauseMode) - { - gGameCommandErrorText = STR_CONSTRUCTION_NOT_POSSIBLE_WHILE_GAME_IS_PAUSED; - return MONEY32_UNDEFINED; - } - } - - if (ride->status != RIDE_STATUS_CLOSED) - { - gGameCommandErrorText = STR_MUST_BE_CLOSED_FIRST; - return MONEY32_UNDEFINED; - } - - if (ride->lifecycle_flags & RIDE_LIFECYCLE_INDESTRUCTIBLE_TRACK) - { - gGameCommandErrorText = STR_NOT_ALLOWED_TO_MODIFY_STATION; - return MONEY32_UNDEFINED; - } - - if (flags & GAME_COMMAND_FLAG_APPLY) - { - ride_clear_for_construction(ride); - ride_remove_peeps(ride); - invalidate_test_results(ride); - - bool found = false; - TileElement* tileElement = map_get_first_element_at(x / 32, y / 32); - if (tileElement == nullptr) - { - log_warning("Invalid coordinates for entrance/exit removal x = %d, y = %d", x, y); - return MONEY32_UNDEFINED; - } - - do - { - if (tileElement->GetType() != TILE_ELEMENT_TYPE_ENTRANCE) - continue; - - if (tile_element_get_ride_index(tileElement) != rideIndex) - continue; - - if (tileElement->AsEntrance()->GetStationIndex() != stationNum) - continue; - - if (flags & GAME_COMMAND_FLAG_5 && !(tileElement->IsGhost())) - continue; - - if (tileElement->AsEntrance()->GetEntranceType() == ENTRANCE_TYPE_PARK_ENTRANCE) - continue; - - if (tileElement->AsEntrance()->GetEntranceType() == ENTRANCE_TYPE_RIDE_ENTRANCE && isExit) - continue; - - if (tileElement->AsEntrance()->GetEntranceType() == ENTRANCE_TYPE_RIDE_EXIT && !isExit) - continue; - - found = true; - break; - } while (!(tileElement++)->IsLastForTile()); - - if (!found) - { - return MONEY32_UNDEFINED; - } - - LocationXYZ16 coord; - coord.x = x + 16; - coord.y = y + 16; - coord.z = tile_element_height(coord.x, coord.y); - network_set_player_last_action_coord(network_get_player_index(game_command_playerid), coord); - - footpath_queue_chain_reset(); - maze_entrance_hedge_replacement(x, y, tileElement); - footpath_remove_edges_at(x, y, tileElement); - - tile_element_remove(tileElement); - - if (isExit) - { - ride_clear_exit_location(ride, stationNum); - } - else - { - ride_clear_entrance_location(ride, stationNum); - } - - footpath_update_queue_chains(); - - map_invalidate_tile_full(x, y); - } - - gCommandExpenditureType = RCT_EXPENDITURE_TYPE_RIDE_CONSTRUCTION; - return 0; -} - static money32 RideEntranceExitPlaceGhost( ride_id_t rideIndex, int16_t x, int16_t y, uint8_t direction, uint8_t placeType, uint8_t stationNum) { @@ -535,17 +423,6 @@ void game_command_place_ride_entrance_or_exit( ((*edx >> 8) & 0xFF) != 0); } -/** - * - * rct2: 0x0066640B - */ -void game_command_remove_ride_entrance_or_exit( - int32_t* eax, int32_t* ebx, int32_t* ecx, int32_t* edx, [[maybe_unused]] int32_t* esi, int32_t* edi, - [[maybe_unused]] int32_t* ebp) -{ - *ebx = RideEntranceExitRemove(*eax & 0xFFFF, *ecx & 0xFFFF, *edx & 0xFF, *edi & 0xFF, *ebx & 0xFF, *ebp & 1); -} - /** * Replaces the outer hedge walls for an entrance placement removal. * rct2: 0x00666D6F