From abd74dbb1e44cbac3cb59cb49072fb3caf5dd744 Mon Sep 17 00:00:00 2001 From: ZehMatt Date: Thu, 18 Jan 2018 11:48:53 +0100 Subject: [PATCH] Add exception handling in LoadParkFromFile. --- src/openrct2/Context.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/openrct2/Context.cpp b/src/openrct2/Context.cpp index 04ddcb5cbd..b9a15e6f4b 100644 --- a/src/openrct2/Context.cpp +++ b/src/openrct2/Context.cpp @@ -380,8 +380,16 @@ namespace OpenRCT2 bool LoadParkFromFile(const std::string &path, bool loadTitleScreenOnFail) final override { - auto fs = FileStream(path, FILE_MODE_OPEN); - return LoadParkFromStream(&fs, path, loadTitleScreenOnFail); + try + { + auto fs = FileStream(path, FILE_MODE_OPEN); + return LoadParkFromStream(&fs, path, loadTitleScreenOnFail); + } + catch (const std::exception &e) + { + Console::Error::WriteLine(e.what()); + } + return false; } bool LoadParkFromStream(IStream * stream, const std::string &path, bool loadTitleScreenFirstOnFail) final override @@ -757,7 +765,7 @@ namespace OpenRCT2 uint32 currentUpdateTick = platform_get_ticks(); gTicksSinceLastUpdate = std::min(currentUpdateTick - _lastUpdateTick, 500); _lastUpdateTick = currentUpdateTick; - + if (game_is_not_paused()) { gPaletteEffectFrame += gTicksSinceLastUpdate;