Skip to content

Commit f213e5c

Browse files
committed
Automatic merge of T1.5.1-1806-g5522fc5fa and 11 pull requests
- Pull request #570 at 362e4e7: glTF 2.0 support with PBR lighting - Pull request #1062 at 1ec3dc6: Train Forces popup Window. - Pull request #1064 at 1be1fc4: Add Train Info tab to Help window (F1) - Pull request #1067 at ea06d46: Traction and dynamic brake retardation - Pull request #892 at 1f5ba4c: Signal Function OPP_SIG_ID_TRAINPATH - Pull request #1074 at e9a66c1: Gradient - commit 2024-16-12 - Pull request #1076 at 3bbd537: Allow depart early - Pull request #1085 at 37e2817: updates key commands for Train Operations window and also Daylight Offset - Pull request #1086 at e10390b: Add Settings Exporter tool (copy settings to INI, etc) - Pull request #1082 at 5845a1a: Allow variable water level in glass gauge - Pull request #1081 at 689494b: Brake cuts power unification
13 parents 9f53ab7 + 5522fc5 + 362e4e7 + 1ec3dc6 + 1be1fc4 + ea06d46 + 1f5ba4c + e9a66c1 + 3bbd537 + 37e2817 + e10390b + 5845a1a + 689494b commit f213e5c

File tree

2 files changed

+13
-24
lines changed

2 files changed

+13
-24
lines changed

Source/Orts.Simulation/Simulation/RollingStocks/MSTSLocomotive.cs

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4201,23 +4201,18 @@ public void StartThrottleToZero(float? target)
42014201
/// whether it is used for cruise control or not
42024202
/// </summary>
42034203
/// <param name="intermediateValue">Whather asking for intermediate (for mouse operation) or notched (for displaying) value.</param>
4204-
/// <returns>Combined position into 0-1 range</returns>
4205-
public float GetThrottleHandleValue(float data)
4204+
/// <returns>Position into 0-1 range</returns>
4205+
public float GetThrottleHandleValue(bool intermediateValue)
42064206
{
42074207
if (CruiseControl?.SpeedRegMode == CruiseControl.SpeedRegulatorMode.Auto && CruiseControl.SelectedMaxAccelerationPercent != 0
42084208
&& CruiseControl.HasIndependentThrottleDynamicBrakeLever)
4209-
return ThrottleController.CurrentValue;
4209+
return intermediateValue ? ThrottleController.CurrentValue : ThrottleController.IntermediateValue;
42104210
if (CruiseControl?.SpeedRegMode == CruiseControl.SpeedRegulatorMode.Auto && CruiseControl.UseThrottleAsForceSelector)
42114211
return CruiseControl.SelectedMaxAccelerationPercent / 100;
42124212
if (CruiseControl?.SpeedRegMode == CruiseControl.SpeedRegulatorMode.Auto && CruiseControl.UseThrottleAsSpeedSelector)
42134213
return CruiseControl.SelectedSpeedMpS / MaxSpeedMpS;
42144214

4215-
4216-
if (CruiseControl == null || CruiseControl.SpeedRegMode == CruiseControl.SpeedRegulatorMode.Manual)
4217-
return data;
4218-
else
4219-
return ThrottleController.CurrentValue;
4220-
4215+
return intermediateValue ? ThrottleController.CurrentValue : ThrottleController.IntermediateValue;
42214216
}
42224217

42234218
#endregion
@@ -5691,7 +5686,7 @@ public virtual float GetDataOf(CabViewControl cvc)
56915686
case CABViewControlTypes.THROTTLE:
56925687
{
56935688
if (CruiseControl != null && CruiseControl.SkipThrottleDisplay) break;
5694-
data = GetThrottleHandleValue((Train.TrainType == Train.TRAINTYPE.AI_PLAYERHOSTING || Train.Autopilot) ? ThrottlePercent / 100f : LocalThrottlePercent / 100f);
5689+
data = GetThrottleHandleValue(false);
56955690
break;
56965691
}
56975692
case CABViewControlTypes.THROTTLE_DISPLAY:
@@ -5786,10 +5781,13 @@ public virtual float GetDataOf(CabViewControl cvc)
57865781
break;
57875782
}
57885783
case CABViewControlTypes.DYNAMIC_BRAKE:
5784+
{
5785+
data = DynamicBrakeController?.CurrentValue ?? 0;
5786+
break;
5787+
}
57895788
case CABViewControlTypes.DYNAMIC_BRAKE_DISPLAY:
5790-
//case CABViewControlTypes.CP_HANDLE:
57915789
{
5792-
data = DynamicBrakePercent / 100f;
5790+
data = (Train.TrainType == Train.TRAINTYPE.AI_PLAYERHOSTING || Train.Autopilot) ? DynamicBrakePercent / 100 : LocalDynamicBrakePercent / 100;
57935791
break;
57945792
}
57955793
case CABViewControlTypes.WIPERS:

Source/RunActivity/Viewer3D/RollingStock/MSTSLocomotiveViewer.cs

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2138,26 +2138,17 @@ public virtual int GetDrawIndex()
21382138
case CABViewControlTypes.FIREHOLE:
21392139
case CABViewControlTypes.THROTTLE:
21402140
case CABViewControlTypes.THROTTLE_DISPLAY:
2141+
case CABViewControlTypes.DYNAMIC_BRAKE_DISPLAY:
21412142
index = PercentToIndex(data);
21422143
break;
21432144
case CABViewControlTypes.FRICTION_BRAKING:
21442145
index = data > 0.001 ? 1 : 0;
21452146
break;
21462147
case CABViewControlTypes.DYNAMIC_BRAKE:
2147-
case CABViewControlTypes.DYNAMIC_BRAKE_DISPLAY:
2148-
var dynBrakePercent = (Locomotive.Train.TrainType == Train.TRAINTYPE.AI_PLAYERHOSTING || Locomotive.Train.Autopilot) ?
2149-
Locomotive.DynamicBrakePercent : Locomotive.LocalDynamicBrakePercent;
2150-
if (dynBrakePercent <= 0)
2151-
index = 0;
2152-
else if (Locomotive.DynamicBrakeController != null)
2153-
{
2154-
if (!Locomotive.HasSmoothStruc)
2148+
if (Locomotive.DynamicBrakeController != null && !Locomotive.HasSmoothStruc)
21552149
index = Locomotive.DynamicBrakeController.CurrentNotch;
21562150
else
2157-
index = PercentToIndex(Locomotive.DynamicBrakeController.CurrentValue);
2158-
}
2159-
else
2160-
index = PercentToIndex(dynBrakePercent);
2151+
index = PercentToIndex(data);
21612152
break;
21622153
case CABViewControlTypes.CPH_DISPLAY:
21632154
case CABViewControlTypes.CP_HANDLE:

0 commit comments

Comments
 (0)