浏览代码

Relax UI locking to reduce delays in AI actions

Ivan Savenko 1 年之前
父节点
当前提交
a3f9450d83
共有 1 个文件被更改,包括 9 次插入5 次删除
  1. 9 5
      client/gui/CGuiHandler.cpp

+ 9 - 5
client/gui/CGuiHandler.cpp

@@ -114,16 +114,20 @@ void CGuiHandler::renderFrame()
 	{
 	{
 		boost::mutex::scoped_lock interfaceLock(GH.interfaceMutex);
 		boost::mutex::scoped_lock interfaceLock(GH.interfaceMutex);
 
 
-		if(nullptr != curInt)
+		if (nullptr != curInt)
 			curInt->update();
 			curInt->update();
 
 
-		if(settings["video"]["showfps"].Bool())
+		if (settings["video"]["showfps"].Bool())
 			drawFPSCounter();
 			drawFPSCounter();
+	}
+
+	SDL_UpdateTexture(screenTexture, nullptr, screen->pixels, screen->pitch);
 
 
-		SDL_UpdateTexture(screenTexture, nullptr, screen->pixels, screen->pitch);
+	SDL_RenderClear(mainRenderer);
+	SDL_RenderCopy(mainRenderer, screenTexture, nullptr, nullptr);
 
 
-		SDL_RenderClear(mainRenderer);
-		SDL_RenderCopy(mainRenderer, screenTexture, nullptr, nullptr);
+	{
+		boost::mutex::scoped_lock interfaceLock(GH.interfaceMutex);
 
 
 		CCS->curh->render();
 		CCS->curh->render();