Skip to content

Commit 90255fb

Browse files
committed
Duplicates statements removed.
1 parent 9df6e1d commit 90255fb

File tree

3 files changed

+46
-66
lines changed

3 files changed

+46
-66
lines changed

Source/RunActivity/Viewer3D/Cameras.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1066,7 +1066,7 @@ protected override void OnActivate(bool sameCamera)
10661066
var carPosition = !(TrainCarViewer.CarPosition < trainCars.Count()) ? TrainCarViewer.CarPosition - 1 : TrainCarViewer.CarPosition;
10671067
var isDownCameraOutsideFront = UserInput.IsDown(UserCommand.CameraOutsideFront);
10681068
var isDownCameraOutsideRear = UserInput.IsDown(UserCommand.CameraOutsideRear);
1069-
var isVisibleTrainCarViewerOrWebpage = Viewer.TrainCarOperationsViewerWindow.Visible || (Viewer.TrainCarOperationsWebpage.TrainCarSelected);
1069+
var isVisibleTrainCarViewerOrWebpage = Viewer.TrainCarOperationsViewerWindow.Visible || (Viewer.TrainCarOperationsWebpage.TrainCarSelected);
10701070

10711071
if (attachedCar == null || attachedCar.Train != Viewer.SelectedTrain || carPosition != oldCarPosition || isDownCameraOutsideFront || isDownCameraOutsideRear)
10721072
{

Source/RunActivity/Viewer3D/Popups/TrainCarOperationsViewerWindow.cs

Lines changed: 21 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -283,43 +283,33 @@ void AddSpace(bool full)
283283

284284
{
285285
var car = PlayerTrain.Cars[CarPosition];
286-
//Front brake hose
287286
if (car != PlayerTrain.Cars.First())
288-
{
289-
AddSpace(false);
290-
line.Add(new buttonFrontBrakeHose(0, 0, textHeight, Owner.Viewer, car, CarPosition));
291-
line.Add(new buttonFrontAngleCock(0, 0, textHeight, Owner.Viewer, car, CarPosition));
292287
AddSpace(false);
293-
line.Add(new buttonCouplerFront(0, 0, textHeight, Owner.Viewer, car, CarPosition));
294-
}
295-
else
296-
{
297-
line.Add(new buttonFrontBrakeHose(0, 0, textHeight, Owner.Viewer, car, CarPosition));
298-
line.Add(new buttonFrontAngleCock(0, 0, textHeight, Owner.Viewer, car, CarPosition));
299-
line.Add(new buttonCouplerFront(0, 0, textHeight, Owner.Viewer, car, CarPosition));
300-
}
301288

302-
line.Add(new buttonLoco(0, 0, textHeight, Owner.Viewer, car));
289+
//Front brake hose
290+
line.Add(new buttonFrontBrakeHose(0, 0, textHeight, Owner.Viewer, car, CarPosition));
291+
// Front angle cock
292+
line.Add(new buttonFrontAngleCock(0, 0, textHeight, Owner.Viewer, car, CarPosition));
303293

304-
if (car != PlayerTrain.Cars.Last())
305-
{
306-
line.Add(new buttonCouplerRear(0, 0, textHeight, Owner.Viewer, car, CarPosition));
307-
AddSpace(false);
308-
line.Add(new buttonRearAngleCock(0, 0, textHeight, Owner.Viewer, car, CarPosition));
309-
line.Add(new buttonRearBrakeHose(0, 0, textHeight, Owner.Viewer, car, CarPosition));
310-
AddSpace(false);
311-
line.Add(new buttonHandBrake(0, 0, textHeight, Owner.Viewer, CarPosition));
312-
}
313-
else
314-
{
315-
line.Add(new buttonCouplerRear(0, 0, textHeight, Owner.Viewer, car, CarPosition));
316-
AddSpace(false);
317-
line.Add(new buttonRearAngleCock(0, 0, textHeight, Owner.Viewer, car, CarPosition));
318-
line.Add(new buttonRearBrakeHose(0, 0, textHeight, Owner.Viewer, car, CarPosition));
294+
if (car != PlayerTrain.Cars.First())
319295
AddSpace(false);
320-
line.Add(new buttonHandBrake(0, 0, textHeight, Owner.Viewer, CarPosition));
321-
}
296+
297+
// Front coupler
298+
line.Add(new buttonCouplerFront(0, 0, textHeight, Owner.Viewer, car, CarPosition));
299+
// Loco label
300+
line.Add(new buttonLoco(0, 0, textHeight, Owner.Viewer, car));
301+
// Rear coupler
302+
line.Add(new buttonCouplerRear(0, 0, textHeight, Owner.Viewer, car, CarPosition));
303+
AddSpace(false);
304+
// Rear angle cock
305+
line.Add(new buttonRearAngleCock(0, 0, textHeight, Owner.Viewer, car, CarPosition));
306+
// Rear brake hose
307+
line.Add(new buttonRearBrakeHose(0, 0, textHeight, Owner.Viewer, car, CarPosition));
308+
AddSpace(false);
309+
// Handbrake
310+
line.Add(new buttonHandBrake(0, 0, textHeight, Owner.Viewer, CarPosition));
322311
AddSpace(false);
312+
// Bleed off valve
323313
line.Add(new buttonBleedOffValve(0, 0, textHeight, Owner.Viewer, CarPosition));
324314
AddSpace(false);
325315

Source/RunActivity/Viewer3D/Popups/TrainCarOperationsWindow.cs

Lines changed: 24 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ void AddSpace()
337337
if (RefreshRestoredData)
338338
{ // Restores brake hose
339339
RefreshRestoredData = false;
340-
for (int i = 0; i < PlayerTrain.Cars.Count; i++)
340+
for (var i = 0; i < PlayerTrain.Cars.Count; i++)
341341
{
342342
(PlayerTrain.Cars[i] as MSTSWagon).BrakeSystem.RearBrakeHoseConnected = RearBrakes[i];
343343
}
@@ -378,51 +378,41 @@ void AddSpace()
378378

379379
if (car.BrakesStuck || ((car is MSTSLocomotive) && (car as MSTSLocomotive).PowerReduction > 0)) carLabel.Color = Color.Red;
380380

381+
// Left arrow
381382
line.Add(new buttonArrowLeft(0, 0, SymbolSize, Owner.Viewer, carPosition));
382383
AddSpace();
383-
if (car != PlayerTrain.Cars.First())
384-
{
385-
line.Add(new buttonFrontBrakeHose(0, 0, SymbolSize, Owner.Viewer, car, carPosition));
386-
line.Add(new buttonFrontAngleCock(0, 0, SymbolSize, Owner.Viewer, car, carPosition));
387-
AddSpace();
388-
line.Add(new buttonCouplerFront(0, 0, SymbolSize, Owner.Viewer, car));
389-
}
390-
else
391-
{
392-
line.Add(new buttonFrontBrakeHose(0, 0, SymbolSize, Owner.Viewer, car, carPosition));
393-
line.Add(new buttonFrontAngleCock(0, 0, SymbolSize, Owner.Viewer, car, carPosition));
394-
AddSpace();
395-
line.Add(new buttonCouplerFront(0, 0, SymbolSize, Owner.Viewer, car));
396-
}
384+
385+
// Front brake hose
386+
line.Add(new buttonFrontBrakeHose(0, 0, SymbolSize, Owner.Viewer, car, carPosition));
387+
// Front angle cock
388+
line.Add(new buttonFrontAngleCock(0, 0, SymbolSize, Owner.Viewer, car, carPosition));
389+
AddSpace();
390+
391+
// Front coupler
392+
line.Add(new buttonCouplerFront(0, 0, SymbolSize, Owner.Viewer, car));
393+
// Car label
397394
line.Add(carLabel);
398-
if (car != PlayerTrain.Cars.Last())
399-
{
400-
line.Add(new buttonCouplerRear(0, 0, SymbolSize, Owner.Viewer, car));
401-
AddSpace();
402-
line.Add(new buttonRearAngleCock(0, 0, SymbolSize, Owner.Viewer, car, carPosition));
403-
line.Add(new buttonRearBrakeHose(0, 0, SymbolSize, Owner.Viewer, car, carPosition));
404-
}
405-
else
406-
{
407-
line.Add(new buttonCouplerRear(0, 0, SymbolSize, Owner.Viewer, car));
408-
AddSpace();
409-
line.Add(new buttonRearAngleCock(0, 0, SymbolSize, Owner.Viewer, car, carPosition));
410-
line.Add(new buttonRearBrakeHose(0, 0, SymbolSize, Owner.Viewer, car, carPosition));
411-
}
395+
// Rear coupler
396+
line.Add(new buttonCouplerRear(0, 0, SymbolSize, Owner.Viewer, car));
397+
AddSpace();
412398

399+
// Rear angle cock
400+
line.Add(new buttonRearAngleCock(0, 0, SymbolSize, Owner.Viewer, car, carPosition));
401+
// Rear brake hose
402+
line.Add(new buttonRearBrakeHose(0, 0, SymbolSize, Owner.Viewer, car, carPosition));
413403
AddSpace();
414404

415405
// Handbrake
416406
line.Add(new buttonHandBrake(0, 0, SymbolSize, Owner.Viewer, carPosition));
417407
AddSpace();
418408

419-
// Bleed Off Valve
409+
// Bleed off valve
420410
line.Add(new buttonBleedOffValve(0, 0, SymbolSize, Owner.Viewer, carPosition));
421411
AddSpace();
422412

423413
if (AllSymbolsMode)//Allows to display all symbols
424414
{
425-
// Electric Train Supply Connection (ETS)
415+
// Electric train supply connection (ETS)
426416
if (PlayerTrain.Cars.Count() > 1 && wagon.PowerSupply != null)
427417
{
428418
line.Add(new buttonToggleElectricTrainSupplyCable(0, 0, SymbolSize, Owner.Viewer, carPosition));
@@ -445,7 +435,7 @@ void AddSpace()
445435
}
446436
}
447437
}
448-
438+
// Right arrow
449439
line.Add(new buttonArrowRight(0, 0, textHeight, Owner.Viewer, carPosition));
450440
AddSpace();
451441
AddSpace();
@@ -505,7 +495,7 @@ public void localScrollLayout(int selectedCarPosition)
505495

506496
LocalScrollPosition = 0;
507497

508-
if (CarPositionVisible > 0 && selectedCarPosition >= CarPositionVisible)// && selectedCarPosition != currentCarPosition)// Not related with CarID
498+
if (CarPositionVisible > 0 && selectedCarPosition >= CarPositionVisible)// Not related with CarID
509499
{
510500
Client = ControlLayoutScrollboxVertical.NewClient;
511501
var xcarPosition = CarPositionVisible;
@@ -615,7 +605,7 @@ public override void PrepareFrame(ElapsedTime elapsedTime, bool updateFull)
615605
carOperations.CarOperationChanged = carOperations.Visible && carOperations.CarOperationChanged;
616606
}
617607

618-
if (CarPosition != trainCarViewer.CarPosition)
608+
if (CarPosition != trainCarViewer.CarPosition && Owner.Viewer.TrainCarOperationsWebpage.Connections > 0)
619609
{
620610
// Required to scroll the main window from the web version
621611
UpdateTrainCarOperation = true;

0 commit comments

Comments
 (0)