Skip to content

Commit

Permalink
Fix #12497: [NewGRF] Increase vehicle motion counter for all parts. (#…
Browse files Browse the repository at this point in the history
…12561)

NewGRFs relied on the incorrectly motion counter that was 'fixed' in #12229, so always update v->motion_counter for all vehicle parts.
  • Loading branch information
PeterN committed May 17, 2024
1 parent c854815 commit 8d26d03
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/vehicle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1033,6 +1033,9 @@ void CallVehicleTicks()
/* Do not play any sound when stopped */
if ((front->vehstatus & VS_STOPPED) && (front->type != VEH_TRAIN || front->cur_speed == 0)) continue;

/* Update motion counter for animation purposes. */
v->motion_counter += front->cur_speed;

/* Check vehicle type specifics */
switch (v->type) {
case VEH_TRAIN:
Expand All @@ -1051,7 +1054,6 @@ void CallVehicleTicks()
break;
}

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);

Expand Down

0 comments on commit 8d26d03

Please sign in to comment.