mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-06 06:32:56 +01:00
Reduce duplicate code
Fix two cases of duplicated code
This commit is contained in:
committed by
Michael Steenbeek
parent
c8b5cbb3e4
commit
02474353e3
@@ -176,10 +176,7 @@ static void cheat_renew_rides()
|
||||
|
||||
FOR_ALL_RIDES(i, ride)
|
||||
{
|
||||
// Set build date to current date (so the ride is brand new)
|
||||
ride->build_date = gDateMonthsElapsed;
|
||||
// Set reliability to 100
|
||||
ride->reliability = RIDE_INITIAL_RELIABILITY;
|
||||
ride_renew(ride);
|
||||
}
|
||||
window_invalidate_by_class(WC_RIDE);
|
||||
}
|
||||
|
||||
@@ -163,8 +163,7 @@ void finance_pay_ride_upkeep()
|
||||
{
|
||||
if (!(ride->lifecycle_flags & RIDE_LIFECYCLE_EVER_BEEN_OPENED))
|
||||
{
|
||||
ride->build_date = gDateMonthsElapsed;
|
||||
ride->reliability = RIDE_INITIAL_RELIABILITY;
|
||||
ride_renew(ride);
|
||||
}
|
||||
|
||||
if (ride->status != RIDE_STATUS_CLOSED && !(gParkFlags & PARK_FLAGS_NO_MONEY))
|
||||
|
||||
@@ -6947,20 +6947,9 @@ static void ride_update_vehicle_colours(sint32 rideIndex)
|
||||
*/
|
||||
void ride_entry_get_train_layout(sint32 rideEntryIndex, sint32 numCarsPerTrain, uint8 *trainLayout)
|
||||
{
|
||||
rct_ride_entry *rideEntry = get_ride_entry(rideEntryIndex);
|
||||
|
||||
for (sint32 i = 0; i < numCarsPerTrain; i++) {
|
||||
uint8 vehicleType = rideEntry->default_vehicle;
|
||||
if (i == 0 && rideEntry->front_vehicle != 255) {
|
||||
vehicleType = rideEntry->front_vehicle;
|
||||
} else if (i == 1 && rideEntry->second_vehicle != 255) {
|
||||
vehicleType = rideEntry->second_vehicle;
|
||||
} else if (i == 2 && rideEntry->third_vehicle != 255) {
|
||||
vehicleType = rideEntry->third_vehicle;
|
||||
} else if (i == numCarsPerTrain - 1 && rideEntry->rear_vehicle != 255) {
|
||||
vehicleType = rideEntry->rear_vehicle;
|
||||
}
|
||||
trainLayout[i] = vehicleType;
|
||||
for (sint32 i = 0; i < numCarsPerTrain; i++)
|
||||
{
|
||||
trainLayout[i] = ride_entry_get_vehicle_at_position(rideEntryIndex, numCarsPerTrain, i);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7853,6 +7842,13 @@ void ride_delete(uint8 rideIndex)
|
||||
ride->type = RIDE_TYPE_NULL;
|
||||
}
|
||||
|
||||
void ride_renew(Ride * ride)
|
||||
{
|
||||
// Set build date to current date (so the ride is brand new)
|
||||
ride->build_date = gDateMonthsElapsed;
|
||||
ride->reliability = RIDE_INITIAL_RELIABILITY;
|
||||
}
|
||||
|
||||
static bool ride_is_ride(Ride * ride)
|
||||
{
|
||||
switch (ride->type) {
|
||||
|
||||
@@ -1172,6 +1172,7 @@ void window_ride_construction_do_entrance_exit_check();
|
||||
void game_command_callback_place_ride_entrance_or_exit(sint32 eax, sint32 ebx, sint32 ecx, sint32 edx, sint32 esi, sint32 edi, sint32 ebp);
|
||||
|
||||
void ride_delete(uint8 rideIndex);
|
||||
void ride_renew(Ride * ride);
|
||||
money16 ride_get_price(Ride * ride);
|
||||
|
||||
rct_tile_element *get_station_platform(sint32 x, sint32 y, sint32 z, sint32 z_tolerance);
|
||||
|
||||
Reference in New Issue
Block a user