Mgflat, Mgv7: Fix noise crash on world exit.

Fix crash caused by destructor 'delete' on noise objects that are not
created due to mapgen options.
Crash was caused by commit 57eaf62c697cec91890d9cb28d10385d293d2d3f
This commit is contained in:
paramat 2017-04-22 05:16:50 +01:00
parent f6d1b682d3
commit 4c03190ce8
2 changed files with 20 additions and 8 deletions

@ -73,8 +73,10 @@ MapgenFlat::MapgenFlat(int mapgenid, MapgenFlatParams *params, EmergeManager *em
MapgenFlat::~MapgenFlat()
{
delete noise_terrain;
delete noise_filler_depth;
if ((spflags & MGFLAT_LAKES) || (spflags & MGFLAT_HILLS))
delete noise_terrain;
}

@ -97,18 +97,28 @@ MapgenV7::MapgenV7(int mapgenid, MapgenV7Params *params, EmergeManager *emerge)
MapgenV7::~MapgenV7()
{
delete noise_terrain_base;
delete noise_terrain_alt;
delete noise_terrain_persist;
delete noise_height_select;
delete noise_terrain_alt;
delete noise_filler_depth;
if (spflags & MGV7_MOUNTAINS)
delete noise_mount_height;
delete noise_ridge_uwater;
if (spflags & MGV7_FLOATLANDS) {
delete noise_floatland_base;
delete noise_float_base_height;
delete noise_mountain;
}
if (spflags & MGV7_RIDGES) {
delete noise_ridge_uwater;
delete noise_ridge;
}
if ((spflags & MGV7_MOUNTAINS) || (spflags & MGV7_FLOATLANDS))
delete noise_mountain;
}
MapgenV7Params::MapgenV7Params()
{