mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-17 03:53:07 +01:00
Pass Ride* instead of ride_id_t
This commit is contained in:
@@ -182,7 +182,8 @@ static void window_ride_demolish_mouseup(rct_window* w, rct_widgetindex widgetIn
|
||||
{
|
||||
case WIDX_DEMOLISH:
|
||||
{
|
||||
ride_action_modify(w->number, RIDE_MODIFY_DEMOLISH, GAME_COMMAND_FLAG_APPLY);
|
||||
auto ride = get_ride(w->number);
|
||||
ride_action_modify(ride, RIDE_MODIFY_DEMOLISH, GAME_COMMAND_FLAG_APPLY);
|
||||
break;
|
||||
}
|
||||
case WIDX_CANCEL:
|
||||
@@ -198,7 +199,8 @@ static void window_ride_refurbish_mouseup(rct_window* w, rct_widgetindex widgetI
|
||||
{
|
||||
case WIDX_REFURBISH:
|
||||
{
|
||||
ride_action_modify(w->number, RIDE_MODIFY_RENEW, GAME_COMMAND_FLAG_APPLY);
|
||||
auto ride = get_ride(w->number);
|
||||
ride_action_modify(ride, RIDE_MODIFY_RENEW, GAME_COMMAND_FLAG_APPLY);
|
||||
break;
|
||||
}
|
||||
case WIDX_CANCEL:
|
||||
|
||||
@@ -168,19 +168,18 @@ static void window_maze_construction_close(rct_window* w)
|
||||
|
||||
hide_gridlines();
|
||||
|
||||
ride_id_t rideIndex = _currentRideIndex;
|
||||
Ride* ride = get_ride(rideIndex);
|
||||
auto ride = get_ride(_currentRideIndex);
|
||||
if (ride->overall_view.xy == RCT_XY8_UNDEFINED)
|
||||
{
|
||||
int32_t savedPausedState = gGamePaused;
|
||||
gGamePaused = 0;
|
||||
ride_action_modify(rideIndex, RIDE_MODIFY_DEMOLISH, GAME_COMMAND_FLAG_APPLY | GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED);
|
||||
ride_action_modify(ride, RIDE_MODIFY_DEMOLISH, GAME_COMMAND_FLAG_APPLY | GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED);
|
||||
gGamePaused = savedPausedState;
|
||||
}
|
||||
else
|
||||
{
|
||||
auto intent = Intent(WC_RIDE);
|
||||
intent.putExtra(INTENT_EXTRA_RIDE_ID, rideIndex);
|
||||
intent.putExtra(INTENT_EXTRA_RIDE_ID, ride->id);
|
||||
context_open_intent(&intent);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -597,17 +597,15 @@ static void window_ride_construction_close(rct_window* w)
|
||||
|
||||
hide_gridlines();
|
||||
|
||||
ride_id_t rideIndex = _currentRideIndex;
|
||||
Ride* ride = get_ride(rideIndex);
|
||||
|
||||
// If we demolish a ride all windows will be closed including the construction window,
|
||||
// the ride at this point is already gone.
|
||||
auto ride = get_ride(_currentRideIndex);
|
||||
if (ride == nullptr || ride->type == RIDE_TYPE_NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (ride_try_get_origin_element(rideIndex, nullptr))
|
||||
if (ride_try_get_origin_element(ride->id, nullptr))
|
||||
{
|
||||
// Auto open shops if required.
|
||||
if (ride->mode == RIDE_MODE_SHOP_STALL && gConfigGeneral.auto_open_shops)
|
||||
@@ -617,21 +615,21 @@ static void window_ride_construction_close(rct_window* w)
|
||||
if (!_autoOpeningShop)
|
||||
{
|
||||
_autoOpeningShop = true;
|
||||
ride_set_status(rideIndex, RIDE_STATUS_OPEN);
|
||||
ride_set_status(ride->id, RIDE_STATUS_OPEN);
|
||||
_autoOpeningShop = false;
|
||||
}
|
||||
}
|
||||
|
||||
ride_set_to_default_inspection_interval(rideIndex);
|
||||
ride_set_to_default_inspection_interval(ride->id);
|
||||
auto intent = Intent(WC_RIDE);
|
||||
intent.putExtra(INTENT_EXTRA_RIDE_ID, rideIndex);
|
||||
intent.putExtra(INTENT_EXTRA_RIDE_ID, ride->id);
|
||||
context_open_intent(&intent);
|
||||
}
|
||||
else
|
||||
{
|
||||
int32_t previousPauseState = gGamePaused;
|
||||
gGamePaused = 0;
|
||||
ride_action_modify(rideIndex, RIDE_MODIFY_DEMOLISH, GAME_COMMAND_FLAG_APPLY);
|
||||
ride_action_modify(ride, RIDE_MODIFY_DEMOLISH, GAME_COMMAND_FLAG_APPLY);
|
||||
gGamePaused = previousPauseState;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -451,10 +451,11 @@ static void window_ride_list_scrollmousedown(rct_window* w, int32_t scrollIndex,
|
||||
return;
|
||||
|
||||
// Open ride window
|
||||
ride_id_t rideIndex = w->list_item_positions[index];
|
||||
auto rideIndex = w->list_item_positions[index];
|
||||
auto ride = get_ride(rideIndex);
|
||||
if (_quickDemolishMode && network_get_mode() != NETWORK_MODE_CLIENT)
|
||||
{
|
||||
ride_action_modify(rideIndex, RIDE_MODIFY_DEMOLISH, GAME_COMMAND_FLAG_APPLY);
|
||||
ride_action_modify(ride, RIDE_MODIFY_DEMOLISH, GAME_COMMAND_FLAG_APPLY);
|
||||
window_ride_list_refresh_list(w);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -267,7 +267,7 @@ static void window_track_place_toolupdate(rct_window* w, rct_widgetindex widgetI
|
||||
// Check if tool map position has changed since last update
|
||||
if (mapX == _window_track_place_last_x && mapY == _window_track_place_last_y)
|
||||
{
|
||||
place_virtual_track(_trackDesign, PTD_OPERATION_DRAW_OUTLINES, true, 0, mapX, mapY, 0);
|
||||
place_virtual_track(_trackDesign, PTD_OPERATION_DRAW_OUTLINES, true, get_ride(0), mapX, mapY, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -306,7 +306,7 @@ static void window_track_place_toolupdate(rct_window* w, rct_widgetindex widgetI
|
||||
widget_invalidate(w, WIDX_PRICE);
|
||||
}
|
||||
|
||||
place_virtual_track(_trackDesign, PTD_OPERATION_DRAW_OUTLINES, true, 0, mapX, mapY, mapZ);
|
||||
place_virtual_track(_trackDesign, PTD_OPERATION_DRAW_OUTLINES, true, get_ride(0), mapX, mapY, mapZ);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -402,8 +402,9 @@ static void window_track_place_clear_provisional()
|
||||
{
|
||||
if (_window_track_place_last_was_valid)
|
||||
{
|
||||
auto ride = get_ride(_window_track_place_ride_index);
|
||||
place_virtual_track(
|
||||
_trackDesign, PTD_OPERATION_CLEAR_OUTLINES, true, _window_track_place_ride_index, _window_track_place_last_valid_x,
|
||||
_trackDesign, PTD_OPERATION_CLEAR_OUTLINES, true, ride, _window_track_place_last_valid_x,
|
||||
_window_track_place_last_valid_y, _window_track_place_last_valid_z);
|
||||
_window_track_place_last_was_valid = false;
|
||||
}
|
||||
@@ -435,7 +436,7 @@ static int32_t window_track_place_get_base_z(int32_t x, int32_t y)
|
||||
if (tileElement->AsSurface()->GetWaterHeight() > 0)
|
||||
z = std::max(z, tileElement->AsSurface()->GetWaterHeight() << 4);
|
||||
|
||||
return z + place_virtual_track(_trackDesign, PTD_OPERATION_GET_PLACE_Z, true, 0, x, y, z);
|
||||
return z + place_virtual_track(_trackDesign, PTD_OPERATION_GET_PLACE_Z, true, get_ride(0), x, y, z);
|
||||
}
|
||||
|
||||
static void window_track_place_attempt_placement(
|
||||
|
||||
@@ -190,9 +190,9 @@ void game_command_set_ride_name(
|
||||
#pragma endregion
|
||||
|
||||
#pragma region RideModifyAction
|
||||
void ride_action_modify(ride_id_t rideIndex, int32_t modifyType, int32_t flags)
|
||||
void ride_action_modify(Ride* ride, int32_t modifyType, int32_t flags)
|
||||
{
|
||||
auto gameAction = RideDemolishAction(rideIndex, modifyType);
|
||||
auto gameAction = RideDemolishAction(ride->id, modifyType);
|
||||
gameAction.SetFlags(flags);
|
||||
|
||||
GameActions::Execute(&gameAction);
|
||||
|
||||
@@ -1202,7 +1202,7 @@ bool ride_entry_has_category(const rct_ride_entry* rideEntry, uint8_t category);
|
||||
int32_t ride_get_entry_index(int32_t rideType, int32_t rideSubType);
|
||||
StationObject* ride_get_station_object(const Ride* ride);
|
||||
|
||||
void ride_action_modify(ride_id_t rideIndex, int32_t modifyType, int32_t flags);
|
||||
void ride_action_modify(Ride* ride, int32_t modifyType, int32_t flags);
|
||||
void ride_stop_peeps_queuing(ride_id_t rideIndex);
|
||||
|
||||
LocationXY16 ride_get_rotated_coords(int16_t x, int16_t y, int16_t z);
|
||||
|
||||
@@ -1159,7 +1159,7 @@ static int32_t track_design_place_scenery(
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int32_t track_design_place_maze(rct_track_td6* td6, int16_t x, int16_t y, int16_t z, ride_id_t rideIndex)
|
||||
static int32_t track_design_place_maze(rct_track_td6* td6, int16_t x, int16_t y, int16_t z, Ride* ride)
|
||||
{
|
||||
if (_trackDesignPlaceOperation == PTD_OPERATION_DRAW_OUTLINES)
|
||||
{
|
||||
@@ -1225,7 +1225,7 @@ static int32_t track_design_place_maze(rct_track_td6* td6, int16_t x, int16_t y,
|
||||
| GAME_COMMAND_FLAG_GHOST;
|
||||
}
|
||||
cost = game_do_command(
|
||||
mapCoord.x, flags | rotation << 8, mapCoord.y, rideIndex, GAME_COMMAND_PLACE_RIDE_ENTRANCE_OR_EXIT,
|
||||
mapCoord.x, flags | rotation << 8, mapCoord.y, ride->id, GAME_COMMAND_PLACE_RIDE_ENTRANCE_OR_EXIT,
|
||||
0, 0);
|
||||
}
|
||||
if (cost != MONEY32_UNDEFINED)
|
||||
@@ -1259,7 +1259,7 @@ static int32_t track_design_place_maze(rct_track_td6* td6, int16_t x, int16_t y,
|
||||
| GAME_COMMAND_FLAG_GHOST;
|
||||
}
|
||||
cost = game_do_command(
|
||||
mapCoord.x, flags | rotation << 8, mapCoord.y, rideIndex | (1 << 8),
|
||||
mapCoord.x, flags | rotation << 8, mapCoord.y, ride->id | (1 << 8),
|
||||
GAME_COMMAND_PLACE_RIDE_ENTRANCE_OR_EXIT, 0, 0);
|
||||
}
|
||||
if (cost != MONEY32_UNDEFINED)
|
||||
@@ -1291,7 +1291,7 @@ static int32_t track_design_place_maze(rct_track_td6* td6, int16_t x, int16_t y,
|
||||
gGameCommandErrorTitle = STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE;
|
||||
|
||||
cost = game_do_command(
|
||||
mapCoord.x, flags | (maze_entry & 0xFF) << 8, mapCoord.y, rideIndex | (maze_entry & 0xFF00),
|
||||
mapCoord.x, flags | (maze_entry & 0xFF) << 8, mapCoord.y, ride->id | (maze_entry & 0xFF00),
|
||||
GAME_COMMAND_PLACE_MAZE_DESIGN, z, 0);
|
||||
break;
|
||||
}
|
||||
@@ -1356,7 +1356,7 @@ static int32_t track_design_place_maze(rct_track_td6* td6, int16_t x, int16_t y,
|
||||
if (_trackDesignPlaceOperation == PTD_OPERATION_CLEAR_OUTLINES)
|
||||
{
|
||||
ride_action_modify(
|
||||
rideIndex, RIDE_MODIFY_DEMOLISH,
|
||||
ride, RIDE_MODIFY_DEMOLISH,
|
||||
GAME_COMMAND_FLAG_APPLY | GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED | GAME_COMMAND_FLAG_5 | GAME_COMMAND_FLAG_GHOST);
|
||||
}
|
||||
|
||||
@@ -1366,7 +1366,7 @@ static int32_t track_design_place_maze(rct_track_td6* td6, int16_t x, int16_t y,
|
||||
return 1;
|
||||
}
|
||||
|
||||
static bool track_design_place_ride(rct_track_td6* td6, int16_t x, int16_t y, int16_t z, ride_id_t rideIndex)
|
||||
static bool track_design_place_ride(rct_track_td6* td6, int16_t x, int16_t y, int16_t z, Ride* ride)
|
||||
{
|
||||
const rct_preview_track** trackBlockArray = (ride_type_has_flag(td6->type, RIDE_TYPE_FLAG_HAS_TRACK)) ? TrackBlocks
|
||||
: FlatRideTrackBlocks;
|
||||
@@ -1602,7 +1602,7 @@ static bool track_design_place_ride(rct_track_td6* td6, int16_t x, int16_t y, in
|
||||
|
||||
gGameCommandErrorTitle = STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE;
|
||||
money32 cost = game_do_command(
|
||||
x, bl | (rotation << 8), y, rideIndex | (isExit << 8), GAME_COMMAND_PLACE_RIDE_ENTRANCE_OR_EXIT,
|
||||
x, bl | (rotation << 8), y, ride->id | (isExit << 8), GAME_COMMAND_PLACE_RIDE_ENTRANCE_OR_EXIT,
|
||||
stationIndex, 0);
|
||||
_trackDesignPlaceCost += cost;
|
||||
|
||||
@@ -1663,7 +1663,7 @@ static bool track_design_place_ride(rct_track_td6* td6, int16_t x, int16_t y, in
|
||||
* rct2: 0x006D01B3
|
||||
*/
|
||||
int32_t place_virtual_track(
|
||||
rct_track_td6* td6, uint8_t ptdOperation, bool placeScenery, ride_id_t rideIndex, int16_t x, int16_t y, int16_t z)
|
||||
rct_track_td6* td6, uint8_t ptdOperation, bool placeScenery, Ride* ride, int16_t x, int16_t y, int16_t z)
|
||||
{
|
||||
// Previously byte_F4414E was cleared here
|
||||
_trackDesignPlaceStatePlaceScenery = placeScenery;
|
||||
@@ -1676,7 +1676,7 @@ int32_t place_virtual_track(
|
||||
{
|
||||
_trackDesignPlaceStatePlaceScenery = false;
|
||||
}
|
||||
_currentRideIndex = rideIndex;
|
||||
_currentRideIndex = ride->id;
|
||||
|
||||
gTrackPreviewMin.x = x;
|
||||
gTrackPreviewMin.y = y;
|
||||
@@ -1689,11 +1689,11 @@ int32_t place_virtual_track(
|
||||
uint8_t track_place_success = 0;
|
||||
if (td6->type == RIDE_TYPE_MAZE)
|
||||
{
|
||||
track_place_success = track_design_place_maze(td6, x, y, z, rideIndex);
|
||||
track_place_success = track_design_place_maze(td6, x, y, z, ride);
|
||||
}
|
||||
else
|
||||
{
|
||||
track_place_success = track_design_place_ride(td6, x, y, z, rideIndex);
|
||||
track_place_success = track_design_place_ride(td6, x, y, z, ride);
|
||||
}
|
||||
|
||||
// Scenery elements
|
||||
@@ -1748,7 +1748,7 @@ static bool track_design_place_preview(rct_track_td6* td6, money32* cost, uint8_
|
||||
return false;
|
||||
}
|
||||
|
||||
Ride* ride = get_ride(rideIndex);
|
||||
auto ride = get_ride(rideIndex);
|
||||
rct_string_id new_ride_name = user_string_allocate(USER_STRING_HIGH_ID_NUMBER | USER_STRING_DUPLICATION_PERMITTED, "");
|
||||
if (new_ride_name != 0)
|
||||
{
|
||||
@@ -1785,7 +1785,7 @@ static bool track_design_place_preview(rct_track_td6* td6, money32* cost, uint8_
|
||||
int32_t mapSize = gMapSize << 4;
|
||||
|
||||
_currentTrackPieceDirection = 0;
|
||||
int32_t z = place_virtual_track(td6, PTD_OPERATION_GET_PLACE_Z, true, 0, mapSize, mapSize, 16);
|
||||
int32_t z = place_virtual_track(td6, PTD_OPERATION_GET_PLACE_Z, true, get_ride(0), mapSize, mapSize, 16);
|
||||
|
||||
if (_trackDesignPlaceStateHasScenery)
|
||||
{
|
||||
@@ -1801,7 +1801,7 @@ static bool track_design_place_preview(rct_track_td6* td6, money32* cost, uint8_
|
||||
*flags |= TRACK_DESIGN_FLAG_SCENERY_UNAVAILABLE;
|
||||
}
|
||||
|
||||
money32 resultCost = place_virtual_track(td6, PTD_OPERATION_GET_COST, placeScenery, rideIndex, mapSize, mapSize, z);
|
||||
money32 resultCost = place_virtual_track(td6, PTD_OPERATION_GET_COST, placeScenery, ride, mapSize, mapSize, z);
|
||||
gParkFlags = backup_park_flags;
|
||||
|
||||
if (resultCost != MONEY32_UNDEFINED)
|
||||
@@ -1905,10 +1905,10 @@ static money32 place_track_design(int16_t x, int16_t y, int16_t z, uint8_t flags
|
||||
return MONEY32_UNDEFINED;
|
||||
}
|
||||
|
||||
Ride* ride = get_ride(rideIndex);
|
||||
auto ride = get_ride(rideIndex);
|
||||
if (ride->type == RIDE_TYPE_NULL)
|
||||
{
|
||||
log_warning("Invalid game command for track placement, ride id = %d", rideIndex);
|
||||
log_warning("Invalid game command for track placement, ride id = %d", ride->id);
|
||||
return MONEY32_UNDEFINED;
|
||||
}
|
||||
|
||||
@@ -1916,11 +1916,11 @@ static money32 place_track_design(int16_t x, int16_t y, int16_t z, uint8_t flags
|
||||
if (!(flags & GAME_COMMAND_FLAG_APPLY))
|
||||
{
|
||||
_trackDesignDontPlaceScenery = false;
|
||||
cost = place_virtual_track(td6, PTD_OPERATION_1, true, rideIndex, x, y, z);
|
||||
cost = place_virtual_track(td6, PTD_OPERATION_1, true, ride, x, y, z);
|
||||
if (_trackDesignPlaceStateSceneryUnavailable)
|
||||
{
|
||||
_trackDesignDontPlaceScenery = true;
|
||||
cost = place_virtual_track(td6, PTD_OPERATION_1, false, rideIndex, x, y, z);
|
||||
cost = place_virtual_track(td6, PTD_OPERATION_1, false, ride, x, y, z);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1935,34 +1935,34 @@ static money32 place_track_design(int16_t x, int16_t y, int16_t z, uint8_t flags
|
||||
operation = PTD_OPERATION_2;
|
||||
}
|
||||
|
||||
cost = place_virtual_track(td6, operation, !_trackDesignDontPlaceScenery, rideIndex, x, y, z);
|
||||
cost = place_virtual_track(td6, operation, !_trackDesignDontPlaceScenery, ride, x, y, z);
|
||||
}
|
||||
|
||||
if (cost == MONEY32_UNDEFINED || !(flags & GAME_COMMAND_FLAG_APPLY))
|
||||
{
|
||||
rct_string_id error_reason = gGameCommandErrorText;
|
||||
ride_action_modify(rideIndex, RIDE_MODIFY_DEMOLISH, flags);
|
||||
ride_action_modify(ride, RIDE_MODIFY_DEMOLISH, flags);
|
||||
gGameCommandErrorText = error_reason;
|
||||
gCommandExpenditureType = RCT_EXPENDITURE_TYPE_RIDE_CONSTRUCTION;
|
||||
*outRideIndex = rideIndex;
|
||||
*outRideIndex = ride->id;
|
||||
return cost;
|
||||
}
|
||||
|
||||
if (entryIndex != 0xFF)
|
||||
{
|
||||
game_do_command(0, flags | (2 << 8), 0, rideIndex | (entryIndex << 8), GAME_COMMAND_SET_RIDE_VEHICLES, 0, 0);
|
||||
game_do_command(0, flags | (2 << 8), 0, ride->id | (entryIndex << 8), GAME_COMMAND_SET_RIDE_VEHICLES, 0, 0);
|
||||
}
|
||||
|
||||
game_do_command(0, flags | (td6->ride_mode << 8), 0, rideIndex | (0 << 8), GAME_COMMAND_SET_RIDE_SETTING, 0, 0);
|
||||
game_do_command(0, flags | (0 << 8), 0, rideIndex | (td6->number_of_trains << 8), GAME_COMMAND_SET_RIDE_VEHICLES, 0, 0);
|
||||
game_do_command(0, flags | (td6->ride_mode << 8), 0, ride->id | (0 << 8), GAME_COMMAND_SET_RIDE_SETTING, 0, 0);
|
||||
game_do_command(0, flags | (0 << 8), 0, ride->id | (td6->number_of_trains << 8), GAME_COMMAND_SET_RIDE_VEHICLES, 0, 0);
|
||||
game_do_command(
|
||||
0, flags | (1 << 8), 0, rideIndex | (td6->number_of_cars_per_train << 8), GAME_COMMAND_SET_RIDE_VEHICLES, 0, 0);
|
||||
game_do_command(0, flags | (td6->depart_flags << 8), 0, rideIndex | (1 << 8), GAME_COMMAND_SET_RIDE_SETTING, 0, 0);
|
||||
game_do_command(0, flags | (td6->min_waiting_time << 8), 0, rideIndex | (2 << 8), GAME_COMMAND_SET_RIDE_SETTING, 0, 0);
|
||||
game_do_command(0, flags | (td6->max_waiting_time << 8), 0, rideIndex | (3 << 8), GAME_COMMAND_SET_RIDE_SETTING, 0, 0);
|
||||
game_do_command(0, flags | (td6->operation_setting << 8), 0, rideIndex | (4 << 8), GAME_COMMAND_SET_RIDE_SETTING, 0, 0);
|
||||
0, flags | (1 << 8), 0, ride->id | (td6->number_of_cars_per_train << 8), GAME_COMMAND_SET_RIDE_VEHICLES, 0, 0);
|
||||
game_do_command(0, flags | (td6->depart_flags << 8), 0, ride->id | (1 << 8), GAME_COMMAND_SET_RIDE_SETTING, 0, 0);
|
||||
game_do_command(0, flags | (td6->min_waiting_time << 8), 0, ride->id | (2 << 8), GAME_COMMAND_SET_RIDE_SETTING, 0, 0);
|
||||
game_do_command(0, flags | (td6->max_waiting_time << 8), 0, ride->id | (3 << 8), GAME_COMMAND_SET_RIDE_SETTING, 0, 0);
|
||||
game_do_command(0, flags | (td6->operation_setting << 8), 0, ride->id | (4 << 8), GAME_COMMAND_SET_RIDE_SETTING, 0, 0);
|
||||
game_do_command(
|
||||
0, flags | ((td6->lift_hill_speed_num_circuits & 0x1F) << 8), 0, rideIndex | (8 << 8), GAME_COMMAND_SET_RIDE_SETTING, 0,
|
||||
0, flags | ((td6->lift_hill_speed_num_circuits & 0x1F) << 8), 0, ride->id | (8 << 8), GAME_COMMAND_SET_RIDE_SETTING, 0,
|
||||
0);
|
||||
|
||||
uint8_t num_circuits = td6->lift_hill_speed_num_circuits >> 5;
|
||||
@@ -1970,9 +1970,9 @@ static money32 place_track_design(int16_t x, int16_t y, int16_t z, uint8_t flags
|
||||
{
|
||||
num_circuits = 1;
|
||||
}
|
||||
game_do_command(0, flags | (num_circuits << 8), 0, rideIndex | (9 << 8), GAME_COMMAND_SET_RIDE_SETTING, 0, 0);
|
||||
game_do_command(0, flags | (num_circuits << 8), 0, ride->id | (9 << 8), GAME_COMMAND_SET_RIDE_SETTING, 0, 0);
|
||||
|
||||
ride_set_to_default_inspection_interval(rideIndex);
|
||||
ride_set_to_default_inspection_interval(ride->id);
|
||||
ride->lifecycle_flags |= RIDE_LIFECYCLE_NOT_CUSTOM_DESIGN;
|
||||
ride->colour_scheme_type = td6->version_and_colour_scheme & 3;
|
||||
|
||||
@@ -1992,14 +1992,14 @@ static money32 place_track_design(int16_t x, int16_t y, int16_t z, uint8_t flags
|
||||
ride->vehicle_colours[i].Ternary = td6->vehicle_additional_colour[i];
|
||||
}
|
||||
|
||||
ride_set_name(rideIndex, td6->name, flags);
|
||||
ride_set_name(ride->id, td6->name, flags);
|
||||
|
||||
gCommandExpenditureType = RCT_EXPENDITURE_TYPE_RIDE_CONSTRUCTION;
|
||||
*outRideIndex = rideIndex;
|
||||
*outRideIndex = ride->id;
|
||||
return cost;
|
||||
}
|
||||
|
||||
static money32 place_maze_design(uint8_t flags, ride_id_t rideIndex, uint16_t mazeEntry, int16_t x, int16_t y, int16_t z)
|
||||
static money32 place_maze_design(uint8_t flags, Ride* ride, uint16_t mazeEntry, int16_t x, int16_t y, int16_t z)
|
||||
{
|
||||
gCommandExpenditureType = RCT_EXPENDITURE_TYPE_RIDE_CONSTRUCTION;
|
||||
gCommandPosition.x = x + 8;
|
||||
@@ -2086,8 +2086,6 @@ static money32 place_maze_design(uint8_t flags, ride_id_t rideIndex, uint16_t ma
|
||||
}
|
||||
}
|
||||
|
||||
Ride* ride = get_ride(rideIndex);
|
||||
|
||||
// Calculate price
|
||||
money32 price = 0;
|
||||
if (!(gParkFlags & PARK_FLAGS_NO_MONEY))
|
||||
@@ -2117,7 +2115,7 @@ static money32 place_maze_design(uint8_t flags, ride_id_t rideIndex, uint16_t ma
|
||||
tileElement->clearance_height = fz + 4;
|
||||
tileElement->SetType(TILE_ELEMENT_TYPE_TRACK);
|
||||
tileElement->AsTrack()->SetTrackType(TRACK_ELEM_MAZE);
|
||||
tileElement->AsTrack()->SetRideIndex(rideIndex);
|
||||
tileElement->AsTrack()->SetRideIndex(ride->id);
|
||||
tileElement->AsTrack()->SetMazeEntry(mazeEntry);
|
||||
if (flags & GAME_COMMAND_FLAG_GHOST)
|
||||
{
|
||||
@@ -2164,9 +2162,9 @@ void game_command_place_maze_design(
|
||||
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)
|
||||
{
|
||||
auto ride = get_ride(*edx & 0xFF);
|
||||
*ebx = place_maze_design(
|
||||
*ebx & 0xFF, *edx & 0xFF, ((*ebx >> 8) & 0xFF) | (((*edx >> 8) & 0xFF) << 8), *eax & 0xFFFF, *ecx & 0xFFFF,
|
||||
*edi & 0xFFFF);
|
||||
*ebx & 0xFF, ride, ((*ebx >> 8) & 0xFF) | (((*edx >> 8) & 0xFF) << 8), *eax & 0xFFFF, *ecx & 0xFFFF, *edi & 0xFFFF);
|
||||
}
|
||||
|
||||
#pragma region Track Design Preview
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
#include "../world/Map.h"
|
||||
#include "Vehicle.h"
|
||||
|
||||
struct Ride;
|
||||
|
||||
#define TRACK_PREVIEW_IMAGE_SIZE (370 * 217)
|
||||
|
||||
#pragma pack(push, 1)
|
||||
@@ -228,7 +230,7 @@ void track_design_dispose(rct_track_td6* td6);
|
||||
void track_design_mirror(rct_track_td6* td6);
|
||||
|
||||
int32_t place_virtual_track(
|
||||
rct_track_td6* td6, uint8_t ptdOperation, bool placeScenery, ride_id_t rideIndex, int16_t x, int16_t y, int16_t z);
|
||||
rct_track_td6* td6, uint8_t ptdOperation, bool placeScenery, Ride* ride, int16_t x, int16_t y, int16_t z);
|
||||
|
||||
void game_command_place_track_design(
|
||||
int32_t* eax, int32_t* ebx, int32_t* ecx, int32_t* edx, int32_t* esi, int32_t* edi, int32_t* ebp);
|
||||
|
||||
@@ -988,7 +988,7 @@ static bool track_design_save_to_td6_for_maze(ride_id_t rideIndex, rct_track_td6
|
||||
|
||||
// Save global vars as they are still used by scenery
|
||||
int16_t startZ = gTrackPreviewOrigin.z;
|
||||
place_virtual_track(td6, PTD_OPERATION_DRAW_OUTLINES, true, 0, 4096, 4096, 0);
|
||||
place_virtual_track(td6, PTD_OPERATION_DRAW_OUTLINES, true, get_ride(0), 4096, 4096, 0);
|
||||
gTrackPreviewOrigin = { startX, startY, startZ };
|
||||
|
||||
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT;
|
||||
@@ -1181,7 +1181,7 @@ static bool track_design_save_to_td6_for_tracked_ride(ride_id_t rideIndex, rct_t
|
||||
td6->entrance_elements, numEntranceElements * sizeof(rct_td6_entrance_element) + 1);
|
||||
*((uint8_t*)&td6->entrance_elements[numEntranceElements]) = 0xFF;
|
||||
|
||||
place_virtual_track(td6, PTD_OPERATION_DRAW_OUTLINES, true, 0, 4096, 4096, 0);
|
||||
place_virtual_track(td6, PTD_OPERATION_DRAW_OUTLINES, true, get_ride(0), 4096, 4096, 0);
|
||||
|
||||
// Resave global vars for scenery reasons.
|
||||
gTrackPreviewOrigin = { start_x, start_y, start_z };
|
||||
|
||||
Reference in New Issue
Block a user