diff options
author | rubidium <rubidium@openttd.org> | 2010-07-30 22:57:46 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2010-07-30 22:57:46 +0000 |
commit | 24df43633cb1f647f71867512ce4cbc9f9672561 (patch) | |
tree | 4a374e67bd1e75bc2c33887c9e9c12ce8b7bbf8e /src/saveload/oldloader_sl.cpp | |
parent | 3aaeb311df8d720b0fd4449e3f9a4d7cd35a4ac0 (diff) | |
download | openttd-24df43633cb1f647f71867512ce4cbc9f9672561.tar.xz |
(svn r20247) -Fix: when it is known the loading an old savegame is going to fail, bail out immediately (using an exception) instead of going on until e.g. the expected number of byte is read
Diffstat (limited to 'src/saveload/oldloader_sl.cpp')
-rw-r--r-- | src/saveload/oldloader_sl.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/saveload/oldloader_sl.cpp b/src/saveload/oldloader_sl.cpp index cabbcb0ac..7e3c66ad1 100644 --- a/src/saveload/oldloader_sl.cpp +++ b/src/saveload/oldloader_sl.cpp @@ -1479,7 +1479,7 @@ static bool LoadOldMapPart1(LoadgameState *ls, int num) } } - return !ls->failed; + return true; } static bool LoadOldMapPart2(LoadgameState *ls, int num) @@ -1493,7 +1493,7 @@ static bool LoadOldMapPart2(LoadgameState *ls, int num) _m[i].m5 = ReadByte(ls); } - return !ls->failed; + return true; } static bool LoadTTDPatchExtraChunks(LoadgameState *ls, int num) @@ -1548,7 +1548,7 @@ static bool LoadTTDPatchExtraChunks(LoadgameState *ls, int num) } } - return !ls->failed; + return true; } extern TileIndex _cur_tileloop_tile; @@ -1734,11 +1734,17 @@ bool LoadTTDMain(LoadgameState *ls) SmallStackSafeStackAlloc<byte, OLD_MAP_SIZE * 2> map3; _old_map3 = map3.data; _old_vehicle_names = NULL; - if (!LoadChunk(ls, NULL, main_chunk)) { - DEBUG(oldloader, 0, "Loading failed"); + try { + if (!LoadChunk(ls, NULL, main_chunk)) { + DEBUG(oldloader, 0, "Loading failed"); + free(_old_vehicle_names); + return false; + } + } catch (...) { free(_old_vehicle_names); - return false; + throw; } + DEBUG(oldloader, 3, "Done, converting game data..."); FixTTDMapArray(); |