Skip to content

Commit 3659982

Browse files
committed
Automatic merge of T1.5.1-689-g9d41208f0 and 18 pull requests
- Pull request #570 at c59c788: Experimental glTF 2.0 support with PBR lighting - Pull request #839 at d00beb9: First phase of https://blueprints.launchpad.net/or/+spec/additional-cruise-control-parameters - Pull request #865 at 67014b7: Dispatcher window improvements - Pull request #874 at f8dbeab: Dynamic brake controller refactoring - Pull request #875 at 43bf33e: Bug fix for https://bugs.launchpad.net/or/+bug/2036346 Player train switching doesn't work with 3D cabs - Pull request #876 at f92de76: docs: add source for documents previously on website to source Documentation folder - Pull request #878 at a088cf7: Implement Polach Adhesion - Pull request #882 at c5cdbd3: Blueprint/train car operations UI window - Pull request #883 at edcc2dd: SwitchPanel disconnect/connect handling - Pull request #885 at c81447b: feat: Add notifications to Menu - Pull request #886 at 93a5fa9: Scene viewer extension to TrackViewer - Pull request #888 at d7daf62: docs: Document player application model - Pull request #890 at 39a9fa4: Allow depart early - Pull request #892 at 1f5ba4c: Signal Function OPP_SIG_ID_TRAINPATH - Pull request #893 at bf8876b: Signal errors - Pull request #894 at 794fddf: Correct Decrease Colour - Pull request #896 at 5866028: First implementation of https://blueprints.launchpad.net/or/+spec/specific-sounds-for-ai-trains - Pull request #897 at 64a29c8: feat: Improved system information collection
20 parents 9cbe00b + 9d41208 + c59c788 + d00beb9 + 67014b7 + f8dbeab + 43bf33e + f92de76 + a088cf7 + c5cdbd3 + edcc2dd + c81447b + 93a5fa9 + d7daf62 + 39a9fa4 + 1f5ba4c + bf8876b + 794fddf + 5866028 + 64a29c8 commit 3659982

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

Source/RunActivity/Viewer3D/Popups/TrainCarOperationsWindow.cs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,9 @@ public struct ListLabel
131131
}
132132
public List<ListLabel> Labels = new List<ListLabel>();
133133

134+
public List<bool> RearBrakes = new List<bool>();
135+
public bool RefreshRestoredData = false;
136+
134137
Train PlayerTrain;
135138
int LastPlayerTrainCars;
136139
bool LastPlayerLocomotiveFlippedState;
@@ -151,6 +154,14 @@ protected internal override void Save(BinaryWriter outf)
151154
outf.Write(Location.Y);
152155
outf.Write(Location.Width);
153156
outf.Write(Location.Height);
157+
158+
// Saves brake hose state
159+
var carsCount = PlayerTrain.Cars.Count();
160+
outf.Write(carsCount);
161+
foreach (var data in RearBrakes)
162+
{
163+
outf.Write(data);
164+
}
154165
}
155166
protected internal override void Restore(BinaryReader inf)
156167
{
@@ -161,6 +172,14 @@ protected internal override void Restore(BinaryReader inf)
161172
LocationRestore.Width = inf.ReadInt32();
162173
LocationRestore.Height = inf.ReadInt32();
163174

175+
// Restores brake hose state
176+
var carsCount = inf.ReadInt32();
177+
for (int i = 0; i < carsCount; i++)
178+
{
179+
RearBrakes.Add(inf.ReadBoolean());
180+
}
181+
RefreshRestoredData = true;
182+
164183
// Display window
165184
SizeTo(LocationRestore.Width, LocationRestore.Height);
166185
MoveTo(LocationRestore.X, LocationRestore.Y);
@@ -313,6 +332,19 @@ void AddSpace()
313332
line.AddSpace(textHeight / 2, line.RemainingHeight);
314333
}
315334

335+
if (RefreshRestoredData)
336+
{ // Restores brake hose
337+
RefreshRestoredData = false;
338+
for (int i = 0; i < PlayerTrain.Cars.Count; i++)
339+
{
340+
(PlayerTrain.Cars[i] as MSTSWagon).BrakeSystem.RearBrakeHoseConnected = RearBrakes[i];
341+
}
342+
}
343+
if (RearBrakes.Count == 0)
344+
{ // Init brake hose
345+
RearBrakes = Enumerable.Repeat(true, PlayerTrain.Cars.Count).ToList();
346+
}
347+
316348
// reset WarningCarPosition
317349
WarningCarPosition = Enumerable.Repeat(false, PlayerTrain.Cars.Count).ToList();
318350

@@ -821,6 +853,7 @@ public buttonRearBrakeHose(int x, int y, int size, Viewer viewer, TrainCar car,
821853
{
822854
trainCarOperations.updateWarningCarPosition(carPosition, Texture, BrakeHoseDis);
823855
}
856+
Viewer.TrainCarOperationsWindow.RearBrakes[carPosition] = (viewer.PlayerTrain.Cars[carPosition] as MSTSWagon).BrakeSystem.RearBrakeHoseConnected;
824857
}
825858
}
826859
class buttonFrontAngleCock : Image

0 commit comments

Comments
 (0)