3232using ORTS . Common ;
3333using ORTS . Scripting . Api ;
3434using ORTS . Settings ;
35+ using SharpDX . MediaFoundation ;
3536using System ;
3637using System . Collections . Generic ;
3738using System . Diagnostics ;
3839using System . IO ;
40+ using System . Runtime . Remoting . Messaging ;
3941using Event = Orts . Common . Event ;
4042
4143namespace Orts . Simulation
@@ -58,6 +60,20 @@ namespace Orts.Simulation
5860 /// </summary>
5961 public class Simulator
6062 {
63+ /// <summary>
64+ /// Sets the frame rate object so its value can be read from anywhere in the Simulator and used to tune simulation algorithms.
65+ /// </summary>
66+ /// <param name="frameRate"></param>
67+ public static void SetFrameRate ( SmoothedData frameRate )
68+ {
69+ FrameRate = frameRate ;
70+ }
71+ public static float SmoothedFrameRate
72+ {
73+ get { return FrameRate . SmoothedValue ; }
74+ }
75+ private static SmoothedData FrameRate ;
76+
6177 public static GettextResourceManager Catalog { get ; private set ; }
6278 public static Random Random { get ; private set ; }
6379 public static double Resolution = 1000000 ; // resolution for calculation of random value with a pseudo-gaussian distribution
@@ -1355,8 +1371,8 @@ private Train InitializePlayerTrain()
13551371 train . AITrainBrakePercent = 100 ; //<CSComment> This seems a tricky way for the brake modules to test if it is an AI train or not
13561372 train . EqualReservoirPressurePSIorInHg = prevEQres ; // The previous command modifies EQ reservoir pressure, causing issues with EP brake systems, so restore to prev value
13571373
1358- // if ((PlayerLocomotive as MSTSLocomotive).EOTEnabled != MSTSLocomotive.EOTenabled.no)
1359- // train.EOT = new EOT((PlayerLocomotive as MSTSLocomotive).EOTEnabled, false, train);
1374+ // if ((PlayerLocomotive as MSTSLocomotive).EOTEnabled != MSTSLocomotive.EOTenabled.no)
1375+ // train.EOT = new EOT((PlayerLocomotive as MSTSLocomotive).EOTEnabled, false, train);
13601376
13611377 return ( train ) ;
13621378 }
@@ -1432,8 +1448,8 @@ private AITrain InitializeAPPlayerTrain()
14321448
14331449 if ( conFileName . Contains ( "tilted" ) ) train . IsTilting = true ;
14341450
1435- // if ((PlayerLocomotive as MSTSLocomotive).EOTEnabled != MSTSLocomotive.EOTenabled.no)
1436- // train.EOT = new EOT((PlayerLocomotive as MSTSLocomotive).EOTEnabled, false, train);
1451+ // if ((PlayerLocomotive as MSTSLocomotive).EOTEnabled != MSTSLocomotive.EOTenabled.no)
1452+ // train.EOT = new EOT((PlayerLocomotive as MSTSLocomotive).EOTEnabled, false, train);
14371453
14381454 return train ;
14391455 }
@@ -1487,7 +1503,7 @@ private void InitializeStaticConsists()
14871503
14881504 if ( ! File . Exists ( wagonFilePath ) )
14891505 {
1490- Trace . TraceWarning ( $ "Ignored missing { ( wagon . IsEngine ? "engine" : "wagon" ) } { wagonFilePath } in activity definition { activityObject . Train_Config . TrainCfg . Name } ") ;
1506+ Trace . TraceWarning ( $ "Ignored missing { ( wagon . IsEngine ? "engine" : "wagon" ) } { wagonFilePath } in activity definition { activityObject . Train_Config . TrainCfg . Name } ") ;
14911507 continue ;
14921508 }
14931509
@@ -1897,7 +1913,7 @@ private void StartSwitchPlayerTrain()
18971913 if ( playerTrain != null )
18981914 {
18991915 if ( playerTrain . ControlMode == Train . TRAIN_CONTROL . MANUAL ) TrainSwitcher . SuspendOldPlayer = true ; // force suspend state to avoid disappearing of train;
1900- if ( TrainSwitcher . SuspendOldPlayer &&
1916+ if ( TrainSwitcher . SuspendOldPlayer &&
19011917 ( playerTrain . SpeedMpS < - 0.025 || playerTrain . SpeedMpS > 0.025 || playerTrain . PresentPosition [ 0 ] . TCOffset != playerTrain . PreviousPosition [ 0 ] . TCOffset ) )
19021918 {
19031919 Confirmer . Message ( ConfirmLevel . Warning , Catalog . GetString ( "Train can't be suspended with speed not equal 0" ) ) ;
@@ -2116,10 +2132,10 @@ public void RestartWaitingTrain(RestartWaitingTrain restartWaitingTrain)
21162132 }
21172133 }
21182134 if ( trainToRestart == null )
2119- Trace . TraceWarning ( "Train {0} to restart not found" , restartWaitingTrain . WaitingTrainToRestart ) ;
2135+ Trace . TraceWarning ( "Train {0} to restart not found" , restartWaitingTrain . WaitingTrainToRestart ) ;
21202136 }
21212137
2122-
2138+
21232139
21242140 /// <summary>
21252141 /// Derive log-file name from route path and activity name
0 commit comments