summaryrefslogtreecommitdiffstats
path: root/source/Generating/DistortedHeightmap.cpp
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2013-10-11 10:18:01 +0200
committermadmaxoft <github@xoft.cz>2013-10-11 10:18:01 +0200
commita9e70c84b59032f8efcd634069ae97660a58eba1 (patch)
tree7cbbd0e1d70288fc61f0538c30c26dab8911b8e5 /source/Generating/DistortedHeightmap.cpp
parentAdded GetIniItemSet() function. (diff)
downloadcuberite-a9e70c84b59032f8efcd634069ae97660a58eba1.tar
cuberite-a9e70c84b59032f8efcd634069ae97660a58eba1.tar.gz
cuberite-a9e70c84b59032f8efcd634069ae97660a58eba1.tar.bz2
cuberite-a9e70c84b59032f8efcd634069ae97660a58eba1.tar.lz
cuberite-a9e70c84b59032f8efcd634069ae97660a58eba1.tar.xz
cuberite-a9e70c84b59032f8efcd634069ae97660a58eba1.tar.zst
cuberite-a9e70c84b59032f8efcd634069ae97660a58eba1.zip
Diffstat (limited to '')
-rw-r--r--source/Generating/DistortedHeightmap.cpp27
1 files changed, 26 insertions, 1 deletions
diff --git a/source/Generating/DistortedHeightmap.cpp b/source/Generating/DistortedHeightmap.cpp
index 6ac4d61d5..98eab31b5 100644
--- a/source/Generating/DistortedHeightmap.cpp
+++ b/source/Generating/DistortedHeightmap.cpp
@@ -60,7 +60,7 @@ cDistortedHeightmap::cDistortedHeightmap(int a_Seed, cBiomeGen & a_BiomeGen) :
m_OceanFloorSelect(a_Seed + 3000),
m_BiomeGen(a_BiomeGen),
m_UnderlyingHeiGen(a_Seed, a_BiomeGen),
- m_HeightGen(&m_UnderlyingHeiGen, 64)
+ m_HeightGen(m_UnderlyingHeiGen, 64)
{
m_NoiseDistortX.AddOctave((NOISE_DATATYPE)1, (NOISE_DATATYPE)0.5);
m_NoiseDistortX.AddOctave((NOISE_DATATYPE)0.5, (NOISE_DATATYPE)1);
@@ -77,11 +77,18 @@ cDistortedHeightmap::cDistortedHeightmap(int a_Seed, cBiomeGen & a_BiomeGen) :
void cDistortedHeightmap::Initialize(cIniFile & a_IniFile)
{
+ if (m_IsInitialized)
+ {
+ return;
+ }
+
// Read the params from the INI file:
m_SeaLevel = a_IniFile.GetValueSetI("Generator", "DistortedHeightmapSeaLevel", 62);
m_FrequencyX = (NOISE_DATATYPE)a_IniFile.GetValueSetF("Generator", "DistortedHeightmapFrequencyX", 10);
m_FrequencyY = (NOISE_DATATYPE)a_IniFile.GetValueSetF("Generator", "DistortedHeightmapFrequencyY", 10);
m_FrequencyZ = (NOISE_DATATYPE)a_IniFile.GetValueSetF("Generator", "DistortedHeightmapFrequencyZ", 10);
+
+ m_IsInitialized = true;
}
@@ -184,6 +191,15 @@ void cDistortedHeightmap::GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::He
+void cDistortedHeightmap::InitializeHeightGen(cIniFile & a_IniFile)
+{
+ Initialize(a_IniFile);
+}
+
+
+
+
+
void cDistortedHeightmap::ComposeTerrain(cChunkDesc & a_ChunkDesc)
{
// Frequencies for the ocean floor selecting noise:
@@ -311,6 +327,15 @@ void cDistortedHeightmap::ComposeTerrain(cChunkDesc & a_ChunkDesc)
+void cDistortedHeightmap::InitializeCompoGen(cIniFile & a_IniFile)
+{
+ Initialize(a_IniFile);
+}
+
+
+
+
+
int cDistortedHeightmap::GetHeightmapAt(NOISE_DATATYPE a_X, NOISE_DATATYPE a_Z)
{
int ChunkX = (int)floor(a_X / (NOISE_DATATYPE)16);