summaryrefslogtreecommitdiff
path: root/src/mapgen/mg_biome.cpp
diff options
context:
space:
mode:
authorParamat <paramat@users.noreply.github.com>2018-06-08 23:24:36 +0100
committerGitHub <noreply@github.com>2018-06-08 23:24:36 +0100
commit0b23253447623cadf1c394984ce0eee977d54b9b (patch)
tree6417d00f8d850eeb9e9fbda0b7dcf94705763efe /src/mapgen/mg_biome.cpp
parent9ca37d86a3f8fd35150880e3c64cb81796430d68 (diff)
downloadminetest-0b23253447623cadf1c394984ce0eee977d54b9b.tar.gz
minetest-0b23253447623cadf1c394984ce0eee977d54b9b.tar.bz2
minetest-0b23253447623cadf1c394984ce0eee977d54b9b.zip
Mapgen flags: Add 'biomes' global mapgen flag (#7355)
Previously the only way to disable biomes was to 'clear' the registered biomes in a mod, but this method causes large amounts of unnecessary processing: 1. Calculation of 4 2D noises. 2. Looping through all nodes of a mapchunk replacing nodes with identical nodes. The new flag disables those operations.
Diffstat (limited to 'src/mapgen/mg_biome.cpp')
-rw-r--r--src/mapgen/mg_biome.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/mapgen/mg_biome.cpp b/src/mapgen/mg_biome.cpp
index 42f762709..e02eee703 100644
--- a/src/mapgen/mg_biome.cpp
+++ b/src/mapgen/mg_biome.cpp
@@ -192,7 +192,12 @@ BiomeGenOriginal::BiomeGenOriginal(BiomeManager *biomemgr,
heatmap = noise_heat->result;
humidmap = noise_humidity->result;
+
biomemap = new biome_t[m_csize.X * m_csize.Z];
+ // Initialise with the ID of the default biome so that cavegen can get
+ // biomes when biome generation (which calculates the biomemap IDs) is
+ // disabled.
+ memset(biomemap, 0, sizeof(biome_t) * m_csize.X * m_csize.Z);
}
BiomeGenOriginal::~BiomeGenOriginal()