1
0
Fork 0

src/Time/TimeManager.*: fixed bug when transitioning to simple-time.

We need to set _firstUpdate when /sim/time/simple-time/enabled changes to true,
otherwise there can be a delay before the FDM carries on.
This commit is contained in:
Julian Smith 2021-10-24 14:24:32 +01:00
parent e62c15cdad
commit 217d612d6a
2 changed files with 7 additions and 1 deletions

View file

@ -382,7 +382,12 @@ void TimeManager::computeTimeDeltasSimple(double& simDt, double& realDt)
void TimeManager::computeTimeDeltas(double& simDt, double& realDt) void TimeManager::computeTimeDeltas(double& simDt, double& realDt)
{ {
if (_simpleTimeEnabled->getBoolValue()) { bool simple_time = _simpleTimeEnabled->getBoolValue();
if (simple_time != _simpleTimeEnabledPrev) {
_simpleTimeEnabledPrev = simple_time;
_firstUpdate = true;
}
if (simple_time) {
computeTimeDeltasSimple(simDt, realDt); computeTimeDeltasSimple(simDt, realDt);
return; return;
} }

View file

@ -128,6 +128,7 @@ private:
SGPropertyNode_ptr _modelHz; SGPropertyNode_ptr _modelHz;
SGPropertyNode_ptr _timeDelta, _simTimeDelta; SGPropertyNode_ptr _timeDelta, _simTimeDelta;
bool _simpleTimeEnabledPrev = false;
SGPropertyNode_ptr _simpleTimeEnabled; SGPropertyNode_ptr _simpleTimeEnabled;
SGPropertyNode_ptr _simpleTimeUtc; SGPropertyNode_ptr _simpleTimeUtc;
SGPropertyNode_ptr _simpleTimeFdm; SGPropertyNode_ptr _simpleTimeFdm;