The initial loading screen is closed if an exception is thrown during loading. Causes the game to crash due to the unloaded content, but that's better than letting the game hang on the loading screen.

This commit is contained in:
Regalis
2017-03-30 21:54:58 +03:00
parent c368d6ddf1
commit 2f638a4c01
+10 -1
View File
@@ -69,6 +69,7 @@ namespace Barotrauma
public static GameSettings Config;
private CoroutineHandle loadingCoroutine;
private bool hasLoaded;
private GameTime fixedTime;
@@ -203,7 +204,7 @@ namespace Barotrauma
loadingScreenOpen = true;
TitleScreen = new LoadingScreen(GraphicsDevice);
CoroutineManager.StartCoroutine(Load());
loadingCoroutine = CoroutineManager.StartCoroutine(Load());
}
public IEnumerable<object> Load()
@@ -333,6 +334,14 @@ namespace Barotrauma
{
loadingScreenOpen = false;
}
if (!hasLoaded && !CoroutineManager.IsCoroutineRunning(loadingCoroutine))
{
DebugConsole.ThrowError("Loading was interrupted due to an error");
loadingScreenOpen = false;
loadingCoroutine = null;
hasLoaded = true;
}
}
else if (hasLoaded)
{