Skip to content

Commit f0aa649

Browse files
Fix on previous fix
1 parent 1828d97 commit f0aa649

File tree

2 files changed

+4
-23
lines changed

2 files changed

+4
-23
lines changed

Source/Orts.Simulation/Simulation/Simulator.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1818,8 +1818,12 @@ public void UncoupleBehind(TrainCar car, bool keepFront)
18181818

18191819
train.UncoupledFrom = train2;
18201820
train2.UncoupledFrom = train;
1821+
18211822
train2.SpeedMpS = train.SpeedMpS;
1823+
1824+
train.Cars[train.Cars.Count - 1].BrakeSystem.RearBrakeHoseConnected = false;
18221825
train2.Cars[0].BrakeSystem.FrontBrakeHoseConnected = false;
1826+
18231827
train2.AITrainDirectionForward = train.AITrainDirectionForward;
18241828

18251829
// It is an action, not just a simple copy, thus don't do it if the train is driven by the player:

Source/RunActivity/Viewer3D/Popups/TrainCarOperationsWindow.cs

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ public class TrainCarOperationsWindow : Window
8383
public int SeparatorCount;
8484
public int SpacerRowCount;
8585
public int SymbolsRowCount;
86-
public bool BrakeHoseCarCoupling;
8786

8887
public ControlLayout Client;
8988
public bool CarPositionChanged;
@@ -500,8 +499,6 @@ void AddSpace()
500499
// Allows to resize the window according to the carPosition value.
501500
if (RowsCount > carPosition) RowsCount = carPosition;
502501
if (SeparatorCount > carPosition -1) SeparatorCount = carPosition - 1;
503-
504-
BrakeHoseCarCoupling = false;// All brake hoses checked
505502
}
506503
}
507504
return Vbox;
@@ -606,11 +603,6 @@ public override void PrepareFrame(ElapsedTime elapsedTime, bool updateFull)
606603
PlayerTrain = Owner.Viewer.PlayerTrain;
607604
if (LastPlayerTrainCars != Owner.Viewer.PlayerTrain.Cars.Count || !LayoutUpdated)
608605
{
609-
// Updates brake hoses
610-
if (LastPlayerTrainCars > 0 && PlayerTrain.Cars.Count > LastPlayerTrainCars && ((PlayerTrain.Cars[LastPlayerTrainCars] as MSTSWagon).BrakeSystem.FrontBrakeHoseConnected != (PlayerTrain.Cars[LastPlayerTrainCars - 1] as MSTSWagon).BrakeSystem.RearBrakeHoseConnected))
611-
{
612-
BrakeHoseCarCoupling = true;// Enable to check all brake hoses when coupling cars
613-
}
614606
LayoutUpdated = true;
615607
Layout();
616608
localScrollLayout(SelectedCarPosition);
@@ -846,25 +838,10 @@ public buttonFrontBrakeHose(int x, int y, int size, Viewer viewer, TrainCar car,
846838
{
847839
Viewer = viewer;
848840
TrainCarViewer = Viewer.TrainCarOperationsViewerWindow;
849-
TrainCarOperations = Viewer.TrainCarOperationsWindow;
850841
CarOperations = Viewer.CarOperationsWindow;
851-
var PlayerTrain = Viewer.PlayerTrain;
852842

853843
CarPosition = carPosition;
854844
First = car == viewer.PlayerTrain.Cars.First();
855-
if (CarPosition > 0 && TrainCarOperations.BrakeHoseCarCoupling)
856-
{ // Sometimes when coupling cars. The front brake hose of the new car and the brake hose of the previous car are not synchronised.
857-
var frontBrakeHoseCurrentCar = (PlayerTrain.Cars[CarPosition] as MSTSWagon).BrakeSystem.FrontBrakeHoseConnected;
858-
var rearBrakeHosePreviousCar = (PlayerTrain.Cars[CarPosition - 1] as MSTSWagon).BrakeSystem.RearBrakeHoseConnected;
859-
if (frontBrakeHoseCurrentCar && !rearBrakeHosePreviousCar)
860-
{
861-
new WagonBrakeHoseConnectCommand(Viewer.Log, (PlayerTrain.Cars[CarPosition] as MSTSWagon), !(PlayerTrain.Cars[CarPosition] as MSTSWagon).BrakeSystem.FrontBrakeHoseConnected);
862-
}
863-
else if (!frontBrakeHoseCurrentCar && rearBrakeHosePreviousCar)
864-
{
865-
new WagonBrakeHoseRearConnectCommand(Viewer.Log, (PlayerTrain.Cars[CarPosition - 1] as MSTSWagon), !(PlayerTrain.Cars[CarPosition - 1] as MSTSWagon).BrakeSystem.RearBrakeHoseConnected);
866-
}
867-
}
868845
Texture = First ? BrakeHoseFirstDis : (viewer.PlayerTrain.Cars[carPosition] as MSTSWagon).BrakeSystem.FrontBrakeHoseConnected ? BrakeHoseCon : BrakeHoseDis;
869846

870847
// Allows compatibility with CarOperationWindow

0 commit comments

Comments
 (0)