Remove old game command

This commit is contained in:
duncanspumpkin 2019-02-24 09:12:59 +00:00
parent f4791f9d96
commit 245a7fe64d
5 changed files with 3 additions and 128 deletions

View File

@ -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,

View File

@ -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,

View File

@ -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)

View File

@ -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);

View File

@ -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