mirror of https://github.com/OpenRCT2/OpenRCT2.git
Move more ride functions to struct methods (#8977)
This commit is contained in:
parent
ec3d757854
commit
a50c7836f8
|
@ -134,7 +134,7 @@ public:
|
|||
ride->id = rideIndex;
|
||||
ride->type = _rideType;
|
||||
ride->subtype = rideEntryIndex;
|
||||
ride_set_colour_preset(ride, _colour1);
|
||||
ride->SetColourPreset(_colour1);
|
||||
ride->overall_view.xy = RCT_XY8_UNDEFINED;
|
||||
|
||||
// Ride name
|
||||
|
@ -301,7 +301,7 @@ public:
|
|||
ride->guests_favourite = 0;
|
||||
|
||||
ride->num_circuits = 1;
|
||||
ride->mode = ride_get_default_mode(ride);
|
||||
ride->mode = ride->GetDefaultMode();
|
||||
ride->min_max_cars_per_train = (rideEntry->min_cars_in_train << 4) | rideEntry->max_cars_in_train;
|
||||
ride_set_vehicle_colours_to_random_preset(ride, _colour2);
|
||||
window_invalidate_by_class(WC_RIDE_LIST);
|
||||
|
|
|
@ -130,7 +130,7 @@ private:
|
|||
|
||||
ride_clear_for_construction(ride);
|
||||
ride_remove_peeps(ride);
|
||||
ride_stop_peeps_queuing(ride);
|
||||
ride->StopGuestsQueuing();
|
||||
|
||||
sub_6CB945(ride);
|
||||
ride_clear_leftover_entrances(ride);
|
||||
|
|
|
@ -4569,7 +4569,7 @@ static void ride_set_start_finish_points(ride_id_t rideIndex, CoordsXYE* startEl
|
|||
break;
|
||||
}
|
||||
|
||||
if (ride_is_block_sectioned(ride) && !(ride->lifecycle_flags & RIDE_LIFECYCLE_ON_TRACK))
|
||||
if (ride->IsBlockSectioned() && !(ride->lifecycle_flags & RIDE_LIFECYCLE_ON_TRACK))
|
||||
{
|
||||
ride_set_block_points(startElement);
|
||||
}
|
||||
|
@ -4843,7 +4843,7 @@ static void vehicle_create_trains(ride_id_t rideIndex, int32_t x, int32_t y, int
|
|||
|
||||
for (int32_t vehicleIndex = 0; vehicleIndex < ride->num_vehicles; vehicleIndex++)
|
||||
{
|
||||
if (ride_is_block_sectioned(ride))
|
||||
if (ride->IsBlockSectioned())
|
||||
{
|
||||
remainingDistance = 0;
|
||||
}
|
||||
|
@ -5023,7 +5023,7 @@ static bool ride_create_vehicles(Ride* ride, CoordsXYE* element, int32_t isApply
|
|||
//
|
||||
if (ride->type != RIDE_TYPE_SPACE_RINGS && !ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_16))
|
||||
{
|
||||
if (ride_is_block_sectioned(ride))
|
||||
if (ride->IsBlockSectioned())
|
||||
{
|
||||
CoordsXYE firstBlock;
|
||||
ride_create_vehicles_find_first_block(ride, &firstBlock);
|
||||
|
@ -5776,7 +5776,7 @@ int32_t ride_get_refund_price(const Ride* ride)
|
|||
*
|
||||
* rct2: 0x00696707
|
||||
*/
|
||||
void ride_stop_peeps_queuing(Ride* ride)
|
||||
void Ride::StopGuestsQueuing()
|
||||
{
|
||||
uint16_t spriteIndex;
|
||||
Peep* peep;
|
||||
|
@ -5785,7 +5785,7 @@ void ride_stop_peeps_queuing(Ride* ride)
|
|||
{
|
||||
if (peep->state != PEEP_STATE_QUEUING)
|
||||
continue;
|
||||
if (peep->current_ride != ride->id)
|
||||
if (peep->current_ride != id)
|
||||
continue;
|
||||
|
||||
peep->RemoveFromQueue();
|
||||
|
@ -5806,14 +5806,14 @@ ride_id_t ride_get_empty_slot()
|
|||
return RIDE_ID_NULL;
|
||||
}
|
||||
|
||||
int32_t ride_get_default_mode(Ride* ride)
|
||||
uint8_t Ride::GetDefaultMode() const
|
||||
{
|
||||
const rct_ride_entry* rideEntry = get_ride_entry(ride->subtype);
|
||||
const rct_ride_entry* rideEntry = get_ride_entry(subtype);
|
||||
const uint8_t* availableModes = RideAvailableModes;
|
||||
|
||||
for (int32_t i = 0; i < ride->type; i++)
|
||||
for (int32_t i = 0; i < type; i++)
|
||||
{
|
||||
while (*(availableModes++) != 255)
|
||||
while (*(availableModes++) != RIDE_MODE_NULL)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -5894,14 +5894,14 @@ int32_t ride_get_random_colour_preset_index(uint8_t ride_type)
|
|||
*
|
||||
* Based on rct2: 0x006B4776
|
||||
*/
|
||||
void ride_set_colour_preset(Ride* ride, uint8_t index)
|
||||
void Ride::SetColourPreset(uint8_t index)
|
||||
{
|
||||
const track_colour_preset_list* colourPresets = &RideColourPresets[ride->type];
|
||||
const track_colour_preset_list* colourPresets = &RideColourPresets[type];
|
||||
TrackColour colours = { COLOUR_BLACK, COLOUR_BLACK, COLOUR_BLACK };
|
||||
// Stalls save their default colour in the vehicle settings (since they share a common ride type)
|
||||
if (!ride->IsRide())
|
||||
if (!IsRide())
|
||||
{
|
||||
auto rideEntry = get_ride_entry(ride->subtype);
|
||||
auto rideEntry = get_ride_entry(subtype);
|
||||
if (rideEntry != nullptr && rideEntry->vehicle_preset_list->count > 0)
|
||||
{
|
||||
auto list = rideEntry->vehicle_preset_list->list[0];
|
||||
|
@ -5914,11 +5914,11 @@ void ride_set_colour_preset(Ride* ride, uint8_t index)
|
|||
}
|
||||
for (int32_t i = 0; i < NUM_COLOUR_SCHEMES; i++)
|
||||
{
|
||||
ride->track_colour[i].main = colours.main;
|
||||
ride->track_colour[i].additional = colours.additional;
|
||||
ride->track_colour[i].supports = colours.supports;
|
||||
track_colour[i].main = colours.main;
|
||||
track_colour[i].additional = colours.additional;
|
||||
track_colour[i].supports = colours.supports;
|
||||
}
|
||||
ride->colour_scheme_type = 0;
|
||||
colour_scheme_type = 0;
|
||||
}
|
||||
|
||||
money32 ride_get_common_price(Ride* forRide)
|
||||
|
@ -6228,34 +6228,34 @@ int32_t get_turn_count_4_plus_elements(Ride* ride, uint8_t type)
|
|||
return ((*turn_count) & TURN_MASK_4_PLUS_ELEMENTS) >> 11;
|
||||
}
|
||||
|
||||
bool ride_has_spinning_tunnel(Ride* ride)
|
||||
bool Ride::HasSpinningTunnel() const
|
||||
{
|
||||
return ride->special_track_elements & RIDE_ELEMENT_TUNNEL_SPLASH_OR_RAPIDS;
|
||||
return special_track_elements & RIDE_ELEMENT_TUNNEL_SPLASH_OR_RAPIDS;
|
||||
}
|
||||
|
||||
bool ride_has_water_splash(Ride* ride)
|
||||
bool Ride::HasWaterSplash() const
|
||||
{
|
||||
return ride->special_track_elements & RIDE_ELEMENT_TUNNEL_SPLASH_OR_RAPIDS;
|
||||
return special_track_elements & RIDE_ELEMENT_TUNNEL_SPLASH_OR_RAPIDS;
|
||||
}
|
||||
|
||||
bool ride_has_rapids(Ride* ride)
|
||||
bool Ride::HasRapids() const
|
||||
{
|
||||
return ride->special_track_elements & RIDE_ELEMENT_TUNNEL_SPLASH_OR_RAPIDS;
|
||||
return special_track_elements & RIDE_ELEMENT_TUNNEL_SPLASH_OR_RAPIDS;
|
||||
}
|
||||
|
||||
bool ride_has_log_reverser(Ride* ride)
|
||||
bool Ride::HasLogReverser() const
|
||||
{
|
||||
return ride->special_track_elements & RIDE_ELEMENT_REVERSER_OR_WATERFALL;
|
||||
return special_track_elements & RIDE_ELEMENT_REVERSER_OR_WATERFALL;
|
||||
}
|
||||
|
||||
bool ride_has_waterfall(Ride* ride)
|
||||
bool Ride::HasWaterfall() const
|
||||
{
|
||||
return ride->special_track_elements & RIDE_ELEMENT_REVERSER_OR_WATERFALL;
|
||||
return special_track_elements & RIDE_ELEMENT_REVERSER_OR_WATERFALL;
|
||||
}
|
||||
|
||||
bool ride_has_whirlpool(Ride* ride)
|
||||
bool Ride::HasWhirlpool() const
|
||||
{
|
||||
return ride->special_track_elements & RIDE_ELEMENT_WHIRLPOOL;
|
||||
return special_track_elements & RIDE_ELEMENT_WHIRLPOOL;
|
||||
}
|
||||
|
||||
uint8_t ride_get_helix_sections(Ride* ride)
|
||||
|
@ -6264,15 +6264,15 @@ uint8_t ride_get_helix_sections(Ride* ride)
|
|||
return ride->special_track_elements & 0x1F;
|
||||
}
|
||||
|
||||
bool ride_is_powered_launched(Ride* ride)
|
||||
bool Ride::IsPoweredLaunched() const
|
||||
{
|
||||
return ride->mode == RIDE_MODE_POWERED_LAUNCH_PASSTROUGH || ride->mode == RIDE_MODE_POWERED_LAUNCH
|
||||
|| ride->mode == RIDE_MODE_POWERED_LAUNCH_BLOCK_SECTIONED;
|
||||
return mode == RIDE_MODE_POWERED_LAUNCH_PASSTROUGH || mode == RIDE_MODE_POWERED_LAUNCH
|
||||
|| mode == RIDE_MODE_POWERED_LAUNCH_BLOCK_SECTIONED;
|
||||
}
|
||||
|
||||
bool ride_is_block_sectioned(Ride* ride)
|
||||
bool Ride::IsBlockSectioned() const
|
||||
{
|
||||
return ride->mode == RIDE_MODE_CONTINUOUS_CIRCUIT_BLOCK_SECTIONED || ride->mode == RIDE_MODE_POWERED_LAUNCH_BLOCK_SECTIONED;
|
||||
return mode == RIDE_MODE_CONTINUOUS_CIRCUIT_BLOCK_SECTIONED || mode == RIDE_MODE_POWERED_LAUNCH_BLOCK_SECTIONED;
|
||||
}
|
||||
|
||||
bool ride_has_any_track_elements(const Ride* ride)
|
||||
|
|
|
@ -364,6 +364,22 @@ struct Ride
|
|||
void SetNumVehicles(int32_t numVehicles);
|
||||
void SetNumCarsPerVehicle(int32_t numCarsPerVehicle);
|
||||
void UpdateMaxVehicles();
|
||||
|
||||
bool HasSpinningTunnel() const;
|
||||
bool HasWaterSplash() const;
|
||||
bool HasRapids() const;
|
||||
bool HasLogReverser() const;
|
||||
bool HasWaterfall() const;
|
||||
bool HasWhirlpool() const;
|
||||
|
||||
bool IsPoweredLaunched() const;
|
||||
bool IsBlockSectioned() const;
|
||||
|
||||
void StopGuestsQueuing();
|
||||
|
||||
uint8_t GetDefaultMode() const;
|
||||
|
||||
void SetColourPreset(uint8_t index);
|
||||
};
|
||||
|
||||
#pragma pack(push, 1)
|
||||
|
@ -638,7 +654,10 @@ enum
|
|||
RIDE_MODE_FREEFALL_DROP,
|
||||
RIDE_MODE_CONTINUOUS_CIRCUIT_BLOCK_SECTIONED,
|
||||
RIDE_MODE_POWERED_LAUNCH, // RCT1 style, don't pass through station
|
||||
RIDE_MODE_POWERED_LAUNCH_BLOCK_SECTIONED
|
||||
RIDE_MODE_POWERED_LAUNCH_BLOCK_SECTIONED,
|
||||
|
||||
RIDE_MOUNT_COUNT,
|
||||
RIDE_MODE_NULL = 255,
|
||||
};
|
||||
|
||||
enum
|
||||
|
@ -1005,7 +1024,6 @@ extern bool gGotoStartPlacementMode;
|
|||
extern uint8_t gLastEntranceStyle;
|
||||
|
||||
ride_id_t ride_get_empty_slot();
|
||||
int32_t ride_get_default_mode(Ride* ride);
|
||||
int32_t ride_get_count();
|
||||
int32_t ride_get_total_queue_length(Ride* ride);
|
||||
int32_t ride_get_max_queue_time(Ride* ride);
|
||||
|
@ -1065,7 +1083,6 @@ void game_command_set_ride_name(
|
|||
int32_t* eax, int32_t* ebx, int32_t* ecx, int32_t* edx, int32_t* esi, int32_t* edi, int32_t* ebp);
|
||||
int32_t ride_get_refund_price(const Ride* ride);
|
||||
int32_t ride_get_random_colour_preset_index(uint8_t ride_type);
|
||||
void ride_set_colour_preset(Ride* ride, uint8_t index);
|
||||
money32 ride_get_common_price(Ride* forRide);
|
||||
rct_ride_name get_ride_naming(const uint8_t rideType, rct_ride_entry* rideEntry);
|
||||
void game_command_create_ride(int32_t* eax, int32_t* ebx, int32_t* ecx, int32_t* edx, int32_t* esi, int32_t* edi, int32_t* ebp);
|
||||
|
@ -1098,16 +1115,8 @@ int32_t get_turn_count_3_elements(Ride* ride, uint8_t type);
|
|||
int32_t get_turn_count_4_plus_elements(Ride* ride, uint8_t type);
|
||||
|
||||
uint8_t ride_get_helix_sections(Ride* ride);
|
||||
bool ride_has_spinning_tunnel(Ride* ride);
|
||||
bool ride_has_water_splash(Ride* ride);
|
||||
bool ride_has_rapids(Ride* ride);
|
||||
bool ride_has_log_reverser(Ride* ride);
|
||||
bool ride_has_waterfall(Ride* ride);
|
||||
bool ride_has_whirlpool(Ride* ride);
|
||||
|
||||
bool ride_type_has_flag(int32_t rideType, uint32_t flag);
|
||||
bool ride_is_powered_launched(Ride* ride);
|
||||
bool ride_is_block_sectioned(Ride* ride);
|
||||
bool ride_has_any_track_elements(const Ride* ride);
|
||||
void ride_all_has_any_track_elements(bool* rideIndexArray);
|
||||
|
||||
|
@ -1188,7 +1197,6 @@ 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* ride, int32_t modifyType, int32_t flags);
|
||||
void ride_stop_peeps_queuing(Ride* ride);
|
||||
|
||||
LocationXY16 ride_get_rotated_coords(int16_t x, int16_t y, int16_t z);
|
||||
|
||||
|
|
|
@ -1181,7 +1181,7 @@ static rating_tuple get_special_track_elements_rating(uint8_t type, Ride* ride)
|
|||
int32_t excitement = 0, intensity = 0, nausea = 0;
|
||||
if (type == RIDE_TYPE_GHOST_TRAIN)
|
||||
{
|
||||
if (ride_has_spinning_tunnel(ride))
|
||||
if (ride->HasSpinningTunnel())
|
||||
{
|
||||
excitement += 40;
|
||||
intensity += 25;
|
||||
|
@ -1190,8 +1190,7 @@ static rating_tuple get_special_track_elements_rating(uint8_t type, Ride* ride)
|
|||
}
|
||||
else if (type == RIDE_TYPE_LOG_FLUME)
|
||||
{
|
||||
// Reverser for log flume
|
||||
if (ride_has_log_reverser(ride))
|
||||
if (ride->HasLogReverser())
|
||||
{
|
||||
excitement += 48;
|
||||
intensity += 55;
|
||||
|
@ -1200,18 +1199,18 @@ static rating_tuple get_special_track_elements_rating(uint8_t type, Ride* ride)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (ride_has_water_splash(ride))
|
||||
if (ride->HasWaterSplash())
|
||||
{
|
||||
excitement += 50;
|
||||
intensity += 30;
|
||||
nausea += 20;
|
||||
}
|
||||
if (ride_has_waterfall(ride))
|
||||
if (ride->HasWaterfall())
|
||||
{
|
||||
excitement += 55;
|
||||
intensity += 30;
|
||||
}
|
||||
if (ride_has_whirlpool(ride))
|
||||
if (ride->HasWhirlpool())
|
||||
{
|
||||
excitement += 35;
|
||||
intensity += 20;
|
||||
|
@ -2254,7 +2253,7 @@ static void ride_ratings_calculate_looping_roller_coaster(Ride* ride)
|
|||
if (!(ride->lifecycle_flags & RIDE_LIFECYCLE_TESTED))
|
||||
return;
|
||||
|
||||
ride->unreliability_factor = ride_is_powered_launched(ride) ? 20 : 15;
|
||||
ride->unreliability_factor = ride->IsPoweredLaunched() ? 20 : 15;
|
||||
set_unreliability_factor(ride);
|
||||
|
||||
rating_tuple ratings;
|
||||
|
|
|
@ -2906,7 +2906,7 @@ static bool vehicle_can_depart_synchronised(rct_vehicle* vehicle)
|
|||
{
|
||||
if (sv_ride->status != RIDE_STATUS_CLOSED)
|
||||
{
|
||||
if (ride_is_block_sectioned(sv_ride))
|
||||
if (sv_ride->IsBlockSectioned())
|
||||
{
|
||||
if (!(sv_ride->stations[sv->station_id].Depart & STATION_DEPART_FLAG))
|
||||
{
|
||||
|
@ -6655,7 +6655,7 @@ static void check_and_apply_block_section_stop_site(rct_vehicle* vehicle)
|
|||
switch (trackType)
|
||||
{
|
||||
case TRACK_ELEM_BLOCK_BRAKES:
|
||||
if (ride_is_block_sectioned(ride))
|
||||
if (ride->IsBlockSectioned())
|
||||
apply_block_brakes(vehicle, trackElement->AsTrack()->BlockBrakeClosed());
|
||||
else
|
||||
apply_non_stop_block_brake(vehicle, true);
|
||||
|
@ -6671,7 +6671,7 @@ static void check_and_apply_block_section_stop_site(rct_vehicle* vehicle)
|
|||
case TRACK_ELEM_CABLE_LIFT_HILL:
|
||||
case TRACK_ELEM_DIAG_25_DEG_UP_TO_FLAT:
|
||||
case TRACK_ELEM_DIAG_60_DEG_UP_TO_FLAT:
|
||||
if (ride_is_block_sectioned(ride))
|
||||
if (ride->IsBlockSectioned())
|
||||
{
|
||||
if (trackType == TRACK_ELEM_CABLE_LIFT_HILL || trackElement->AsTrack()->HasChain())
|
||||
{
|
||||
|
@ -6774,7 +6774,7 @@ static void vehicle_update_block_brakes_open_previous_section(rct_vehicle* vehic
|
|||
if (trackType == TRACK_ELEM_BLOCK_BRAKES || trackType == TRACK_ELEM_END_STATION)
|
||||
{
|
||||
Ride* ride = get_ride(vehicle->ride);
|
||||
if (ride_is_block_sectioned(ride))
|
||||
if (ride->IsBlockSectioned())
|
||||
{
|
||||
audio_play_sound_at_location(SOUND_48, x, y, z);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue