Skip to content
This repository has been archived by the owner on Jan 5, 2024. It is now read-only.

Commit

Permalink
More little fixes to allow speed up
Browse files Browse the repository at this point in the history
  • Loading branch information
Causeless committed Dec 25, 2023
1 parent 3ab51fe commit 4fd7a6b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Managers/TimerMan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,10 @@ namespace RTE {
m_SimAccumulator += static_cast<long long>(static_cast<float>(timeIncrease) * m_TimeScale);
}

float maxPossibleSimSpeed = GetDeltaTimeMS() / g_PerformanceMan.GetMSPSUAverage();

// Make sure we don't get runaway behind schedule
m_SimAccumulator = std::min(m_SimAccumulator, m_DeltaTime + (m_DeltaTime / 2));
m_SimAccumulator = std::min(m_SimAccumulator, m_DeltaTime + static_cast<long long>(m_DeltaTime * maxPossibleSimSpeed));

RTEAssert(m_SimAccumulator >= 0, "Negative sim time accumulator?!");

Expand All @@ -116,6 +118,6 @@ namespace RTE {
m_SimUpdatesSinceDrawn = -1;
}

m_SimSpeed = std::min(GetDeltaTimeMS() / g_PerformanceMan.GetMSPSUAverage(), GetTimeScale());
m_SimSpeed = std::min(maxPossibleSimSpeed, GetTimeScale());
}
}

0 comments on commit 4fd7a6b

Please sign in to comment.