瀏覽代碼

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

Collapsible "if" statements should be merged
Alexander Wilms 2 年之前
父節點
當前提交
3616235bb5
共有 1 個文件被更改,包括 2 次插入5 次删除
  1. 2 5
      client/gui/FramerateManager.cpp

+ 2 - 5
client/gui/FramerateManager.cpp

@@ -28,13 +28,10 @@ void FramerateManager::framerateDelay()
 {
 {
 	Duration timeSpentBusy = Clock::now() - lastTimePoint;
 	Duration timeSpentBusy = Clock::now() - lastTimePoint;
 
 
-	if(!vsyncEnabled)
+	if(!vsyncEnabled && timeSpentBusy < targetFrameTime)
 	{
 	{
 		// if FPS is higher than it should be, then wait some time
 		// if FPS is higher than it should be, then wait some time
-		if(timeSpentBusy < targetFrameTime)
-		{
-			boost::this_thread::sleep_for(targetFrameTime - timeSpentBusy);
-		}
+		boost::this_thread::sleep_for(targetFrameTime - timeSpentBusy);
 	}
 	}
 
 
 	// compute actual timeElapsed taking into account actual sleep interval
 	// compute actual timeElapsed taking into account actual sleep interval