diff options
Diffstat (limited to 'src/saveload/map_sl.cpp')
-rw-r--r-- | src/saveload/map_sl.cpp | 6 |
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 |