Skip to content

Commit 3af50e6

Browse files
author
Chris Jakeman
committed
Merge remote-tracking branch 'upstream/master'
2 parents fa00b83 + 71c4e89 commit 3af50e6

File tree

6 files changed

+44
-5
lines changed

6 files changed

+44
-5
lines changed

Source/Documentation/Manual/cabs.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,15 @@ if e.g. the wiper moves from left to right and back, only the frames related
527527
to the motion from left to right have to be included. For the reverse
528528
motion the same frames are used from last to first. SwitchVal can vary from 0 to 1.
529529

530+
Control Labels
531+
--------------
532+
533+
The string appearing on the screen when the mouse browses over a command control
534+
can be customized with following line, to be added within the control block in the
535+
.cvf file::
536+
537+
ORTSLabel ( "string" )
538+
530539
Multiple screen pages on displays
531540
---------------------------------
532541

Source/Orts.Formats.Msts/CabViewFile.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,7 @@ public class CabViewControl
406406

407407
public double OldValue;
408408
public string ACEFile = "";
409+
public string Label = "";
409410

410411
public int Display;
411412
public List<string> Screens;
@@ -607,6 +608,11 @@ public CVCDial(STFReader stf, string basepath)
607608
ToDegree = stf.ReadFloat(STFReader.UNITS.None, null);
608609
stf.SkipRestOfBlock();
609610
}),
611+
new STFReader.TokenProcessor("ortslabel", ()=>{
612+
stf.MustMatch("(");
613+
Label = stf.ReadString();
614+
stf.SkipRestOfBlock();
615+
}),
610616
new STFReader.TokenProcessor("ortsdisplay", ()=>{ParseDisplay(stf); }),
611617
new STFReader.TokenProcessor("ortsscreenpage", () => {ParseScreen(stf); }),
612618
new STFReader.TokenProcessor("ortscabviewpoint", ()=>{ParseCabViewpoint(stf); }),
@@ -696,6 +702,11 @@ public CVCGauge(STFReader stf, string basepath)
696702
}
697703
}),
698704
new STFReader.TokenProcessor("ortsangle", () =>{ Rotation = ParseRotation(stf); }),
705+
new STFReader.TokenProcessor("ortslabel", ()=>{
706+
stf.MustMatch("(");
707+
Label = stf.ReadString();
708+
stf.SkipRestOfBlock();
709+
}),
699710
new STFReader.TokenProcessor("ortsdisplay", ()=>{ParseDisplay(stf); }),
700711
new STFReader.TokenProcessor("ortsscreenpage", () => {ParseScreen(stf); }),
701712
new STFReader.TokenProcessor("ortscabviewpoint", ()=>{ParseCabViewpoint(stf); }),
@@ -822,6 +833,11 @@ public CVCDigital(STFReader stf, string basepath)
822833
}),
823834
new STFReader.TokenProcessor("ortsfont", ()=>{ParseFont(stf); }),
824835
new STFReader.TokenProcessor("ortsangle", () => {Rotation = ParseRotation(stf); }),
836+
new STFReader.TokenProcessor("ortslabel", ()=>{
837+
stf.MustMatch("(");
838+
Label = stf.ReadString();
839+
stf.SkipRestOfBlock();
840+
}),
825841
new STFReader.TokenProcessor("ortsdisplay", ()=>{ParseDisplay(stf); }),
826842
new STFReader.TokenProcessor("ortsscreenpage", () => {ParseScreen(stf); }),
827843
new STFReader.TokenProcessor("ortscabviewpoint", ()=>{ParseCabViewpoint(stf); }),
@@ -1066,6 +1082,11 @@ public CVCDiscrete(STFReader stf, string basepath, DiscreteStates discreteState)
10661082
_ValuesRead++;
10671083
}
10681084
}),
1085+
new STFReader.TokenProcessor("ortslabel", ()=>{
1086+
stf.MustMatch("(");
1087+
Label = stf.ReadString();
1088+
stf.SkipRestOfBlock();
1089+
}),
10691090
new STFReader.TokenProcessor("ortsdisplay", ()=>{ParseDisplay(stf); }),
10701091
new STFReader.TokenProcessor("ortsscreenpage", () => {ParseScreen(stf); }),
10711092
new STFReader.TokenProcessor("ortsnewscreenpage", () => {ParseNewScreen(stf); }),

Source/Orts.Simulation/Simulation/RollingStocks/MSTSSteamLocomotive.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ public float TenderCoalMassKG // Decreased by firing and increased
571571
float DisplayCriticalSpeedTractiveEffortLbf; // Display power value @ speed of piston
572572
float absStartTractiveEffortN = 0.0f; // Record starting tractive effort
573573
float TractiveEffortLbsF; // Current sim calculated tractive effort
574-
const float TractiveEffortFactor = 0.85f; // factor for calculating Theoretical Tractive Effort for non-geared locomotives
574+
float TractiveEffortFactor = 0.85f; // factor for calculating Theoretical Tractive Effort for non-geared locomotives
575575
float GearedTractiveEffortFactor = 0.7f; // factor for calculating Theoretical Tractive Effort for geared locomotives
576576
float NeutralGearedDavisAN; // Davis A value adjusted for neutral gearing
577577
const float DavisMechanicalResistanceFactor = 20.0f;
@@ -1254,6 +1254,13 @@ public override void Initialize()
12541254

12551255
// ****************** Test Locomotive and Gearing type ***********************
12561256

1257+
// if the maximum cutoff for the locomotive is less then the default value, then decrease it so that tractive effort is not excessive.
1258+
// At some future stage it may be worthwhile to add an extra parameter to the ENG file to allow user setting.
1259+
if (CutoffController.MaximumValue < TractiveEffortFactor)
1260+
{
1261+
TractiveEffortFactor = CutoffController.MaximumValue;
1262+
}
1263+
12571264
if (SteamEngineType == SteamEngineTypes.Compound)
12581265
{
12591266
// Initialise Compound locomotive

Source/RunActivity/Viewer3D/RollingStock/MSTSLocomotiveViewer.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1579,7 +1579,7 @@ public interface ICabViewMouseControlRenderer
15791579
bool IsMouseWithin();
15801580
void HandleUserInput();
15811581
string GetControlName();
1582-
1582+
string ControlLabel { get; }
15831583
}
15841584

15851585
/// <summary>
@@ -2215,6 +2215,8 @@ public string GetControlName()
22152215
return (Locomotive as MSTSLocomotive).TrainControlSystem.GetDisplayString(GetControlType().ToString());
22162216
}
22172217

2218+
public string ControlLabel => Control.Label;
2219+
22182220
/// <summary>
22192221
/// Handles cabview mouse events, and changes the corresponding locomotive control values.
22202222
/// </summary>

Source/RunActivity/Viewer3D/RollingStock/SubSystems/ETCS/DriverMachineInterface.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -856,7 +856,7 @@ public string GetControlName()
856856
}
857857
return "";
858858
}
859-
859+
public string ControlLabel => GetControlName();
860860
public override void Draw(GraphicsDevice graphicsDevice)
861861
{
862862
DMI.Draw(ControlView.SpriteBatch, new Point(DrawPosition.X, DrawPosition.Y));

Source/RunActivity/Viewer3D/Viewer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1477,7 +1477,7 @@ void HandleUserInput(ElapsedTime elapsedTime)
14771477
if (MousePickedControl != null & MousePickedControl != OldMousePickedControl)
14781478
{
14791479
// say what control you have here
1480-
Simulator.Confirmer.Message(ConfirmLevel.None, MousePickedControl.GetControlName());
1480+
Simulator.Confirmer.Message(ConfirmLevel.None, String.IsNullOrEmpty(MousePickedControl.ControlLabel) ? MousePickedControl.GetControlName() : MousePickedControl.ControlLabel);
14811481
}
14821482
if (MousePickedControl != null) ActualCursor = Cursors.Hand;
14831483
else if (ActualCursor == Cursors.Hand) ActualCursor = Cursors.Default;
@@ -1636,7 +1636,7 @@ void HandleUserInput(ElapsedTime elapsedTime)
16361636
if (MousePickedControl != null & MousePickedControl != OldMousePickedControl)
16371637
{
16381638
// say what control you have here
1639-
Simulator.Confirmer.Message(ConfirmLevel.None, MousePickedControl.GetControlName());
1639+
Simulator.Confirmer.Message(ConfirmLevel.None, String.IsNullOrEmpty(MousePickedControl.ControlLabel) ? MousePickedControl.GetControlName() : MousePickedControl.ControlLabel);
16401640
}
16411641
if (MousePickedControl != null)
16421642
{

0 commit comments

Comments
 (0)