From 0c5ba5b7bf9a9dfa78c026f4da656940a460f47d Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Tue, 30 Oct 2018 11:13:12 +0100 Subject: underground patch applied --- src/saveload/map_sl.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/saveload/map_sl.cpp') 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 @@ -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 -- cgit v1.2.3-70-g09d2