Skip to content

Commit bdd7fb0

Browse files
committed
Automatic merge of T1.6-186-g21d9ada29 and 12 pull requests
- Pull request #1082 at b191a54: Allow variable water level in glass gauge - Pull request #1057 at 85bde8e: Switchable brake system - Pull request #1081 at a8127a1: Brake cuts power unification - Pull request #1091 at 378be55: Automatic speed control - Pull request #1122 at 73c47b4: Wagon Size and Centering Controls - Pull request #1124 at e241a0d: Built-in PBL2 brake controller - Pull request #1128 at b6c197f: Particle Emitter Overhaul - Pull request #1158 at 2599bfe: Temporary fix for bug 2121985: F9 TCO out-of-range after resume - Pull request #1169 at 906f204: Revise TrainCar.SetUpWheels to Better Handle Unusual Rolling Stock - Pull request #1175 at d28315e: Make Data Logger interval configurable - Pull request #1176 at 4cd961b: Remove Implicit Requirement for Engine Name to Come After "Engine (" - Pull request #1178 at 015769e: Fix Diesel RPM Rate of Change
14 parents 43766ce + 21d9ada + b191a54 + 85bde8e + a8127a1 + 378be55 + 73c47b4 + e241a0d + b6c197f + 2599bfe + 906f204 + d28315e + 4cd961b + 015769e commit bdd7fb0

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

Source/RunActivity/Viewer3D/Popups/TrainCarOperationsViewerWindow.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@
3131
using Orts.Simulation.RollingStocks.SubSystems.PowerSupplies;
3232
using ORTS.Common;
3333
using ORTS.Common.Input;
34+
using System;
35+
using System.Collections.Generic;
36+
using System.Diagnostics;
37+
using System.IO;
38+
using System.Linq;
3439
using Color = Microsoft.Xna.Framework.Color;
3540
using Point = Microsoft.Xna.Framework.Point;
3641
using Rectangle = Microsoft.Xna.Framework.Rectangle;
@@ -173,6 +178,12 @@ protected internal override void Save(BinaryWriter outf)
173178
outf.Write(Location.Width);
174179
outf.Write(Location.Height);
175180

181+
// rwf-rr: temporary fix for bug 2121985
182+
if (CarPosition >= Owner.Viewer.PlayerTrain.Cars.Count)
183+
{
184+
Trace.TraceWarning("TrainCarOperationsViewerWindow.CarPosition {0} out of range [0..{1}]", CarPosition, Owner.Viewer.PlayerTrain.Cars.Count - 1);
185+
CarPosition = Owner.Viewer.PlayerTrain.Cars.Count - 1;
186+
}
176187
outf.Write(CarPosition);
177188
outf.Write(ResetAllSymbols);
178189
}

Source/RunActivity/Viewer3D/Popups/TrainCarOperationsWindow.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@
3535
using System.Linq;
3636
using static Orts.Viewer3D.Popups.TrainCarOperationsWindow;
3737
using Orts.Simulation.RollingStocks.SubSystems.PowerSupplies;
38+
using Orts.Viewer3D.RollingStock;
39+
using Orts.MultiPlayer;
40+
using Orts.Viewer3D;
41+
using System.Diagnostics;
3842
using ORTS.Scripting.Api;
3943

4044
namespace Orts.Viewer3D.Popups
@@ -176,6 +180,12 @@ protected internal override void Save(BinaryWriter outf)
176180
outf.Write(Location.Width);
177181
outf.Write(Location.Height);
178182

183+
// rwf-rr: temporary fix for bug 2121985
184+
if (SelectedCarPosition >= Owner.Viewer.PlayerTrain.Cars.Count)
185+
{
186+
Trace.TraceWarning("TrainCarOperationsWindow.SelectedCarPosition {0} out of range [0..{1}]", SelectedCarPosition, Owner.Viewer.PlayerTrain.Cars.Count - 1);
187+
SelectedCarPosition = Owner.Viewer.PlayerTrain.Cars.Count - 1;
188+
}
179189
outf.Write(SelectedCarPosition);
180190
outf.Write(Owner.Viewer.FrontCamera.IsCameraFront);
181191
}
@@ -625,6 +635,13 @@ public override void PrepareFrame(ElapsedTime elapsedTime, bool updateFull)
625635
LastRowVisible = false;
626636
Layout();
627637
updateLayoutSize();
638+
639+
// rwf-rr: potential partial fix for bug 2121985
640+
// if (trainCarViewer.CouplerChanged && CarPosition >= Owner.Viewer.PlayerTrain.Cars.Count)
641+
// {
642+
// SelectedCarPosition = CarPosition = Owner.Viewer.PlayerTrain.Cars.Count - 1;
643+
// LastCarIDSelected = PlayerTrain.Cars[SelectedCarPosition].CarID;
644+
// }
628645
}
629646
if (OldPositionHeight != Vbox.Position.Height)
630647
{

Source/RunActivity/Viewer3D/WebServices/TrainCarOperationsWebpage.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,12 @@ public void handleReceiveAndSend()
232232
public void Save(BinaryWriter outf)
233233
{
234234
outf.Write(TrainCarSelected);
235+
// rwf-rr: temporary fix for bug 2121985
236+
if (TrainCarSelectedPosition >= Viewer.PlayerTrain.Cars.Count)
237+
{
238+
Trace.TraceWarning("TrainCarOperationsWebpage.TrainCarSelectedPosition {0} out of range [0..{1}]", TrainCarSelectedPosition, Viewer.PlayerTrain.Cars.Count - 1);
239+
TrainCarSelectedPosition = Viewer.PlayerTrain.Cars.Count - 1;
240+
}
235241
outf.Write(TrainCarSelectedPosition);
236242
}
237243

0 commit comments

Comments
 (0)