Skip to content

Commit 03c6f8f

Browse files
set SelectedCarPosition to zero when uncoupling
1 parent b47224d commit 03c6f8f

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

Source/RunActivity/Viewer3D/WebServices/TrainCarOperationsWebpage.cs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@
3131
using Orts.Simulation.RollingStocks.SubSystems.Brakes.MSTS;
3232
using ORTS.Scripting.Api;
3333
using System.IO;
34-
using Orts.Simulation.Physics;
35-
using Orts.Simulation.RollingStocks.SubSystems.Brakes;
3634

3735
namespace Orts.Viewer3D.WebServices
3836
{
@@ -710,10 +708,7 @@ public void buttonCouplerFrontClick(int carPosition)
710708
TrainCarViewer.NewCarPosition = carPosition - 1;
711709
if (Viewer.CarOperationsWindow.CarPosition > carPosition - 1)
712710
Viewer.CarOperationsWindow.Visible = false;
713-
if (Viewer.TrainCarOperationsWindow.SelectedCarPosition >= Viewer.PlayerTrain.Cars.Count())
714-
{
715-
Viewer.TrainCarOperationsWindow.SelectedCarPosition = Viewer.PlayerTrain.Cars.Count - 1;
716-
}
711+
Viewer.TrainCarOperationsWindow.SelectedCarPosition = 0;
717712
}
718713
}
719714

@@ -812,10 +807,7 @@ public void buttonCouplerRearClick(int carPosition)
812807
TrainCarViewer.CouplerChanged = true;
813808
if (Viewer.CarOperationsWindow.CarPosition > carPosition)
814809
Viewer.CarOperationsWindow.Visible = false;
815-
if (Viewer.TrainCarOperationsWindow.SelectedCarPosition >= Viewer.PlayerTrain.Cars.Count())
816-
{
817-
Viewer.TrainCarOperationsWindow.SelectedCarPosition = Viewer.PlayerTrain.Cars.Count - 1;
818-
}
810+
Viewer.TrainCarOperationsWindow.SelectedCarPosition = 0;
819811
}
820812
}
821813

0 commit comments

Comments
 (0)