4141#include " Rendering/CommandDrawer.h"
4242#include " Rendering/LineDrawer.h"
4343#include " Rendering/GlobalRendering.h"
44- #include " Rendering/Env/Particles/ProjectileDrawer.h"
4544#include " Rendering/DebugDrawerAI.h"
4645#include " Rendering/HUDDrawer.h"
4746#include " Rendering/IconHandler.h"
4847#include " Rendering/TeamHighlight.h"
4948#include " Rendering/UnitDrawer.h"
5049#include " Rendering/Map/InfoTexture/IInfoTextureHandler.h"
51- #include " Rendering/Textures/ColorMap.h"
5250#include " Rendering/Textures/NamedTextures.h"
5351#include " Lua/LuaGaia.h"
5452#include " Lua/LuaHandle.h"
9391#include " Sim/Weapons/WeaponDefHandler.h"
9492#include " UI/CommandColors.h"
9593#include " UI/EndGameBox.h"
96- #include " UI/GameInfo.h"
9794#include " UI/GameSetupDrawer.h"
9895#include " UI/GuiHandler.h"
9996#include " UI/InfoConsole.h"
10097#include " UI/KeyBindings.h"
10198#include " UI/KeyCodes.h"
10299#include " UI/MiniMap.h"
103100#include " UI/MouseHandler.h"
104- #include " UI/QuitBox.h"
105101#include " UI/ResourceBar.h"
106102#include " UI/SelectionKeyHandler.h"
107- #include " UI/ShareBox.h"
108103#include " UI/TooltipConsole.h"
109104#include " UI/ProfileDrawer.h"
110105#include " UI/Groups/GroupHandler.h"
116111#include " System/myMath.h"
117112#include " Net/GameServer.h"
118113#include " Net/Protocol/NetProtocol.h"
119- #include " System/SpringApp.h"
120114#include " System/Util.h"
121- #include " System/Input/KeyInput.h"
122115#include " System/FileSystem/FileSystem.h"
123116#include " System/LoadSave/LoadSaveHandler.h"
124117#include " System/LoadSave/DemoRecorder.h"
@@ -372,7 +365,7 @@ void CGame::AddTimedJobs()
372365 }
373366}
374367
375- void CGame::LoadGame (const std::string& mapName, bool threaded )
368+ void CGame::LoadGame (const std::string& mapName)
376369{
377370 // NOTE:
378371 // this is needed for LuaHandle::CallOut*UpdateCallIn
@@ -385,43 +378,68 @@ void CGame::LoadGame(const std::string& mapName, bool threaded)
385378 bool forcedQuit = false ;
386379
387380 try {
388- LOG (" [Game::%s][1] globalQuit=%d threaded=%d" , __func__, globalQuit, threaded );
381+ LOG (" [Game::%s][1] globalQuit=%d threaded=%d" , __func__, globalQuit, ! Threading::IsMainThread () );
389382
390383 if (!globalQuit) LoadMap (mapName);
391384 if (!globalQuit) LoadDefs ();
392385 } catch (const content_error& e) {
393- LOG ( " [Game::%s][1] forced quit with exception \" %s\" " , __func__, e.what ());
386+ LOG_L ( L_WARNING , " [Game::%s][1] forced quit with exception \" %s\" " , __func__, e.what ());
394387
395388 // we can not (yet) do a clean early exit here because the dtor assumes
396389 // all loading stages proceeded normally; just force automatic shutdown
397390 forcedQuit = true ;
398391 }
399392
400- LOG (" [Game::%s][2] globalQuit=%d forcedQuit=%d" , __func__, globalQuit, forcedQuit);
393+ try {
394+ LOG (" [Game::%s][2] globalQuit=%d forcedQuit=%d" , __func__, globalQuit, forcedQuit);
401395
402- if (!globalQuit) PreLoadSimulation ();
403- if (!globalQuit) PreLoadRendering ();
396+ if (!globalQuit) PreLoadSimulation ();
397+ if (!globalQuit) PreLoadRendering ();
398+ } catch (const content_error& e) {
399+ LOG_L (L_WARNING , " [Game::%s][2] forced quit with exception \" %s\" " , __func__, e.what ());
400+ forcedQuit = true ;
401+ }
404402
405- LOG (" [Game::%s][3] globalQuit=%d forcedQuit=%d" , __func__, globalQuit, forcedQuit);
403+ try {
404+ LOG (" [Game::%s][3] globalQuit=%d forcedQuit=%d" , __func__, globalQuit, forcedQuit);
406405
407- if (!globalQuit) PostLoadSimulation ();
408- if (!globalQuit) PostLoadRendering ();
406+ if (!globalQuit) PostLoadSimulation ();
407+ if (!globalQuit) PostLoadRendering ();
408+ } catch (const content_error& e) {
409+ LOG_L (L_WARNING , " [Game::%s][3] forced quit with exception \" %s\" " , __func__, e.what ());
410+ forcedQuit = true ;
411+ }
409412
410- LOG (" [Game::%s][4] globalQuit=%d forcedQuit=%d" , __func__, globalQuit, forcedQuit);
413+ try {
414+ LOG (" [Game::%s][4] globalQuit=%d forcedQuit=%d" , __func__, globalQuit, forcedQuit);
411415
412- if (!globalQuit) LoadInterface ();
413- if (!globalQuit) LoadLua ();
416+ if (!globalQuit) LoadInterface ();
417+ if (!globalQuit) LoadLua ();
418+ } catch (const content_error& e) {
419+ LOG_L (L_WARNING , " [Game::%s][4] forced quit with exception \" %s\" " , __func__, e.what ());
420+ forcedQuit = true ;
421+ }
414422
415- LOG (" [Game::%s][5] globalQuit=%d forcedQuit=%d" , __func__, globalQuit, forcedQuit);
423+ try {
424+ LOG (" [Game::%s][5] globalQuit=%d forcedQuit=%d" , __func__, globalQuit, forcedQuit);
416425
417- if (!globalQuit) LoadFinalize ();
418- if (!globalQuit) LoadSkirmishAIs ();
426+ if (!globalQuit) LoadFinalize ();
427+ if (!globalQuit) LoadSkirmishAIs ();
428+ } catch (const content_error& e) {
429+ LOG_L (L_WARNING , " [Game::%s][5] forced quit with exception \" %s\" " , __func__, e.what ());
430+ forcedQuit = true ;
431+ }
419432
420- LOG (" [Game::%s][6] globalQuit=%d forcedQuit=%d" , __func__, globalQuit, forcedQuit);
433+ try {
434+ LOG (" [Game::%s][6] globalQuit=%d forcedQuit=%d" , __func__, globalQuit, forcedQuit);
421435
422- if (!globalQuit && saveFile != nullptr ) {
423- loadscreen->SetLoadMessage (" Loading game" );
424- saveFile->LoadGame ();
436+ if (!globalQuit && saveFile != nullptr ) {
437+ loadscreen->SetLoadMessage (" Loading Saved Game" );
438+ saveFile->LoadGame ();
439+ }
440+ } catch (const content_error& e) {
441+ LOG_L (L_WARNING , " [Game::%s][6] forced quit with exception \" %s\" " , __func__, e.what ());
442+ forcedQuit = true ;
425443 }
426444
427445 finishedLoading = true ;
@@ -751,7 +769,7 @@ void CGame::PostLoad()
751769{
752770 GameSetupDrawer::Disable ();
753771
754- if (gameServer) {
772+ if (gameServer != nullptr ) {
755773 gameServer->PostLoad (gs->frameNum );
756774 }
757775}
0 commit comments