Skip to content

Commit

Permalink
Mgv6: Fix uninitialised heightmap used by cavegen
Browse files Browse the repository at this point in the history
  • Loading branch information
paramat committed Mar 11, 2015
1 parent b2b6bbf commit 29e46d6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/mapgen_v6.cpp
Expand Up @@ -56,7 +56,6 @@ MapgenV6::MapgenV6(int mapgenid, MapgenParams *params, EmergeManager *emerge)
this->ystride = csize.X; //////fix this

this->heightmap = new s16[csize.X * csize.Z];
memset(this->heightmap, 0, csize.X * csize.Z * sizeof(*this->heightmap));

MapgenV6Params *sp = (MapgenV6Params *)params->sparams;
this->spflags = sp->spflags;
Expand Down Expand Up @@ -480,6 +479,9 @@ void MapgenV6::makeChunk(BlockMakeData *data)

generateExperimental();

// Create initial heightmap to limit caves
updateHeightmap(node_min, node_max);

const s16 max_spread_amount = MAP_BLOCKSIZE;
// Limit dirt flow area by 1 because mud is flown into neighbors.
s16 mudflow_minpos = -max_spread_amount + 1;
Expand All @@ -504,7 +506,7 @@ void MapgenV6::makeChunk(BlockMakeData *data)

}

// Create heightmap after mudflow
// Update heightmap after mudflow
updateHeightmap(node_min, node_max);

// Add dungeons
Expand Down

0 comments on commit 29e46d6

Please sign in to comment.