mirror of
https://github.com/overte-org/overte.git
synced 2025-04-19 06:17:38 +02:00
Merge pull request #7507 from AndrewMeadows/broken-time-machine
fix "deadlock" when setting clock backwards
This commit is contained in:
commit
92ddf9d7ac
2 changed files with 13 additions and 4 deletions
|
@ -561,6 +561,12 @@ bool ParticleEffectEntityItem::needsToCallUpdate() const {
|
|||
|
||||
void ParticleEffectEntityItem::update(const quint64& now) {
|
||||
|
||||
// we check for 'now' in the past in case users set their clock backward
|
||||
if (now < _lastSimulated) {
|
||||
_lastSimulated = now;
|
||||
return;
|
||||
}
|
||||
|
||||
float deltaTime = (float)(now - _lastSimulated) / (float)USECS_PER_SECOND;
|
||||
_lastSimulated = now;
|
||||
|
||||
|
|
|
@ -673,11 +673,14 @@ void ScriptEngine::run() {
|
|||
}
|
||||
|
||||
qint64 now = usecTimestampNow();
|
||||
float deltaTime = (float) (now - lastUpdate) / (float) USECS_PER_SECOND;
|
||||
|
||||
if (!_isFinished) {
|
||||
if (_wantSignals) {
|
||||
emit update(deltaTime);
|
||||
// we check for 'now' in the past in case people set their clock back
|
||||
if (lastUpdate < now) {
|
||||
float deltaTime = (float) (now - lastUpdate) / (float) USECS_PER_SECOND;
|
||||
if (!_isFinished) {
|
||||
if (_wantSignals) {
|
||||
emit update(deltaTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
lastUpdate = now;
|
||||
|
|
Loading…
Reference in a new issue