Skip to content

Commit

Permalink
Automatic merge of T1.5.1-535-g2f57132ee and 14 pull requests
Browse files Browse the repository at this point in the history
- Pull request #757 at 98dd1a7: Unify RailDriver code implementations
- Pull request #821 at cc3af66: Adds suppression of safety valves
- Pull request #831 at 61bbf43: poor mans switch panel on tablet
- Pull request #839 at d00beb9: First phase of https://blueprints.launchpad.net/or/+spec/additional-cruise-control-parameters
- Pull request #841 at 410a585: https://blueprints.launchpad.net/or/+spec/animating-trainset-windows
- Pull request #853 at a9760ec: Notify out of focus
- Pull request #855 at b39e5d8: Adds new route from TrainSimulations
- Pull request #856 at 30e7413: Add Alternate Syntax for Confusing Tokens
- Pull request #857 at 076c77a: Adding Air Flow Meters
- Pull request #858 at bbaeeba: Fix wheel animation problems
- Pull request #859 at 30d7b53: Steam adhesion bug#1
- Pull request #860 at d2b8a52: Changes in the Car Operations Menu for the lines with brake information
- Pull request #861 at 2c39260: Curve friction#1
- Pull request #862 at 489f261: Fix engine leak problem
  • Loading branch information
openrails-bot committed Aug 15, 2023
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 13 deletions.
11 changes: 7 additions & 4 deletions Source/Documentation/Manual/driving.rst
Expand Up @@ -537,13 +537,16 @@ By clicking in this menu it is possible:
for both electric and diesel locomotives;
- to connect or disconnect locomotive operation with that of the player
locomotive;
- to connect or disconnect the car's air hoses from the rest of the consist;
- to toggle the angle cocks on the air hoses at either end of the car
between open and closed;
- to toggle the bleed valve on the car to vent the air pressure from the
- to connect of disconnect the battery;
- to connect or disconnect the Electric Train Supply;
- to connect or disconnect the car's brake hoses from the rest of the consist;
- to open or close the angle cocks on the air hoses at either end of the car;
- to open or close the bleed valve on the car to vent the air pressure from the
car's reservoir and release the air brakes to move the car without brakes
(e.g. humping, etc.).

Grayed out choices are not applicable for the chosen car.

By toggling the angle cocks on individual cars it is possible to close
selected angle cocks of the air hoses so that when the cars are uncoupled,
the air pressure in the remaining consist (and optionally in the uncoupled
Expand Down
Binary file modified Source/Documentation/Manual/images/driving-car-operations.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
84 changes: 75 additions & 9 deletions Source/RunActivity/Viewer3D/Popups/CarOperationsWindow.cs
Expand Up @@ -50,6 +50,8 @@ protected override ControlLayout Layout(ControlLayout layout)

TrainCar trainCar = Viewer.PlayerTrain.Cars[CarPosition];
BrakeSystem brakeSystem = (trainCar as MSTSWagon).BrakeSystem;
MSTSLocomotive locomotive = trainCar as MSTSLocomotive;
MSTSWagon wagon = trainCar as MSTSWagon;

BrakeSystem rearBrakeSystem = null;
if (CarPosition + 1 < Viewer.PlayerTrain.Cars.Count)
Expand All @@ -58,11 +60,14 @@ protected override ControlLayout Layout(ControlLayout layout)
rearBrakeSystem = (rearTrainCar as MSTSWagon).BrakeSystem;
}

bool isElectricDieselLocomotive = (Viewer.PlayerTrain.Cars[CarPosition] is MSTSElectricLocomotive) || (Viewer.PlayerTrain.Cars[CarPosition] is MSTSDieselLocomotive);

var vbox = base.Layout(layout).AddLayoutVertical();
vbox.Add(ID = new Label(vbox.RemainingWidth, Owner.TextFontDefault.Height, Viewer.Catalog.GetString("Car ID") + " " + (CarPosition >= Viewer.PlayerTrain.Cars.Count? " " :Viewer.PlayerTrain.Cars[CarPosition].CarID), LabelAlignment.Center));
vbox.Add(ID = new Label(vbox.RemainingWidth, Owner.TextFontDefault.Height, Viewer.Catalog.GetString("Car ID") + " " + (CarPosition >= Viewer.PlayerTrain.Cars.Count ? " " : Viewer.PlayerTrain.Cars[CarPosition].CarID), LabelAlignment.Center));
ID.Color = Color.Red;
vbox.AddHorizontalSeparator();

// Handbrake
string buttonHandbrakeText = "";
if ((trainCar as MSTSWagon).GetTrainHandbrakeStatus())
buttonHandbrakeText = Viewer.Catalog.GetString("Unset Handbrake");
Expand All @@ -71,15 +76,38 @@ protected override ControlLayout Layout(ControlLayout layout)
vbox.Add(buttonHandbrake = new Label(vbox.RemainingWidth, Owner.TextFontDefault.Height, buttonHandbrakeText, LabelAlignment.Center));
vbox.AddHorizontalSeparator();

vbox.Add(buttonTogglePower = new Label(vbox.RemainingWidth, Owner.TextFontDefault.Height, Viewer.Catalog.GetString("Toggle Power"), LabelAlignment.Center));
// Power Supply
if (locomotive != null)
if (locomotive.LocomotivePowerSupply.MainPowerSupplyOn)
vbox.Add(buttonTogglePower = new Label(vbox.RemainingWidth, Owner.TextFontDefault.Height, Viewer.Catalog.GetString("Power Off"), LabelAlignment.Center));
else
vbox.Add(buttonTogglePower = new Label(vbox.RemainingWidth, Owner.TextFontDefault.Height, Viewer.Catalog.GetString("Power On"), LabelAlignment.Center));
else
vbox.Add(buttonTogglePower = new Label(vbox.RemainingWidth, Owner.TextFontDefault.Height, Viewer.Catalog.GetString("Power On"), LabelAlignment.Center));
vbox.AddHorizontalSeparator();
vbox.Add(buttonToggleMU = new Label(vbox.RemainingWidth, Owner.TextFontDefault.Height, Viewer.Catalog.GetString("Toggle MU Connection"), LabelAlignment.Center));

// MU Connection
if ((locomotive != null) && (locomotive.RemoteControlGroup >= 0))
vbox.Add(buttonToggleMU = new Label(vbox.RemainingWidth, Owner.TextFontDefault.Height, Viewer.Catalog.GetString("Disconnect MU Connection"), LabelAlignment.Center));
else
vbox.Add(buttonToggleMU = new Label(vbox.RemainingWidth, Owner.TextFontDefault.Height, Viewer.Catalog.GetString("Connect MU Connection"), LabelAlignment.Center));
vbox.AddHorizontalSeparator();
vbox.Add(buttonToggleBatterySwitch = new Label(vbox.RemainingWidth, Owner.TextFontDefault.Height, Viewer.Catalog.GetString("Toggle Battery Switch"), LabelAlignment.Center));

// Battery Switch
if ((wagon != null) && (wagon.PowerSupply is IPowerSupply) && (wagon.PowerSupply.BatterySwitch.On))
vbox.Add(buttonToggleBatterySwitch = new Label(vbox.RemainingWidth, Owner.TextFontDefault.Height, Viewer.Catalog.GetString("Battery Switch Off"), LabelAlignment.Center));
else
vbox.Add(buttonToggleBatterySwitch = new Label(vbox.RemainingWidth, Owner.TextFontDefault.Height, Viewer.Catalog.GetString("Battery Switch On"), LabelAlignment.Center));
vbox.AddHorizontalSeparator();
vbox.Add(buttonToggleElectricTrainSupplyCable = new Label(vbox.RemainingWidth, Owner.TextFontDefault.Height, Viewer.Catalog.GetString("Toggle Electric Train Supply Connection"), LabelAlignment.Center));

// Electric Train Supply Connection
if ((wagon.PowerSupply != null) && wagon.PowerSupply.FrontElectricTrainSupplyCableConnected)
vbox.Add(buttonToggleElectricTrainSupplyCable = new Label(vbox.RemainingWidth, Owner.TextFontDefault.Height, Viewer.Catalog.GetString("Disonnect Electric Train Supply"), LabelAlignment.Center));
else
vbox.Add(buttonToggleElectricTrainSupplyCable = new Label(vbox.RemainingWidth, Owner.TextFontDefault.Height, Viewer.Catalog.GetString("Connect Electric Train Supply"), LabelAlignment.Center));
vbox.AddHorizontalSeparator();

// Front Brake Hose
string buttonToggleFronBrakeHoseText = "";
if (brakeSystem.FrontBrakeHoseConnected)
buttonToggleFronBrakeHoseText = Viewer.Catalog.GetString("Disconnect Front Brake Hose");
Expand All @@ -88,6 +116,7 @@ protected override ControlLayout Layout(ControlLayout layout)
vbox.Add(buttonToggleFrontBrakeHose = new Label(vbox.RemainingWidth, Owner.TextFontDefault.Height, buttonToggleFronBrakeHoseText, LabelAlignment.Center));
vbox.AddHorizontalSeparator();

// Rear Brake Hose
string buttonToggleRearBrakeHoseText = "";
if (((CarPosition + 1) < Viewer.PlayerTrain.Cars.Count) && (rearBrakeSystem.FrontBrakeHoseConnected))
buttonToggleRearBrakeHoseText = Viewer.Catalog.GetString("Disconnect Rear Brake Hose");
Expand All @@ -96,6 +125,7 @@ protected override ControlLayout Layout(ControlLayout layout)
vbox.Add(buttonToggleRearBrakeHose = new Label(vbox.RemainingWidth, Owner.TextFontDefault.Height, buttonToggleRearBrakeHoseText, LabelAlignment.Center));
vbox.AddHorizontalSeparator();

// Front Angle Cock
string buttonToggleAngleCockAText = "";
if (brakeSystem.AngleCockAOpen)
buttonToggleAngleCockAText = Viewer.Catalog.GetString("Close Front Angle Cock");
Expand All @@ -104,6 +134,7 @@ protected override ControlLayout Layout(ControlLayout layout)
vbox.Add(buttonToggleAngleCockA = new Label(vbox.RemainingWidth, Owner.TextFontDefault.Height, buttonToggleAngleCockAText, LabelAlignment.Center));
vbox.AddHorizontalSeparator();

// Rear Angle Cock
string buttonToggleAngleCockBText = "";
if (brakeSystem.AngleCockBOpen)
buttonToggleAngleCockBText = Viewer.Catalog.GetString("Close Rear Angle Cock");
Expand All @@ -112,6 +143,7 @@ protected override ControlLayout Layout(ControlLayout layout)
vbox.Add(buttonToggleAngleCockB = new Label(vbox.RemainingWidth, Owner.TextFontDefault.Height, buttonToggleAngleCockBText, LabelAlignment.Center));
vbox.AddHorizontalSeparator();

// Bleed Off Valve
string buttonToggleBleedOffValveAText = "";
if (brakeSystem.BleedOffValveOpen)
buttonToggleBleedOffValveAText = Viewer.Catalog.GetString("Close Bleed Off Valve");
Expand All @@ -120,29 +152,63 @@ protected override ControlLayout Layout(ControlLayout layout)
vbox.Add(buttonToggleBleedOffValve = new Label(vbox.RemainingWidth, Owner.TextFontDefault.Height, buttonToggleBleedOffValveAText, LabelAlignment.Center));
vbox.AddHorizontalSeparator();

// Close button
vbox.Add(buttonClose = new Label(vbox.RemainingWidth, Owner.TextFontDefault.Height, Viewer.Catalog.GetString("Close window"), LabelAlignment.Center));

// add click controls

// Handbrake
if ((trainCar as MSTSWagon).HandBrakePresent)
buttonHandbrake.Click += new Action<Control, Point>(buttonHandbrake_Click);
else
buttonHandbrake.Color = Color.Gray;
buttonTogglePower.Click += new Action<Control, Point>(buttonTogglePower_Click);
buttonToggleMU.Click += new Action<Control, Point>(buttonToggleMU_Click);
buttonToggleBatterySwitch.Click += new Action<Control, Point>(buttonToggleBatterySwitch_Click);
buttonToggleElectricTrainSupplyCable.Click += new Action<Control, Point>(buttonToggleElectricTrainSupplyCable_Click);

// Power Supply
if (isElectricDieselLocomotive)
buttonTogglePower.Click += new Action<Control, Point>(buttonTogglePower_Click);
else
buttonTogglePower.Color = Color.Gray;

// MU Connection
if (isElectricDieselLocomotive)
buttonToggleMU.Click += new Action<Control, Point>(buttonToggleMU_Click);
else
buttonToggleMU.Color = Color.Gray;

// Battery Switch
if ((wagon != null) && (wagon.PowerSupply is IPowerSupply))
buttonToggleBatterySwitch.Click += new Action<Control, Point>(buttonToggleBatterySwitch_Click);
else
buttonToggleBatterySwitch.Color = Color.Gray;

// Electric Train Supply Connection
if ((wagon != null) && (wagon.PowerSupply != null))
buttonToggleElectricTrainSupplyCable.Click += new Action<Control, Point>(buttonToggleElectricTrainSupplyCable_Click);
else
buttonToggleElectricTrainSupplyCable.Color = Color.Gray;

// Front Brake Hose
if (CarPosition > 0)
buttonToggleFrontBrakeHose.Click += new Action<Control, Point>(buttonToggleFrontBrakeHose_Click);
else
buttonToggleFrontBrakeHose.Color = Color.Gray;

// Rear Brake Hose
if (CarPosition < (Viewer.PlayerTrain.Cars.Count - 1))
buttonToggleRearBrakeHose.Click += new Action<Control, Point>(buttonToggleRearBrakeHose_Click);
else
buttonToggleRearBrakeHose.Color = Color.Gray;

// Front Angle Cock
buttonToggleAngleCockA.Click += new Action<Control, Point>(buttonToggleAngleCockA_Click);

// Rear Angle Cock
buttonToggleAngleCockB.Click += new Action<Control, Point>(buttonToggleAngleCockB_Click);

// Bleed Off Valve
buttonToggleBleedOffValve.Click += new Action<Control, Point>(buttonToggleBleedOffValve_Click);

// Close button
buttonClose.Click += new Action<Control, Point>(buttonClose_Click);

return vbox;
Expand Down

0 comments on commit 548a908

Please sign in to comment.