Skip to content

Commit 19852eb

Browse files
committed
Fix handling of Odometer up/down toggle.
Previously the change would not apply until a reset is done. Now the counter will be adjusted to match the proper reference point.
1 parent 8773ee5 commit 19852eb

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Source/Orts.Simulation/Simulation/RollingStocks/MSTSLocomotive.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5094,7 +5094,12 @@ public void OdometerToggleDirection()
50945094
if (Train == null)
50955095
return;
50965096

5097+
// change the up/down flag for the reset logic (above)
5098+
// change the forward/reverse flag for OdometerM calculation (see OdometerM get() function)
5099+
// change the reference point to match the up/down flag
50975100
OdometerCountingUp = !OdometerCountingUp;
5101+
OdometerCountingForwards = !OdometerCountingForwards;
5102+
OdometerResetPositionM = OdometerCountingUp ? OdometerResetPositionM - Train.Length : OdometerResetPositionM + Train.Length;
50985103

50995104
Simulator.Confirmer.Confirm(CabControl.Odometer, OdometerCountingUp ? CabSetting.Increase : CabSetting.Decrease);
51005105
}

0 commit comments

Comments
 (0)