diff --git a/src/openrct2/ride/Vehicle.cpp b/src/openrct2/ride/Vehicle.cpp index 1bea889d30..3a761863fb 100644 --- a/src/openrct2/ride/Vehicle.cpp +++ b/src/openrct2/ride/Vehicle.cpp @@ -3593,7 +3593,7 @@ void Vehicle::UpdateCrashSetup() } SetState(VEHICLE_STATUS_CRASHING, sub_state); - if (vehicle_get_total_num_peeps(this) != 0) + if (NumPeepsUntilTrainTail() != 0) { audio_play_sound_at_location(SoundId::HauntedHouseScream2, { x, y, z }); } @@ -5572,7 +5572,7 @@ SoundId Vehicle::UpdateScreamSound() rct_ride_entry_vehicle* vehicleEntry = &rideEntry->vehicles[vehicle_type]; - int32_t totalNumPeeps = vehicle_get_total_num_peeps(this); + int32_t totalNumPeeps = NumPeepsUntilTrainTail(); if (totalNumPeeps == 0) return SoundId::Null; @@ -9785,8 +9785,9 @@ rct_ride_entry_vehicle* Vehicle::Entry() const return &rideEntry->vehicles[vehicle_type]; } -int32_t vehicle_get_total_num_peeps(const Vehicle* vehicle) +int32_t Vehicle::NumPeepsUntilTrainTail() const { + const Vehicle* vehicle = this; uint16_t spriteIndex; int32_t numPeeps = 0; for (;;) diff --git a/src/openrct2/ride/Vehicle.h b/src/openrct2/ride/Vehicle.h index 780ab6fd05..bad690b4ff 100644 --- a/src/openrct2/ride/Vehicle.h +++ b/src/openrct2/ride/Vehicle.h @@ -360,6 +360,7 @@ private: bool CurrentTowerElementIsTop(); bool UpdateTrackMotionForwards(rct_ride_entry_vehicle* vehicleEntry, Ride* curRide, rct_ride_entry* rideEntry); bool UpdateTrackMotionBackwards(rct_ride_entry_vehicle* vehicleEntry, Ride* curRide, rct_ride_entry* rideEntry); + int32_t NumPeepsUntilTrainTail() const; void InvalidateWindow(); void TestReset(); void UpdateTestFinish(); @@ -562,7 +563,6 @@ void vehicle_sounds_update(); GForces vehicle_get_g_forces(const Vehicle* vehicle); void vehicle_set_map_toolbar(const Vehicle* vehicle); int32_t vehicle_is_used_in_pairs(const Vehicle* vehicle); -int32_t vehicle_get_total_num_peeps(const Vehicle* vehicle); const rct_vehicle_info* vehicle_get_move_info(int32_t trackSubposition, int32_t typeAndDirection, int32_t offset); uint16_t vehicle_get_move_info_size(int32_t trackSubposition, int32_t typeAndDirection);