1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-06 06:32:56 +01:00

Move ride_remove_peeps() to method

This commit is contained in:
Gymnasiast
2021-12-12 12:18:12 +01:00
parent 7559354d25
commit 9b81bacecd
8 changed files with 20 additions and 20 deletions

View File

@@ -124,7 +124,7 @@ GameActions::Result RideDemolishAction::DemolishRide(Ride* ride) const
money32 refundPrice = DemolishTracks();
ride_clear_for_construction(ride);
ride_remove_peeps(ride);
ride->RemovePeeps();
ride->StopGuestsQueuing();
ride->ValidateStations();

View File

@@ -142,7 +142,7 @@ GameActions::Result RideEntranceExitPlaceAction::Execute() const
if (!(GetFlags() & GAME_COMMAND_FLAG_GHOST))
{
ride_clear_for_construction(ride);
ride_remove_peeps(ride);
ride->RemovePeeps();
}
const auto location = _isExit ? ride_get_exit_location(ride, _stationNum) : ride_get_entrance_location(ride, _stationNum);

View File

@@ -120,7 +120,7 @@ GameActions::Result RideEntranceExitRemoveAction::Execute() const
if (!isGhost)
{
ride_clear_for_construction(ride);
ride_remove_peeps(ride);
ride->RemovePeeps();
invalidate_test_results(ride);
}

View File

@@ -164,7 +164,7 @@ GameActions::Result RideSetSettingAction::Execute() const
case RideSetSetting::Mode:
invalidate_test_results(ride);
ride_clear_for_construction(ride);
ride_remove_peeps(ride);
ride->RemovePeeps();
ride->mode = static_cast<RideMode>(_value);
ride->UpdateMaxVehicles();

View File

@@ -147,7 +147,7 @@ GameActions::Result RideSetStatusAction::Execute() const
{
ride->lifecycle_flags &= ~RIDE_LIFECYCLE_CRASHED;
ride_clear_for_construction(ride);
ride_remove_peeps(ride);
ride->RemovePeeps();
}
}
@@ -161,7 +161,7 @@ GameActions::Result RideSetStatusAction::Execute() const
{
ride->lifecycle_flags &= ~RIDE_LIFECYCLE_CRASHED;
ride_clear_for_construction(ride);
ride_remove_peeps(ride);
ride->RemovePeeps();
if (!ride->Test(_status, true))
{
@@ -191,7 +191,7 @@ GameActions::Result RideSetStatusAction::Execute() const
if (ride->status == RideStatus::Simulating)
{
ride_clear_for_construction(ride);
ride_remove_peeps(ride);
ride->RemovePeeps();
}
// Fix #3183: Make sure we close the construction window so the ride finishes any editing code before opening

View File

@@ -134,7 +134,7 @@ GameActions::Result RideSetVehicleAction::Execute() const
{
case RideSetVehicleType::NumTrains:
ride_clear_for_construction(ride);
ride_remove_peeps(ride);
ride->RemovePeeps();
ride->vehicle_change_timeout = 100;
ride->proposed_num_vehicles = _value;
@@ -142,7 +142,7 @@ GameActions::Result RideSetVehicleAction::Execute() const
case RideSetVehicleType::NumCarsPerTrain:
{
ride_clear_for_construction(ride);
ride_remove_peeps(ride);
ride->RemovePeeps();
ride->vehicle_change_timeout = 100;
invalidate_test_results(ride);
@@ -163,7 +163,7 @@ GameActions::Result RideSetVehicleAction::Execute() const
case RideSetVehicleType::RideEntry:
{
ride_clear_for_construction(ride);
ride_remove_peeps(ride);
ride->RemovePeeps();
ride->vehicle_change_timeout = 100;
invalidate_test_results(ride);

View File

@@ -377,6 +377,7 @@ public:
void UpdateSatisfaction(const uint8_t happiness);
void UpdatePopularity(const uint8_t pop_amount);
void RemovePeeps();
};
#pragma pack(push, 1)
@@ -1032,7 +1033,6 @@ int32_t ride_find_track_gap(const Ride* ride, CoordsXYE* input, CoordsXYE* outpu
void ride_construct_new(RideSelection listItem);
void ride_construct(Ride* ride);
bool ride_modify(CoordsXYE* input);
void ride_remove_peeps(Ride* ride);
void ride_clear_blocked_tiles(Ride* ride);
Staff* ride_get_mechanic(Ride* ride);
Staff* ride_get_assigned_mechanic(Ride* ride);

View File

@@ -249,16 +249,16 @@ void ride_clear_for_construction(Ride* ride)
*
* rct2: 0x006664DF
*/
void ride_remove_peeps(Ride* ride)
void Ride::RemovePeeps()
{
// Find first station
auto stationIndex = ride_get_first_valid_station_start(ride);
auto stationIndex = ride_get_first_valid_station_start(this);
// Get exit position and direction
auto exitPosition = CoordsXYZD{ 0, 0, 0, INVALID_DIRECTION };
if (stationIndex != STATION_INDEX_NULL)
{
auto location = ride_get_exit_location(ride, stationIndex).ToCoordsXYZD();
auto location = ride_get_exit_location(this, stationIndex).ToCoordsXYZD();
if (!location.IsNull())
{
auto direction = direction_reverse(location.direction);
@@ -280,7 +280,7 @@ void ride_remove_peeps(Ride* ride)
if (peep->State == PeepState::QueuingFront || peep->State == PeepState::EnteringRide
|| peep->State == PeepState::LeavingRide || peep->State == PeepState::OnRide)
{
if (peep->CurrentRide != ride->id)
if (peep->CurrentRide != id)
continue;
peep_decrement_num_riders(peep);
@@ -314,7 +314,7 @@ void ride_remove_peeps(Ride* ride)
{
if (peep->State == PeepState::Fixing || peep->State == PeepState::Inspecting)
{
if (peep->CurrentRide != ride->id)
if (peep->CurrentRide != id)
continue;
if (exitPosition.direction == INVALID_DIRECTION)
@@ -337,9 +337,9 @@ void ride_remove_peeps(Ride* ride)
peep->WindowInvalidateFlags |= PEEP_INVALIDATE_PEEP_STATS;
}
}
ride->num_riders = 0;
ride->slide_in_use = 0;
ride->window_invalidate_flags |= RIDE_INVALIDATE_RIDE_MAIN;
num_riders = 0;
slide_in_use = 0;
window_invalidate_flags |= RIDE_INVALIDATE_RIDE_MAIN;
}
void ride_clear_blocked_tiles(Ride* ride)
@@ -1092,7 +1092,7 @@ int32_t ride_initialise_construction_window(Ride* ride)
return 0;
ride_clear_for_construction(ride);
ride_remove_peeps(ride);
ride->RemovePeeps();
w = ride_create_or_find_construction_window(ride->id);