Skip to content

Commit aa75d5d

Browse files
committed
Automatic merge of T1.5.1-1090-g9915d87ce6 and 21 pull requests
- Pull request #891 at 9a1d6b2: Auto save - Pull request #959 at 2452cb0: Fix TrackViewer crash on big zoom value - Pull request #972 at e90a2aa: On Map window color changed switch or signal is not changed - Pull request #976 at 877cc94: Increased center of gravity range - Pull request #839 at d00beb9: First phase of https://blueprints.launchpad.net/or/+spec/additional-cruise-control-parameters - Pull request #882 at 8f695a4: Blueprint/train car operations UI window - Pull request #892 at 1f5ba4c: Signal Function OPP_SIG_ID_TRAINPATH - Pull request #922 at a3bc9e7: Autopilot for timetable mode - Pull request #953 at a519452: Fix Lights Crash on Corrupt Shapes - Pull request #954 at 588a3c2: Multiple Track Profiles & Superelevation Improvements - Pull request #962 at 46d0472: Fix pantographs on unpowered cars - Pull request #970 at 6fa5eed: feat: Remove unnecessary Windows.Forms usage - Pull request #973 at c35be87: fix: Using singular target framework to allow for different platforms across different projects - Pull request #974 at 5faea6f: Bug fix for https://bugs.launchpad.net/or/+bug/2076034 Doors remain open in AI trains - Pull request #977 at a30c659: adds cache for SD files - Pull request #978 at 91f3ee8: fix: adds MilepostUnitsMiles to Manual - Pull request #900 at c27f32d: DMI updates - Pull request #903 at 4a4b032: Downloading route content (Github, zip) - Pull request #799 at dfc715e: Consolidated wind simulation - Pull request #876 at f92de76: docs: add source for documents previously on website to source Documentation folder - Pull request #952 at 8347095: Investigation - Pulsing graphics
23 parents 834a9d7 + 9915d87 + 9a1d6b2 + 2452cb0 + e90a2aa + 877cc94 + d00beb9 + 8f695a4 + 1f5ba4c + a3bc9e7 + a519452 + 588a3c2 + 46d0472 + 6fa5eed + c35be87 + 5faea6f + a30c659 + 91f3ee8 + c27f32d + 4a4b032 + dfc715e + f92de76 + 8347095 commit aa75d5d

File tree

2 files changed

+71
-71
lines changed

2 files changed

+71
-71
lines changed

Source/Orts.Simulation/Simulation/RollingStocks/TrainCar.cs

Lines changed: 68 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1908,115 +1908,115 @@ public virtual void UpdateCurveSpeedLimit(float elapsedClockSeconds)
19081908
// float Sin2Theta = 0.5f * (1 - (float)Math.Cos(2.0 * SuperElevationAngleRad));
19091909
// float CriticalMinSpeedMpS = (float)Math.Sqrt((GravitationalAccelerationMpS2 * CurrentCurveRadiusM * HalfTrackGaugeM * Sin2Theta) / (CosTheta * (CentreOfGravityM.Y * CosTheta + HalfTrackGaugeM * SinTheta)));
19101910

1911-
// Test current speed to see if greater then equal loading speed around the curve
1912-
if (s > MaxSafeCurveSpeedMps)
1913-
{
1911+
// Test current speed to see if greater then equal loading speed around the curve
1912+
if (s > MaxSafeCurveSpeedMps)
1913+
{
19141914
// Consider a tolerance so passengers won't immediately complain, should reduce overkill notifications on routes with jerky track laying
19151915
// Tolerance rapidly dies as speed excess increases, though lasts longer with consist durability set higher
19161916
// Can go negative to punish continuous speeding
19171917
ComfortTolerance -= 2.5f * (s / MaxSafeCurveSpeedMps - 1.0f) * elapsedClockSeconds;
19181918

19191919
if (!IsMaxSafeCurveSpeed && ComfortTolerance <= 0.0f)
1920-
{
1921-
IsMaxSafeCurveSpeed = true; // set flag for IsMaxSafeCurveSpeed reached
1922-
1923-
if (Train.IsFreight)
19241920
{
1921+
IsMaxSafeCurveSpeed = true; // set flag for IsMaxSafeCurveSpeed reached
1922+
1923+
if (Train.IsFreight)
1924+
{
19251925
Simulator.Confirmer.Message(ConfirmLevel.Warning, Simulator.Catalog.GetStringFmt("You are travelling too fast for this curve, your freight car {0} may be damaged. The recommended speed for this curve is {1}", CarID, FormatStrings.FormatSpeedDisplay(MaxSafeCurveSpeedMps, IsMetric)));
1926-
}
1927-
else
1928-
{
1926+
}
1927+
else
1928+
{
19291929
Simulator.Confirmer.Message(ConfirmLevel.Warning, Simulator.Catalog.GetStringFmt("You are travelling too fast for this curve, your passengers in car {0} are feeling uncomfortable. The recommended speed for this curve is {1}", CarID, FormatStrings.FormatSpeedDisplay(MaxSafeCurveSpeedMps, IsMetric)));
1930-
}
1930+
}
19311931

1932-
if (dbfmaxsafecurvespeedmps != MaxSafeCurveSpeedMps)//Debrief eval
1933-
{
1934-
dbfmaxsafecurvespeedmps = MaxSafeCurveSpeedMps;
1935-
//ldbfevalcurvespeed = true;
1936-
DbfEvalTravellingTooFast++;
1932+
if (dbfmaxsafecurvespeedmps != MaxSafeCurveSpeedMps)//Debrief eval
1933+
{
1934+
dbfmaxsafecurvespeedmps = MaxSafeCurveSpeedMps;
1935+
//ldbfevalcurvespeed = true;
1936+
DbfEvalTravellingTooFast++;
19371937
Train.DbfEvalValueChanged = true;//Debrief eval
1938+
}
1939+
}
19381940
}
1939-
}
1940-
}
19411941
else if (s < MaxSafeCurveSpeedMps - SpeedToleranceMpS) // Reset notification once speed drops
1942-
{
1943-
if (IsMaxSafeCurveSpeed)
19441942
{
1945-
IsMaxSafeCurveSpeed = false; // reset flag for IsMaxSafeCurveSpeed reached - if speed on curve decreases
1946-
}
1943+
if (IsMaxSafeCurveSpeed)
1944+
{
1945+
IsMaxSafeCurveSpeed = false; // reset flag for IsMaxSafeCurveSpeed reached - if speed on curve decreases
1946+
}
19471947
// Restore passenger tolerance gradually (100 seconds)
19481948
// Consist durability affects how large tolerance can grow (min 25, max 100)
19491949
ComfortTolerance += (Simulator.CurveDurability + 0.25f) * elapsedClockSeconds;
19501950
if (ComfortTolerance > 75.0f * Simulator.CurveDurability + 25.0f)
19511951
ComfortTolerance = 75.0f * Simulator.CurveDurability + 25.0f;
1952-
}
1952+
}
19531953

1954-
// If speed exceeds the overturning speed, then indicated that an error condition has been reached.
1954+
// If speed exceeds the overturning speed, then indicated that an error condition has been reached.
19551955
if (s > CriticalMaxSpeedMpS)
1956-
{
1957-
if (!IsCriticalMaxSpeed)
19581956
{
1959-
IsCriticalMaxSpeed = true; // set flag for IsCriticalSpeed reached
1957+
if (!IsCriticalMaxSpeed)
1958+
{
1959+
IsCriticalMaxSpeed = true; // set flag for IsCriticalSpeed reached
19601960

1961-
BrakeSystem.FrontBrakeHoseConnected = false; // break the brake hose connection between cars if the speed is too fast
1962-
Simulator.Confirmer.Message(ConfirmLevel.Warning, Simulator.Catalog.GetString("You were travelling too fast for this curve, and have snapped a brake hose on Car " + CarID + ". You will need to repair the hose and restart."));
1961+
BrakeSystem.FrontBrakeHoseConnected = false; // break the brake hose connection between cars if the speed is too fast
1962+
Simulator.Confirmer.Message(ConfirmLevel.Warning, Simulator.Catalog.GetString("You were travelling too fast for this curve, and have snapped a brake hose on Car " + CarID + ". You will need to repair the hose and restart."));
19631963

1964-
dbfEvalsnappedbrakehose = true;//Debrief eval
1964+
dbfEvalsnappedbrakehose = true;//Debrief eval
19651965

1966-
if (!ldbfevaltrainoverturned)
1967-
{
1968-
ldbfevaltrainoverturned = true;
1969-
DbfEvalTrainOverturned++;
1966+
if (!ldbfevaltrainoverturned)
1967+
{
1968+
ldbfevaltrainoverturned = true;
1969+
DbfEvalTrainOverturned++;
19701970
Train.DbfEvalValueChanged = true;//Debrief eval
1971+
}
19711972
}
1972-
}
19731973

1974-
}
1975-
else if (s < CriticalMaxSpeedMpS - SpeedToleranceMpS) // Reset notification once speed drops
1976-
{
1977-
if (IsCriticalMaxSpeed)
1974+
}
1975+
else if (s < CriticalMaxSpeedMpS - SpeedToleranceMpS) // Reset notification once speed drops
19781976
{
1979-
IsCriticalMaxSpeed = false; // reset flag for IsCriticalSpeed reached - if speed on curve decreases
1980-
ldbfevaltrainoverturned = false;
1981-
1982-
if (dbfEvalsnappedbrakehose)
1977+
if (IsCriticalMaxSpeed)
19831978
{
1984-
DbfEvalTravellingTooFastSnappedBrakeHose++;//Debrief eval
1985-
dbfEvalsnappedbrakehose = false;
1979+
IsCriticalMaxSpeed = false; // reset flag for IsCriticalSpeed reached - if speed on curve decreases
1980+
ldbfevaltrainoverturned = false;
1981+
1982+
if (dbfEvalsnappedbrakehose)
1983+
{
1984+
DbfEvalTravellingTooFastSnappedBrakeHose++;//Debrief eval
1985+
dbfEvalsnappedbrakehose = false;
19861986
Train.DbfEvalValueChanged = true;//Debrief eval
1987-
}
1987+
}
19881988

1989+
}
19891990
}
1990-
}
19911991

1992-
// if speed doesn't reach minimum speed required around the curve then set notification
1993-
// Breaking of brake hose will not apply to TT mode or AI trains or if on a curve less then 150m to cover operation in shunting yards, where track would mostly have no superelevation
1992+
// if speed doesn't reach minimum speed required around the curve then set notification
1993+
// Breaking of brake hose will not apply to TT mode or AI trains or if on a curve less then 150m to cover operation in shunting yards, where track would mostly have no superelevation
19941994
//if (s < CriticalMinSpeedMpS && CurrentCurveRadiusM > 150)
19951995
//{
1996-
// if (!IsCriticalMinSpeed)
1997-
// {
1998-
// IsCriticalMinSpeed = true; // set flag for IsCriticalSpeed not reached
1996+
// if (!IsCriticalMinSpeed)
1997+
// {
1998+
// IsCriticalMinSpeed = true; // set flag for IsCriticalSpeed not reached
19991999

2000-
// Simulator.Confirmer.Message(ConfirmLevel.Warning, Simulator.Catalog.GetString("You were travelling too slow for this curve, and Car " + CarID + "may topple over."));
2001-
// }
2000+
// Simulator.Confirmer.Message(ConfirmLevel.Warning, Simulator.Catalog.GetString("You were travelling too slow for this curve, and Car " + CarID + "may topple over."));
2001+
// }
20022002

20032003
//}
20042004
//else if (s > CriticalMinSpeedMpS + SpeedToleranceMpS) // Reset notification once speed increases
20052005
//{
2006-
// if (IsCriticalMinSpeed)
2007-
// {
2008-
// IsCriticalMinSpeed = false; // reset flag for IsCriticalSpeed reached - if speed on curve decreases
2009-
// }
2006+
// if (IsCriticalMinSpeed)
2007+
// {
2008+
// IsCriticalMinSpeed = false; // reset flag for IsCriticalSpeed reached - if speed on curve decreases
2009+
// }
20102010
//}
20112011

20122012
#if DEBUG_CURVE_SPEED
2013-
Trace.TraceInformation("================================== TrainCar.cs - DEBUG_CURVE_SPEED ==============================================================");
2014-
Trace.TraceInformation("CarID {0} Curve Radius {1} Super {2} Unbalanced {3} Durability {4}", CarID, CurrentCurveRadius, SuperelevationM, UnbalancedSuperElevationM, Simulator.CurveDurability);
2015-
Trace.TraceInformation("CoG {0}", CentreOfGravityM);
2016-
Trace.TraceInformation("Current Speed {0} Equal Load Speed {1} Max Safe Speed {2} Critical Max Speed {3} Critical Min Speed {4}", MpS.ToMpH(s), MpS.ToMpH(MaxCurveEqualLoadSpeedMps), MpS.ToMpH(MaxSafeCurveSpeedMps), MpS.ToMpH(CriticalMaxSpeedMpS), MpS.ToMpH(CriticalMinSpeedMpS));
2017-
Trace.TraceInformation("IsMaxSafeSpeed {0} IsCriticalSpeed {1}", IsMaxSafeCurveSpeed, IsCriticalSpeed);
2013+
Trace.TraceInformation("================================== TrainCar.cs - DEBUG_CURVE_SPEED ==============================================================");
2014+
Trace.TraceInformation("CarID {0} Curve Radius {1} Super {2} Unbalanced {3} Durability {4}", CarID, CurrentCurveRadius, SuperelevationM, UnbalancedSuperElevationM, Simulator.CurveDurability);
2015+
Trace.TraceInformation("CoG {0}", CentreOfGravityM);
2016+
Trace.TraceInformation("Current Speed {0} Equal Load Speed {1} Max Safe Speed {2} Critical Max Speed {3} Critical Min Speed {4}", MpS.ToMpH(s), MpS.ToMpH(MaxCurveEqualLoadSpeedMps), MpS.ToMpH(MaxSafeCurveSpeedMps), MpS.ToMpH(CriticalMaxSpeedMpS), MpS.ToMpH(CriticalMinSpeedMpS));
2017+
Trace.TraceInformation("IsMaxSafeSpeed {0} IsCriticalSpeed {1}", IsMaxSafeCurveSpeed, IsCriticalSpeed);
20182018
#endif
2019-
}
2019+
}
20202020
else
20212021
{
20222022
// reset flags if train is on a straight - in preparation for next curve
@@ -2821,9 +2821,9 @@ public void ComputePosition(Traveller traveler, bool backToFront, float elapsedT
28212821

28222822
if (p.SumWgt > 1.5f)
28232823
{
2824-
p.FindCenterLine();
2824+
p.FindCenterLine();
28252825
p0.AddPartLocation(1, p);
2826-
}
2826+
}
28272827
else if (p.SumWgt > 0.5f) // Handle edge case of single axle pony trucks
28282828
{
28292829
double d = p.OffsetM - p.SumOffset / p.SumWgt;
@@ -2861,7 +2861,7 @@ public void ComputePosition(Traveller traveler, bool backToFront, float elapsedT
28612861
WorldPosition.XNAMatrix = m;
28622862
WorldPosition.TileX = tileX;
28632863
WorldPosition.TileZ = tileZ;
2864-
2864+
28652865
UpdatedTraveler(traveler, elapsedTimeS, distance, speed);
28662866
}
28672867

@@ -3526,7 +3526,7 @@ public int Compare(WheelAxle a, WheelAxle b)
35263526
// data and methods used to align trucks and models to track
35273527
public class TrainCarPart
35283528
{
3529-
public float OffsetM; // distance from center of model, positive forward
3529+
public float OffsetM; // distance from center of model, positive forward
35303530
public int iMatrix; // matrix index in shape that needs to be moved
35313531
// line fitting variables
35323532
public double SumWgt; // Sum of component weights

Source/RunActivity/Viewer3D/Shapes.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -279,9 +279,9 @@ public PoseableShape(Viewer viewer, string path, WorldPosition initialPosition,
279279
{
280280
if (SharedShape.Matrices.Length > 0)
281281
{
282-
XNAMatrices = new Matrix[SharedShape.Matrices.Length];
283-
for (int iMatrix = 0; iMatrix < SharedShape.Matrices.Length; ++iMatrix)
284-
XNAMatrices[iMatrix] = SharedShape.Matrices[iMatrix];
282+
XNAMatrices = new Matrix[SharedShape.Matrices.Length];
283+
for (int iMatrix = 0; iMatrix < SharedShape.Matrices.Length; ++iMatrix)
284+
XNAMatrices[iMatrix] = SharedShape.Matrices[iMatrix];
285285
}
286286
else // If the shape file is missing or fails to load, we need some default data to prevent crashes
287287
{

0 commit comments

Comments
 (0)