From f10391c98d71ecc2f9d71b5ac964308ad2d4f310 Mon Sep 17 00:00:00 2001 From: duncanspumpkin Date: Thu, 28 Feb 2019 11:00:31 +0000 Subject: [PATCH] Remove references to old command --- src/openrct2/Game.cpp | 4 +- src/openrct2/Game.h | 26 ++-- src/openrct2/ride/Ride.h | 2 - src/openrct2/windows/_legacy.cpp | 24 ---- src/openrct2/world/Entrance.cpp | 237 ------------------------------- 5 files changed, 15 insertions(+), 278 deletions(-) diff --git a/src/openrct2/Game.cpp b/src/openrct2/Game.cpp index 8d7e6dad6c..9f30610492 100644 --- a/src/openrct2/Game.cpp +++ b/src/openrct2/Game.cpp @@ -93,7 +93,7 @@ static GAME_COMMAND_CALLBACK_POINTER * const game_command_callback_table[] = { nullptr, nullptr, game_command_callback_place_banner, - game_command_callback_place_ride_entrance_or_exit, + nullptr, game_command_callback_hire_new_staff_member, game_command_callback_pickup_guest, game_command_callback_pickup_staff @@ -1272,7 +1272,7 @@ GAME_COMMAND_POINTER* new_game_command_table[GAME_COMMAND_COUNT] = { nullptr, game_command_set_ride_name, nullptr, - game_command_place_ride_entrance_or_exit, + nullptr, nullptr, nullptr, nullptr, diff --git a/src/openrct2/Game.h b/src/openrct2/Game.h index 0d53950e37..0745b7a184 100644 --- a/src/openrct2/Game.h +++ b/src/openrct2/Game.h @@ -18,19 +18,19 @@ struct rct_s6_data; enum GAME_COMMAND { - GAME_COMMAND_SET_RIDE_APPEARANCE, // GA - GAME_COMMAND_SET_LAND_HEIGHT, // GA - GAME_COMMAND_TOGGLE_PAUSE, // GA - GAME_COMMAND_PLACE_TRACK, // GA - GAME_COMMAND_REMOVE_TRACK, // GA - GAME_COMMAND_LOAD_OR_QUIT, // GA - GAME_COMMAND_CREATE_RIDE, // GA - GAME_COMMAND_DEMOLISH_RIDE, // GA - GAME_COMMAND_SET_RIDE_STATUS, // GA - GAME_COMMAND_SET_RIDE_VEHICLES, // GA - GAME_COMMAND_SET_RIDE_NAME, // GA - GAME_COMMAND_SET_RIDE_SETTING, // GA - GAME_COMMAND_PLACE_RIDE_ENTRANCE_OR_EXIT, + GAME_COMMAND_SET_RIDE_APPEARANCE, // GA + GAME_COMMAND_SET_LAND_HEIGHT, // GA + GAME_COMMAND_TOGGLE_PAUSE, // GA + GAME_COMMAND_PLACE_TRACK, // GA + GAME_COMMAND_REMOVE_TRACK, // GA + GAME_COMMAND_LOAD_OR_QUIT, // GA + GAME_COMMAND_CREATE_RIDE, // GA + GAME_COMMAND_DEMOLISH_RIDE, // GA + GAME_COMMAND_SET_RIDE_STATUS, // GA + GAME_COMMAND_SET_RIDE_VEHICLES, // GA + GAME_COMMAND_SET_RIDE_NAME, // GA + GAME_COMMAND_SET_RIDE_SETTING, // GA + GAME_COMMAND_PLACE_RIDE_ENTRANCE_OR_EXIT, // GA GAME_COMMAND_REMOVE_RIDE_ENTRANCE_OR_EXIT, // GA GAME_COMMAND_REMOVE_SCENERY, // GA GAME_COMMAND_PLACE_SCENERY, // GA diff --git a/src/openrct2/ride/Ride.h b/src/openrct2/ride/Ride.h index 52c6c72100..65e347e8c9 100644 --- a/src/openrct2/ride/Ride.h +++ b/src/openrct2/ride/Ride.h @@ -1166,8 +1166,6 @@ rct_vehicle* ride_get_broken_vehicle(Ride* ride); void window_ride_construction_do_station_check(); void window_ride_construction_do_entrance_exit_check(); -void game_command_callback_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 ride_delete(Ride* ride); void ride_renew(Ride* ride); diff --git a/src/openrct2/windows/_legacy.cpp b/src/openrct2/windows/_legacy.cpp index dea46e7649..207255dd2b 100644 --- a/src/openrct2/windows/_legacy.cpp +++ b/src/openrct2/windows/_legacy.cpp @@ -108,30 +108,6 @@ uint8_t _rideConstructionState2; bool _stationConstructed; bool _deferClose; -void game_command_callback_place_ride_entrance_or_exit( - [[maybe_unused]] int32_t eax, [[maybe_unused]] int32_t ebx, [[maybe_unused]] int32_t ecx, [[maybe_unused]] int32_t edx, - [[maybe_unused]] int32_t esi, [[maybe_unused]] int32_t edi, [[maybe_unused]] int32_t ebp) -{ - audio_play_sound_at_location(SOUND_PLACE_ITEM, gCommandPosition.x, gCommandPosition.y, gCommandPosition.z); - - Ride* ride = get_ride(gRideEntranceExitPlaceRideIndex); - if (ride_are_all_possible_entrances_and_exits_built(ride)) - { - tool_cancel(); - if (ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_HAS_NO_TRACK)) - { - window_close_by_class(WC_RIDE_CONSTRUCTION); - } - } - else - { - gRideEntranceExitPlaceType ^= 1; - gCurrentToolWidget.widget_index = (gRideEntranceExitPlaceType == ENTRANCE_TYPE_RIDE_ENTRANCE) - ? WC_RIDE_CONSTRUCTION__WIDX_ENTRANCE - : WC_RIDE_CONSTRUCTION__WIDX_EXIT; - } -} - /** * * rct2: 0x006CA162 diff --git a/src/openrct2/world/Entrance.cpp b/src/openrct2/world/Entrance.cpp index 44888f4c3b..489d68ee04 100644 --- a/src/openrct2/world/Entrance.cpp +++ b/src/openrct2/world/Entrance.cpp @@ -88,230 +88,6 @@ static money32 ParkEntranceRemove(int16_t x, int16_t y, uint8_t z, uint8_t flags return 0; } -static money32 RideEntranceExitPlace( - int16_t x, int16_t y, int16_t z, uint8_t direction, uint8_t flags, ride_id_t rideIndex, uint8_t stationNum, bool isExit) -{ - // Remember when in unknown station num mode rideIndex is unknown and z is set - // When in known station num mode rideIndex is known and z is unknown - - money32 cost = 0; - gCommandPosition.x = x; - gCommandPosition.y = y; - - if (!map_check_free_elements_and_reorganise(1)) - { - return MONEY32_UNDEFINED; - } - - 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 (stationNum == 0xFF) - { - z *= 16; - if (flags & GAME_COMMAND_FLAG_APPLY) - { - return MONEY32_UNDEFINED; - } - - if (!gCheatsSandboxMode && !map_is_location_owned(x, y, z)) - { - return MONEY32_UNDEFINED; - } - - int16_t clear_z = z / 8 + (isExit ? 5 : 7); - - if (!map_can_construct_with_clear_at( - x, y, z / 8, clear_z, &map_place_non_scenery_clear_func, { 0b1111, 0 }, flags, &cost, - CREATE_CROSSING_MODE_NONE)) - { - return MONEY32_UNDEFINED; - } - - if (gMapGroundFlags & ELEMENT_IS_UNDERWATER) - { - gGameCommandErrorText = STR_RIDE_CANT_BUILD_THIS_UNDERWATER; - return MONEY32_UNDEFINED; - } - - if (z / 8 > 244) - { - gGameCommandErrorText = STR_TOO_HIGH; - return MONEY32_UNDEFINED; - } - } - else - { - 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 game command for ride %u", rideIndex); - 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; - } - - ride_clear_for_construction(ride); - ride_remove_peeps(ride); - - bool requiresRemove = false; - LocationXY16 removeCoord = { 0, 0 }; - - if (isExit) - { - const auto exit = ride_get_exit_location(ride, stationNum); - if (!exit.isNull()) - { - if (flags & GAME_COMMAND_FLAG_GHOST) - { - gGameCommandErrorText = 0; - return MONEY32_UNDEFINED; - } - - removeCoord.x = exit.x * 32; - removeCoord.y = exit.y * 32; - requiresRemove = true; - } - } - else - { - const auto entrance = ride_get_entrance_location(ride, stationNum); - if (!entrance.isNull()) - { - if (flags & GAME_COMMAND_FLAG_GHOST) - { - gGameCommandErrorText = 0; - return MONEY32_UNDEFINED; - } - - removeCoord.x = entrance.x * 32; - removeCoord.y = entrance.y * 32; - requiresRemove = true; - } - } - - if (requiresRemove) - { - auto rideEntranceExitRemove = RideEntranceExitRemoveAction( - { removeCoord.x, removeCoord.y }, rideIndex, stationNum, isExit); - rideEntranceExitRemove.SetFlags(flags); - - auto res = flags & GAME_COMMAND_FLAG_APPLY ? GameActions::ExecuteNested(&rideEntranceExitRemove) - : GameActions::QueryNested(&rideEntranceExitRemove); - if (res->Error != GA_ERROR::OK) - { - return MONEY32_UNDEFINED; - } - } - - z = ride->stations[stationNum].Height * 8; - gCommandPosition.z = z; - - if ((flags & GAME_COMMAND_FLAG_APPLY) && !(flags & GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED) - && !(flags & GAME_COMMAND_FLAG_GHOST)) - { - footpath_remove_litter(x, y, z); - wall_remove_at_z(x, y, z); - } - - if (!gCheatsSandboxMode && !map_is_location_owned(x, y, z)) - { - return MONEY32_UNDEFINED; - } - - int8_t clear_z = (z / 8) + (isExit ? 5 : 7); - - if (!map_can_construct_with_clear_at( - x, y, z / 8, clear_z, &map_place_non_scenery_clear_func, { 0b1111, 0 }, flags, &cost, - CREATE_CROSSING_MODE_NONE)) - { - return MONEY32_UNDEFINED; - } - - if (gMapGroundFlags & ELEMENT_IS_UNDERWATER) - { - gGameCommandErrorText = STR_RIDE_CANT_BUILD_THIS_UNDERWATER; - return MONEY32_UNDEFINED; - } - - if (z / 8 > 244) - { - gGameCommandErrorText = STR_TOO_HIGH; - return MONEY32_UNDEFINED; - } - - if (flags & GAME_COMMAND_FLAG_APPLY) - { - 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); - - TileElement* tileElement = tile_element_insert(x / 32, y / 32, z / 8, 0xF); - assert(tileElement != nullptr); - tileElement->SetType(TILE_ELEMENT_TYPE_ENTRANCE); - tileElement->SetDirection(direction); - tileElement->clearance_height = clear_z; - tileElement->AsEntrance()->SetEntranceType(isExit ? ENTRANCE_TYPE_RIDE_EXIT : ENTRANCE_TYPE_RIDE_ENTRANCE); - tileElement->AsEntrance()->SetStationIndex(stationNum); - tileElement->AsEntrance()->SetRideIndex(rideIndex); - - if (flags & GAME_COMMAND_FLAG_GHOST) - { - tileElement->SetGhost(true); - } - - if (isExit) - { - ride_set_exit_location(ride, stationNum, { x / 32, y / 32, z / 8, (uint8_t)tileElement->GetDirection() }); - } - else - { - ride_set_entrance_location(ride, stationNum, { x / 32, y / 32, z / 8, (uint8_t)tileElement->GetDirection() }); - ride->stations[stationNum].LastPeepInQueue = SPRITE_INDEX_NULL; - ride->stations[stationNum].QueueLength = 0; - - map_animation_create(MAP_ANIMATION_TYPE_RIDE_ENTRANCE, x, y, z / 8); - } - - footpath_queue_chain_reset(); - - if (!(flags & GAME_COMMAND_FLAG_GHOST)) - { - maze_entrance_hedge_removal(x, y, tileElement); - } - - footpath_connect_edges(x, y, tileElement, flags); - footpath_update_queue_chains(); - - map_invalidate_tile_full(x, y); - } - } - - gCommandExpenditureType = RCT_EXPENDITURE_TYPE_RIDE_CONSTRUCTION; - return cost; -} - static money32 RideEntranceExitPlaceGhost( ride_id_t rideIndex, int16_t x, int16_t y, uint8_t direction, uint8_t placeType, uint8_t stationNum) { @@ -412,19 +188,6 @@ money32 ride_entrance_exit_place_ghost( return result; } -/** - * - * rct2: 0x006660A8 - */ -void game_command_place_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 = RideEntranceExitPlace( - *eax & 0xFFFF, *ecx & 0xFFFF, *edx & 0xFF, (*ebx >> 8) & 0xFF, *ebx & 0xFF, *edx & 0xFF, *edi & 0xFF, - ((*edx >> 8) & 0xFF) != 0); -} - /** * Replaces the outer hedge walls for an entrance placement removal. * rct2: 0x00666D6F