summaryrefslogtreecommitdiff
path: root/src/saveload/map_sl.cpp
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-10-30 11:13:12 +0100
committerErich Eckner <git@eckner.net>2022-01-16 21:58:15 +0100
commit0c5ba5b7bf9a9dfa78c026f4da656940a460f47d (patch)
treed2a44494bbd70425b8f9e0e22b8c4e4dd8223001 /src/saveload/map_sl.cpp
parent523901887827768d6bff347ddb57787b295cc9e1 (diff)
downloadopenttd-0c5ba5b7bf9a9dfa78c026f4da656940a460f47d.tar.xz
underground patch applied
Diffstat (limited to 'src/saveload/map_sl.cpp')
-rw-r--r--src/saveload/map_sl.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/saveload/map_sl.cpp b/src/saveload/map_sl.cpp
index 07a36d6a3..e85313762 100644
--- a/src/saveload/map_sl.cpp
+++ b/src/saveload/map_sl.cpp
@@ -13,6 +13,7 @@
#include "compat/map_sl_compat.h"
#include "../map_func.h"
+#include "../layer_func.h"
#include "../core/bitmath_func.hpp"
#include "../fios.h"
#include <array>
@@ -21,10 +22,12 @@
static uint32 _map_dim_x;
static uint32 _map_dim_y;
+static uint32 _layer_count;
static const SaveLoad _map_desc[] = {
SLEG_CONDVAR("dim_x", _map_dim_x, SLE_UINT32, SLV_6, SL_MAX_VERSION),
SLEG_CONDVAR("dim_y", _map_dim_y, SLE_UINT32, SLV_6, SL_MAX_VERSION),
+ SLEG_CONDVAR("layer_count", _layer_count, SLE_UINT32, SLV_6, SL_MAX_VERSION),
};
struct MAPSChunkHandler : ChunkHandler {
@@ -36,6 +39,7 @@ struct MAPSChunkHandler : ChunkHandler {
_map_dim_x = MapSizeX();
_map_dim_y = MapSizeY();
+ _layer_count = LayerCount();
SlSetArrayIndex(0);
SlGlobList(_map_desc);
@@ -49,7 +53,7 @@ struct MAPSChunkHandler : ChunkHandler {
SlGlobList(slt);
if (!IsSavegameVersionBefore(SLV_RIFF_TO_ARRAY) && SlIterateArray() != -1) SlErrorCorrupt("Too many MAPS entries");
- AllocateMap(_map_dim_x, _map_dim_y);
+ AllocateMap(_map_dim_x, _map_dim_y/_layer_count, _layer_count);
}
void LoadCheck(size_t) const override