From 1f481b7a3065604df07da4a94366668c397952be Mon Sep 17 00:00:00 2001 From: LHoG <1476261+lhog@users.noreply.github.com> Date: Sat, 20 Mar 2021 20:03:40 +0300 Subject: [PATCH] Probably fixed heightmap save/load crash --- rts/Map/ReadMap.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/rts/Map/ReadMap.cpp b/rts/Map/ReadMap.cpp index 418f26becf..8d02a7d538 100644 --- a/rts/Map/ReadMap.cpp +++ b/rts/Map/ReadMap.cpp @@ -57,7 +57,7 @@ CR_REG_METADATA(MapDimensions, ( CR_BIND_INTERFACE(CReadMap) CR_REG_METADATA(CReadMap, ( - CR_IGNORED(initHeightBounds), + CR_MEMBER(initHeightBounds), CR_IGNORED(currHeightBounds), CR_IGNORED(heightRefMap), CR_IGNORED(boundingRadius), @@ -214,10 +214,14 @@ void CReadMap::Serialize(creg::ISerializer* s) s->Serialize(&type, sizeof(uint8_t)); } } else { + heightRefMap.clear(); for (unsigned int i = 0; i < (mapDims.mapxp1 * mapDims.mapyp1); i++) { s->Serialize(&height, sizeof(int32_t)); ichms[i] = height ^ iochms[i]; + const float h = *reinterpret_cast(&ichms[i]); + UpdateHeightsRefMap(h); } + UpdateHeightBounds(); for (unsigned int i = 0; i < (mapDims.hmapx * mapDims.hmapy); i++) { s->Serialize(&type, sizeof(uint8_t));