Skip to content

Commit

Permalink
Probably fixed heightmap save/load crash
Browse files Browse the repository at this point in the history
  • Loading branch information
lhog committed Mar 20, 2021
1 parent 98185ca commit 1f481b7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion rts/Map/ReadMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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<float*>(&ichms[i]);
UpdateHeightsRefMap(h);
}
UpdateHeightBounds();

for (unsigned int i = 0; i < (mapDims.hmapx * mapDims.hmapy); i++) {
s->Serialize(&type, sizeof(uint8_t));
Expand Down

0 comments on commit 1f481b7

Please sign in to comment.