@@ -70,19 +70,18 @@ public class TrainCarOperationsViewerWindow : Window
7070 internal static Texture2D RearAngleCockOpened ;
7171 internal static Texture2D RearAngleCockClosed ;
7272
73- public int WindowHeightMin = 0 ;
74- public int WindowHeightMax = 0 ;
75- public int WindowWidthMin = 0 ;
76- public int WindowWidthMax = 0 ;
73+ public int WindowHeightMin ;
74+ public int WindowHeightMax ;
75+ public int WindowWidthMin ;
76+ public int WindowWidthMax ;
7777 public string powerSupplyStatus ;
7878 public string batteryStatus ;
7979 string circuitBreakerState ;
80- public int spacerRowCount = 0 ;
81- public int symbolsRowCount = 0 ;
82- public int locoRowCount = 0 ;
83- public int rowsCount = 0 ;
80+ public int spacerRowCount ;
81+ public int symbolsRowCount ;
82+ public int locoRowCount ;
83+ public int rowsCount ;
8484 const int SymbolWidth = 32 ;
85- public string symbolClicked = "" ;
8685
8786 public static bool FontChanged ;
8887 public static bool FontToBold ;
@@ -125,12 +124,12 @@ public struct ListLabel
125124 bool LastPlayerLocomotiveFlippedState ;
126125 int carPosition ;
127126 public TrainCarOperationsViewerWindow ( WindowManager owner )
128- : base ( owner , Window . DecorationSize . X + CarListPadding + ( owner . TextFontDefault . Height + 12 ) * 20 , Window . DecorationSize . Y + ( owner . TextFontDefault . Height + 12 ) * 2 , Viewer . Catalog . GetString ( "Train Operations Viewer" ) )
127+ : base ( owner , Window . DecorationSize . X + CarListPadding + ( ( owner . TextFontDefault . Height + 12 ) * 20 ) , Window . DecorationSize . Y + ( ( owner . TextFontDefault . Height + 12 ) * 2 ) , Viewer . Catalog . GetString ( "Train Operations Viewer" ) )
129128 {
130129 WindowHeightMin = Location . Height ;
131- WindowHeightMax = Location . Height + owner . TextFontDefault . Height * 20 ;
130+ WindowHeightMax = Location . Height + ( owner . TextFontDefault . Height * 20 ) ;
132131 WindowWidthMin = Location . Width ;
133- WindowWidthMax = Location . Width + owner . TextFontDefault . Height * 20 ;
132+ WindowWidthMax = Location . Width + ( owner . TextFontDefault . Height * 20 ) ;
134133 }
135134
136135 protected internal override void Save ( BinaryWriter outf )
@@ -229,7 +228,7 @@ private void ModifyWindowSize()
229228 var newWidth = ( int ) MathHelper . Clamp ( desiredWidth , 100 , WindowWidthMax ) ;
230229
231230 // Move the dialog up if we're expanding it, or down if not; this keeps the center in the same place.
232- var newTop = Location . Y + ( Location . Height - newHeight ) / 2 ;
231+ var newTop = Location . Y + ( ( Location . Height - newHeight ) / 2 ) ;
233232
234233 // Display window
235234 SizeTo ( newWidth , newHeight ) ;
@@ -290,7 +289,6 @@ void AddSpace(bool full)
290289 }
291290 else
292291 {
293- //AddSpace(false);
294292 line . Add ( new buttonFrontBrakeHose ( 0 , 0 , textHeight , Owner . Viewer , car , CarPosition ) ) ;
295293 line . Add ( new buttonFrontAngleCock ( 0 , 0 , textHeight , Owner . Viewer , car , CarPosition ) ) ;
296294 line . Add ( new buttonCouplerFront ( 0 , 0 , textHeight , Owner . Viewer , car , CarPosition ) ) ;
@@ -356,7 +354,6 @@ void buttonClose_Click(Control arg1, Point arg2)
356354 carPosition = CarPosition ;
357355 Visible = false ;
358356 }
359-
360357 public override void PrepareFrame ( ElapsedTime elapsedTime , bool updateFull )
361358 {
362359 base . PrepareFrame ( elapsedTime , updateFull ) ;
@@ -377,7 +374,7 @@ public override void PrepareFrame(ElapsedTime elapsedTime, bool updateFull)
377374
378375 LastPlayerTrainCars = Owner . Viewer . PlayerTrain . Cars . Count ;
379376 if ( Owner . Viewer . PlayerLocomotive != null ) LastPlayerLocomotiveFlippedState = Owner . Viewer . PlayerLocomotive . Flipped ;
380- //
377+
381378 Layout ( ) ;
382379 UpdateWindowSize ( ) ;
383380 }
@@ -389,7 +386,6 @@ public override void PrepareFrame(ElapsedTime elapsedTime, bool updateFull)
389386 {
390387 Owner . Viewer . FrontCamera . Activate ( ) ;
391388 }
392-
393389 carPosition = CarPosition ;
394390 Layout ( ) ;
395391 UpdateWindowSize ( ) ;
@@ -457,8 +453,6 @@ void TrainCarOperationsCouplerFront_Click(Control arg1, Point arg2)
457453 }
458454 else
459455 {
460- TrainCarViewer . symbolClicked = Viewer . Catalog . GetString ( "Coupler Front" ) ;
461-
462456 new UncoupleCommand ( Viewer . Log , CarPosition ) ;
463457 if ( Viewer . CarOperationsWindow . CarPosition > CarPosition )
464458 Viewer . CarOperationsWindow . Visible = false ;
@@ -493,8 +487,6 @@ void TrainCarOperationsCouplerRear_Click(Control arg1, Point arg2)
493487 }
494488 else
495489 {
496- TrainCarViewer . symbolClicked = Viewer . Catalog . GetString ( "Coupler Rear" ) ;
497-
498490 new UncoupleCommand ( Viewer . Log , CarPosition ) ;
499491 if ( Viewer . CarOperationsWindow . CarPosition > CarPosition )
500492 Viewer . CarOperationsWindow . Visible = false ;
@@ -546,8 +538,6 @@ void buttonHandBrake_Click(Control arg1, Point arg2)
546538 {
547539 if ( ( Viewer . PlayerTrain . Cars [ CarPosition ] as MSTSWagon ) . HandBrakePresent )
548540 {
549- TrainCarViewer . symbolClicked = Viewer . Catalog . GetString ( "Handbrake" ) ;
550-
551541 new WagonHandbrakeCommand ( Viewer . Log , ( Viewer . PlayerTrain . Cars [ CarPosition ] as MSTSWagon ) , ! ( Viewer . PlayerTrain . Cars [ CarPosition ] as MSTSWagon ) . GetTrainHandbrakeStatus ( ) ) ;
552542 if ( ( Viewer . PlayerTrain . Cars [ CarPosition ] as MSTSWagon ) . GetTrainHandbrakeStatus ( ) )
553543 {
@@ -612,10 +602,8 @@ public buttonFrontBrakeHose(int x, int y, int size, Viewer viewer, TrainCar car,
612602 void buttonFrontBrakeHose_Click ( Control arg1 , Point arg2 )
613603 {
614604 if ( First ) return ;
615- TrainCarViewer . symbolClicked = Viewer . Catalog . GetString ( "Front brake hose" ) ;
616605
617606 new WagonBrakeHoseConnectCommand ( Viewer . Log , ( Viewer . PlayerTrain . Cars [ CarPosition ] as MSTSWagon ) , ! ( Viewer . PlayerTrain . Cars [ CarPosition ] as MSTSWagon ) . BrakeSystem . FrontBrakeHoseConnected ) ;
618-
619607 if ( ( Viewer . PlayerTrain . Cars [ CarPosition ] as MSTSWagon ) . BrakeSystem . FrontBrakeHoseConnected )
620608 {
621609 Viewer . Simulator . Confirmer . Information ( Viewer . Catalog . GetString ( "Front brake hose connected" ) ) ;
@@ -651,7 +639,7 @@ public buttonRearBrakeHose(int x, int y, int size, Viewer viewer, TrainCar car,
651639 void buttonRearBrakeHose_Click ( Control arg1 , Point arg2 )
652640 {
653641 if ( Last ) return ;
654- TrainCarViewer . symbolClicked = Viewer . Catalog . GetString ( "Rear brake hose" ) ;
642+
655643 new WagonBrakeHoseRearConnectCommand ( Viewer . Log , ( Viewer . PlayerTrain . Cars [ CarPosition ] as MSTSWagon ) , ! ( Viewer . PlayerTrain . Cars [ CarPosition ] as MSTSWagon ) . BrakeSystem . RearBrakeHoseConnected ) ;
656644 if ( ( Viewer . PlayerTrain . Cars [ CarPosition ] as MSTSWagon ) . BrakeSystem . RearBrakeHoseConnected )
657645 {
@@ -688,10 +676,8 @@ public buttonFrontAngleCock(int x, int y, int size, Viewer viewer, TrainCar car,
688676
689677 void buttonFrontAngleCock_Click ( Control arg1 , Point arg2 )
690678 {
691- if ( First )
692- return ;
679+ if ( First ) return ;
693680
694- TrainCarViewer . symbolClicked = Viewer . Catalog . GetString ( "Front angle cock" ) ;
695681 new ToggleAngleCockACommand ( Viewer . Log , ( Viewer . PlayerTrain . Cars [ CarPosition ] as MSTSWagon ) , ! ( Viewer . PlayerTrain . Cars [ CarPosition ] as MSTSWagon ) . BrakeSystem . AngleCockAOpen ) ;
696682 if ( ( Viewer . PlayerTrain . Cars [ CarPosition ] as MSTSWagon ) . BrakeSystem . AngleCockAOpen )
697683 {
@@ -727,10 +713,8 @@ public buttonRearAngleCock(int x, int y, int size, Viewer viewer, TrainCar car,
727713
728714 void buttonRearAngleCock_Click ( Control arg1 , Point arg2 )
729715 {
730- if ( Last )
731- return ;
716+ if ( Last ) return ;
732717
733- TrainCarViewer . symbolClicked = Viewer . Catalog . GetString ( "Rear angle cock" ) ;
734718 new ToggleAngleCockBCommand ( Viewer . Log , ( Viewer . PlayerTrain . Cars [ CarPosition ] as MSTSWagon ) , ! ( Viewer . PlayerTrain . Cars [ CarPosition ] as MSTSWagon ) . BrakeSystem . AngleCockBOpen ) ;
735719 if ( ( Viewer . PlayerTrain . Cars [ CarPosition ] as MSTSWagon ) . BrakeSystem . AngleCockBOpen )
736720 {
@@ -778,7 +762,6 @@ void buttonBleedOffValve_Click(Control arg1, Point arg2)
778762 Texture = BleedOffValveNotAvailable ;
779763 return ;
780764 }
781- TrainCarViewer . symbolClicked = Viewer . Catalog . GetString ( "Bleed off valve" ) ;
782765 new ToggleBleedOffValveCommand ( Viewer . Log , ( Viewer . PlayerTrain . Cars [ CarPosition ] as MSTSWagon ) , ! ( Viewer . PlayerTrain . Cars [ CarPosition ] as MSTSWagon ) . BrakeSystem . BleedOffValveOpen ) ;
783766 if ( ( Viewer . PlayerTrain . Cars [ CarPosition ] as MSTSWagon ) . BrakeSystem . BleedOffValveOpen )
784767 {
@@ -870,7 +853,6 @@ public buttonToggleMU(int x, int y, int size, Viewer viewer, int carPosition)
870853 }
871854 void buttonToggleMU_Click ( Control arg1 , Point arg2 )
872855 {
873- TrainCarViewer . symbolClicked = Viewer . Catalog . GetString ( "MU signal" ) ;
874856 if ( Viewer . PlayerTrain . Cars [ CarPosition ] is MSTSDieselLocomotive )
875857 {
876858 MSTSLocomotive locomotive = Viewer . PlayerTrain . Cars [ CarPosition ] as MSTSLocomotive ;
@@ -914,7 +896,6 @@ public buttonTogglePower(int x, int y, int size, Viewer viewer, int carPosition)
914896 }
915897 void buttonTogglePower_Click ( Control arg1 , Point arg2 )
916898 {
917- TrainCarViewer . symbolClicked = Viewer . Catalog . GetString ( "Power" ) ;
918899 if ( ( Viewer . PlayerTrain . Cars [ CarPosition ] is MSTSElectricLocomotive )
919900 || ( Viewer . PlayerTrain . Cars [ CarPosition ] is MSTSDieselLocomotive ) )
920901 {
@@ -1002,7 +983,6 @@ public ToggleBatterySwitch(int x, int y, int size, Viewer viewer, int carPositio
1002983 }
1003984 void ToggleBatterySwitch_Click ( Control arg1 , Point arg2 )
1004985 {
1005- TrainCarViewer . symbolClicked = Viewer . Catalog . GetString ( "Battery Switch" ) ;
1006986 if ( Viewer . PlayerTrain . Cars [ CarPosition ] is MSTSWagon wagon
1007987 && wagon . PowerSupply is IPowerSupply )
1008988 {
0 commit comments