From 55aae04ff510b6e5741ba1acb727c0b69334497b Mon Sep 17 00:00:00 2001 From: hdpoliveira Date: Sun, 19 Apr 2020 21:49:24 -0300 Subject: [PATCH] Part of #9473: Create Vehicle::Claxon Converted from vehicle_claxon --- src/openrct2/ride/Vehicle.cpp | 14 ++++++-------- src/openrct2/ride/Vehicle.h | 1 + 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/openrct2/ride/Vehicle.cpp b/src/openrct2/ride/Vehicle.cpp index 2d67e32013..c313b6cf8b 100644 --- a/src/openrct2/ride/Vehicle.cpp +++ b/src/openrct2/ride/Vehicle.cpp @@ -45,8 +45,6 @@ #include #include -static void vehicle_claxon(const Vehicle* vehicle); - static bool vehicle_boat_is_location_accessible(const CoordsXYZ& location); static bool vehicle_update_motion_collision_detection( Vehicle* vehicle, int16_t x, int16_t y, int16_t z, uint16_t* otherVehicleIndex); @@ -9869,7 +9867,7 @@ void Vehicle::UpdateCrossings() const { if (!playedClaxon && !pathElement->IsBlockedByVehicle()) { - vehicle_claxon(this); + Claxon(); } crossingBonus = 4; pathElement->SetIsBlockedByVehicle(true); @@ -9942,16 +9940,16 @@ void Vehicle::UpdateCrossings() const } } -void vehicle_claxon(const Vehicle* vehicle) +void Vehicle::Claxon() const { - rct_ride_entry* rideEntry = get_ride_entry(vehicle->ride_subtype); - switch (rideEntry->vehicles[vehicle->vehicle_type].sound_range) + rct_ride_entry* rideEntry = get_ride_entry(ride_subtype); + switch (rideEntry->vehicles[vehicle_type].sound_range) { case SOUND_RANGE_WHISTLE: - audio_play_sound_at_location(SoundId::TrainWhistle, { vehicle->x, vehicle->y, vehicle->z }); + audio_play_sound_at_location(SoundId::TrainWhistle, { x, y, z }); break; case SOUND_RANGE_BELL: - audio_play_sound_at_location(SoundId::Tram, { vehicle->x, vehicle->y, vehicle->z }); + audio_play_sound_at_location(SoundId::Tram, { x, y, z }); break; } } diff --git a/src/openrct2/ride/Vehicle.h b/src/openrct2/ride/Vehicle.h index fc7d1069ba..eef016ae39 100644 --- a/src/openrct2/ride/Vehicle.h +++ b/src/openrct2/ride/Vehicle.h @@ -378,6 +378,7 @@ private: void ReverseReverserCar(); void UpdateReverserCarBogies(); void UpdateHandleWaterSplash() const; + void Claxon() const; }; struct train_ref