Skip to content

Commit 4d79756

Browse files
committed
Cleanup fix
1 parent 9664141 commit 4d79756

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Source/Orts.Simulation/Simulation/AIs/AI.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1330,7 +1330,7 @@ private void RemoveTrains()
13301330
car.IsPartOfActiveTrain = false; // to stop sounds
13311331
// remove continers if any
13321332
if (car.FreightAnimations?.Animations != null)
1333-
car.FreightAnimations?.RemoveDiscreteFreightAnimations(car as MSTSWagon);
1333+
car.FreightAnimations?.RemoveLoads();
13341334
}
13351335
}
13361336
}

Source/Orts.Simulation/Simulation/RollingStocks/SubSystems/FreightAnimations.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -865,16 +865,16 @@ public bool CheckForMerge(int i)
865865
}
866866

867867
/// <summary>
868-
/// Removes discrete freight animations and containers when AI train is deleted
868+
/// Removes loads (e.g. containers) when AI train is deleted
869869
/// </summary>
870870

871-
public void RemoveDiscreteFreightAnimations(MSTSWagon wagon)
871+
public void RemoveLoads()
872872
{
873873
foreach (var animation in Animations)
874874
{
875875
if (animation is FreightAnimationDiscrete discreteAnimation && discreteAnimation.Container != null)
876876
{
877-
wagon.Simulator.ContainerManager.Containers.Remove(discreteAnimation.Container);
877+
Wagon.Simulator.ContainerManager.Containers.Remove(discreteAnimation.Container);
878878
}
879879
}
880880

0 commit comments

Comments
 (0)