GameMain throws an exception immediately if loading the game fails (instead of closing the loading screen and waiting for the inevitable crash)

This commit is contained in:
Regalis
2017-06-03 18:21:56 +03:00
parent f5d8669da3
commit 1f8460e8ad
2 changed files with 6 additions and 9 deletions
+5 -8
View File
@@ -181,16 +181,16 @@ namespace Barotrauma
ConvertUnits.SetDisplayUnitToSimUnitRatio(Physics.DisplayToSimRation); ConvertUnits.SetDisplayUnitToSimUnitRatio(Physics.DisplayToSimRation);
spriteBatch = new SpriteBatch(base.GraphicsDevice); spriteBatch = new SpriteBatch(GraphicsDevice);
TextureLoader.Init(base.GraphicsDevice); TextureLoader.Init(GraphicsDevice);
loadingScreenOpen = true; loadingScreenOpen = true;
TitleScreen = new LoadingScreen(base.GraphicsDevice); TitleScreen = new LoadingScreen(GraphicsDevice);
loadingCoroutine = CoroutineManager.StartCoroutine(Load()); loadingCoroutine = CoroutineManager.StartCoroutine(Load());
} }
public IEnumerable<object> Load() private IEnumerable<object> Load()
{ {
GUI.GraphicsDevice = base.GraphicsDevice; GUI.GraphicsDevice = base.GraphicsDevice;
GUI.Init(Content); GUI.Init(Content);
@@ -320,10 +320,7 @@ namespace Barotrauma
if (!hasLoaded && !CoroutineManager.IsCoroutineRunning(loadingCoroutine)) if (!hasLoaded && !CoroutineManager.IsCoroutineRunning(loadingCoroutine))
{ {
DebugConsole.ThrowError("Loading was interrupted due to an error"); throw new Exception("Loading was interrupted due to an error");
loadingScreenOpen = false;
loadingCoroutine = null;
hasLoaded = true;
} }
} }
else if (hasLoaded) else if (hasLoaded)
@@ -263,7 +263,7 @@ namespace Barotrauma.Items.Components
", Cooling rate: " + (int)coolingRate + ", Cooling rate: " + (int)coolingRate +
", Cooling rate: " + coolingRate + ", Cooling rate: " + coolingRate +
", Shutdown temp: " + shutDownTemp + ", Shutdown temp: " + shutDownTemp +
(autoTemp ? "Autotemp ON" : "Autotemp OFF"), (autoTemp ? ", Autotemp ON" : ", Autotemp OFF"),
ServerLog.MessageType.ItemInteraction); ServerLog.MessageType.ItemInteraction);
nextServerLogWriteTime = null; nextServerLogWriteTime = null;