1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-15 19:13:07 +01:00

Add exception handling in LoadParkFromFile.

This commit is contained in:
ZehMatt
2018-01-18 11:48:53 +01:00
committed by Richard Jenkins
parent fdeaaa5631
commit abd74dbb1e

View File

@@ -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<uint32>(currentUpdateTick - _lastUpdateTick, 500);
_lastUpdateTick = currentUpdateTick;
if (game_is_not_paused())
{
gPaletteEffectFrame += gTicksSinceLastUpdate;