Skip to content

Commit e2064fc

Browse files
committed
Problems about what camera should be shown.
1 parent 0d56766 commit e2064fc

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

Source/RunActivity/Viewer3D/Popups/TrainCarOperationsViewerWindow.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ public class TrainCarOperationsViewerWindow : Window
9292
public int WindowHeightMax;
9393
public int WindowWidthMin;
9494
public int WindowWidthMax;
95+
public bool SavedCabCamera;
9596
public int windowHeight { get; set; } //required by TrainCarWindow
9697
public int CarPosition
9798
{
@@ -159,6 +160,9 @@ protected internal override void Save(BinaryWriter outf)
159160

160161
outf.Write(CarPosition);
161162
outf.Write(ResetAllSymbols);
163+
164+
var saveCabCamera = Owner.Viewer.Camera is CabCamera || Owner.Viewer.Camera == Owner.Viewer.ThreeDimCabCamera;
165+
outf.Write(saveCabCamera);
162166
}
163167
protected internal override void Restore(BinaryReader inf)
164168
{
@@ -171,6 +175,7 @@ protected internal override void Restore(BinaryReader inf)
171175

172176
CarPosition = inf.ReadInt32();
173177
ResetAllSymbols = inf.ReadBoolean();
178+
SavedCabCamera = inf.ReadBoolean();
174179

175180
// Display window
176181
SizeTo(LocationRestore.Width, LocationRestore.Height);
@@ -472,8 +477,12 @@ public override void PrepareFrame(ElapsedTime elapsedTime, bool updateFull)
472477
{
473478
// Updates CarPosition
474479
CarPosition = CouplerChanged ? NewCarPosition : CarPosition;
475-
476-
if (OldCarPosition != CarPosition || (trainCarOperations.CarIdClicked && CarPosition == 0))
480+
481+
if (SavedCabCamera)
482+
{
483+
SavedCabCamera = false;
484+
}
485+
else if (OldCarPosition != CarPosition || (trainCarOperations.CarIdClicked && CarPosition == 0))
477486
{
478487
Owner.Viewer.FrontCamera.Activate();
479488
}

0 commit comments

Comments
 (0)