summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-04-19 08:34:03 +0000
committerrubidium <rubidium@openttd.org>2008-04-19 08:34:03 +0000
commite0722751c6515dadfba4944ed35f3fa6f6bcd751 (patch)
treed2195dbb56564761e218f386fde96c6568aa21f3 /src
parent49cfba55bbaa018d199402547968dcaabea82b29 (diff)
downloadopenttd-e0722751c6515dadfba4944ed35f3fa6f6bcd751.tar.xz
(svn r12783) -Codechange: do not statically allocate the 'temporary map3 array' in the oldloader.
Diffstat (limited to 'src')
-rw-r--r--src/oldloader.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/oldloader.cpp b/src/oldloader.cpp
index 5672f228f..7b32fd1f4 100644
--- a/src/oldloader.cpp
+++ b/src/oldloader.cpp
@@ -401,7 +401,7 @@ extern uint _animated_tile_count;
extern char *_old_name_array;
static byte _old_vehicle_multiplier;
-static uint8 _old_map3[OLD_MAP_SIZE * 2];
+static uint8 *_old_map3;
static bool _new_ttdpatch_format;
static uint32 _old_town_index;
static uint16 _old_string_id;
@@ -1608,8 +1608,10 @@ static bool LoadOldMain(LoadgameState *ls)
DEBUG(oldloader, 3, "Reading main chunk...");
/* Load the biggest chunk */
+ _old_map3 = MallocT<byte>(OLD_MAP_SIZE * 2);
if (!LoadChunk(ls, NULL, main_chunk)) {
DEBUG(oldloader, 0, "Loading failed");
+ free(_old_map3);
return false;
}
DEBUG(oldloader, 3, "Done, converting game data...");
@@ -1676,6 +1678,8 @@ static bool LoadOldMain(LoadgameState *ls)
DEBUG(oldloader, 3, "Finished converting game data");
DEBUG(oldloader, 1, "TTD(Patch) savegame successfully converted");
+ free(_old_map3);
+
return true;
}