1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-06 09:09:40 +02:00

FramerateManager.cpp: Merge this "if" statement with the enclosing one.

Collapsible "if" statements should be merged
This commit is contained in:
Alexander Wilms
2023-10-27 13:44:29 +00:00
parent bcaa2e5966
commit 3616235bb5

View File

@@ -28,14 +28,11 @@ void FramerateManager::framerateDelay()
{
Duration timeSpentBusy = Clock::now() - lastTimePoint;
if(!vsyncEnabled)
if(!vsyncEnabled && timeSpentBusy < targetFrameTime)
{
// if FPS is higher than it should be, then wait some time
if(timeSpentBusy < targetFrameTime)
{
boost::this_thread::sleep_for(targetFrameTime - timeSpentBusy);
}
}
// compute actual timeElapsed taking into account actual sleep interval
// limit it to 100 ms to avoid breaking animation in case of huge lag (e.g. triggered breakpoint)