aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mapgen_flat.cpp4
-rw-r--r--src/mapgen_v7.cpp24
2 files changed, 20 insertions, 8 deletions
diff --git a/src/mapgen_flat.cpp b/src/mapgen_flat.cpp
index c51b5e12e..0a44f71a5 100644
--- a/src/mapgen_flat.cpp
+++ b/src/mapgen_flat.cpp
@@ -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;
}
diff --git a/src/mapgen_v7.cpp b/src/mapgen_v7.cpp
index c4583578f..420d77185 100644
--- a/src/mapgen_v7.cpp
+++ b/src/mapgen_v7.cpp
@@ -97,16 +97,26 @@ 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;
- delete noise_mount_height;
- delete noise_ridge_uwater;
- delete noise_floatland_base;
- delete noise_float_base_height;
- delete noise_mountain;
- delete noise_ridge;
+
+ if (spflags & MGV7_MOUNTAINS)
+ delete noise_mount_height;
+
+ if (spflags & MGV7_FLOATLANDS) {
+ delete noise_floatland_base;
+ delete noise_float_base_height;
+ }
+
+ if (spflags & MGV7_RIDGES) {
+ delete noise_ridge_uwater;
+ delete noise_ridge;
+ }
+
+ if ((spflags & MGV7_MOUNTAINS) || (spflags & MGV7_FLOATLANDS))
+ delete noise_mountain;
}