From f4180e87145afc1683ec02b4167f2872ca15baaa Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Sat, 19 Jan 2019 19:07:15 +0000 Subject: [PATCH] Check vehicle sound setting before motion/tick counts in CallVehicleTicks --- src/vehicle.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/vehicle.cpp b/src/vehicle.cpp index 4c95d29567..25314cdb79 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -1214,14 +1214,16 @@ void CallVehicleTicks() } v->motion_counter += front->cur_speed; - /* Play a running sound if the motion counter passes 256 (Do we not skip sounds?) */ - if (GB(v->motion_counter, 0, 8) < front->cur_speed) PlayVehicleSound(v, VSE_RUNNING); - - /* Play an alternating running sound every 16 ticks */ - if (GB(v->tick_counter, 0, 4) == 0) { - /* Play running sound when speed > 0 and not braking */ - bool running = (front->cur_speed > 0) && !(front->vehstatus & (VS_STOPPED | VS_TRAIN_SLOWING)); - PlayVehicleSound(v, running ? VSE_RUNNING_16 : VSE_STOPPED_16); + if (_settings_client.sound.vehicle) { + /* Play a running sound if the motion counter passes 256 (Do we not skip sounds?) */ + if (GB(v->motion_counter, 0, 8) < front->cur_speed) PlayVehicleSound(v, VSE_RUNNING); + + /* Play an alternating running sound every 16 ticks */ + if (GB(v->tick_counter, 0, 4) == 0) { + /* Play running sound when speed > 0 and not braking */ + bool running = (front->cur_speed > 0) && !(front->vehstatus & (VS_STOPPED | VS_TRAIN_SLOWING)); + PlayVehicleSound(v, running ? VSE_RUNNING_16 : VSE_STOPPED_16); + } } break;