Skip to content

Commit 8a757ce

Browse files
authored
Merge pull request #1140 from SteelFill/control_animation_fix
Fix Cabview Animation Edge Case
2 parents e0e6817 + e088778 commit 8a757ce

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

Source/Orts.Formats.Msts/CabViewFile.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1150,9 +1150,10 @@ public CVCDiscrete(STFReader stf, string basepath, DiscreteStates discreteState)
11501150
if (Positions.Count > 0 && Positions[0] > Positions[Positions.Count - 1])
11511151
{
11521152
Reversed ^= true;
1153+
int maxPos = Positions.Max();
11531154
// Recalculate positions in reverse
11541155
for (int i = 0; i < Positions.Count; i++)
1155-
Positions[i] = (FramesCount - 1) - Positions[i];
1156+
Positions[i] = maxPos - Positions[i];
11561157
}
11571158

11581159
// Check if eligible for filling

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4191,7 +4191,7 @@ public void StartThrottleToZero(float? target)
41914191
/// Returns the position of the throttle handle considering
41924192
/// whether it is used for cruise control or not
41934193
/// </summary>
4194-
/// <param name="intermediateValue">Whather asking for intermediate (for mouse operation) or notched (for displaying) value.</param>
4194+
/// <param name="intermediateValue">Whether asking for intermediate (for mouse operation) or notched (for displaying) value.</param>
41954195
/// <returns>Position into 0-1 range</returns>
41964196
public float GetThrottleHandleValue(bool intermediateValue)
41974197
{
@@ -4203,7 +4203,7 @@ public float GetThrottleHandleValue(bool intermediateValue)
42034203
if (CruiseControl?.SpeedRegMode == CruiseControl.SpeedRegulatorMode.Auto && CruiseControl.UseThrottleAsSpeedSelector)
42044204
return CruiseControl.SelectedSpeedMpS / MaxSpeedMpS;
42054205

4206-
return intermediateValue ? ThrottleController.CurrentValue : ThrottleController.IntermediateValue;
4206+
return intermediateValue ? ThrottleController.IntermediateValue : ThrottleController.CurrentValue;
42074207
}
42084208

42094209
#endregion

0 commit comments

Comments
 (0)