summaryrefslogtreecommitdiffstats
path: root/src/Generating
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2015-04-21 23:09:27 +0200
committerMattes D <github@xoft.cz>2015-04-21 23:09:27 +0200
commit0ff75143511ff8400575466b84b74344286b56e0 (patch)
treef012b435f741e89305a9b3160446abe5b90b8d1d /src/Generating
parentNetwork: fixed excessive debug logging. (diff)
parentChanged default MaxThreshold value (diff)
downloadcuberite-0ff75143511ff8400575466b84b74344286b56e0.tar
cuberite-0ff75143511ff8400575466b84b74344286b56e0.tar.gz
cuberite-0ff75143511ff8400575466b84b74344286b56e0.tar.bz2
cuberite-0ff75143511ff8400575466b84b74344286b56e0.tar.lz
cuberite-0ff75143511ff8400575466b84b74344286b56e0.tar.xz
cuberite-0ff75143511ff8400575466b84b74344286b56e0.tar.zst
cuberite-0ff75143511ff8400575466b84b74344286b56e0.zip
Diffstat (limited to 'src/Generating')
-rw-r--r--src/Generating/CompoGen.cpp11
-rw-r--r--src/Generating/CompoGen.h2
2 files changed, 6 insertions, 7 deletions
diff --git a/src/Generating/CompoGen.cpp b/src/Generating/CompoGen.cpp
index cb9c04fd7..7cadc881a 100644
--- a/src/Generating/CompoGen.cpp
+++ b/src/Generating/CompoGen.cpp
@@ -218,7 +218,7 @@ void cCompoGenClassic::InitializeCompoGen(cIniFile & a_IniFile)
cCompoGenNether::cCompoGenNether(int a_Seed) :
m_Noise1(a_Seed + 10),
m_Noise2(a_Seed * a_Seed * 10 + a_Seed * 1000 + 6000),
- m_Threshold(0)
+ m_MaxThreshold(25000)
{
}
@@ -282,17 +282,16 @@ void cCompoGenNether::ComposeTerrain(cChunkDesc & a_ChunkDesc, const cChunkDesc:
// Interpolate between FloorLo and FloorHi:
for (int z = 0; z < 16; z++) for (int x = 0; x < 16; x++)
{
+ int Threshold = static_cast<int>(m_Noise1.CubicNoise2D(static_cast<float>(BaseX + x) / 75, static_cast<float>(BaseZ + z) / 75) * m_MaxThreshold);
int Lo = FloorLo[x + 17 * z] / 256;
int Hi = FloorHi[x + 17 * z] / 256;
for (int y = 0; y < SEGMENT_HEIGHT; y++)
{
int Val = Lo + (Hi - Lo) * y / SEGMENT_HEIGHT;
- BLOCKTYPE Block = E_BLOCK_AIR;
- if (Val < m_Threshold) // Don't calculate if the block should be Netherrack or Soulsand when it's already decided that it's air.
+ if (Val < Threshold) // Don't calculate if the block should be Netherrack when it's already decided that it's air.
{
- Block = E_BLOCK_NETHERRACK;
+ a_ChunkDesc.SetBlockType(x, y + Segment, z, E_BLOCK_NETHERRACK);
}
- a_ChunkDesc.SetBlockType(x, y + Segment, z, Block);
}
}
@@ -329,7 +328,7 @@ void cCompoGenNether::ComposeTerrain(cChunkDesc & a_ChunkDesc, const cChunkDesc:
void cCompoGenNether::InitializeCompoGen(cIniFile & a_IniFile)
{
- m_Threshold = a_IniFile.GetValueSetI("Generator", "NetherThreshold", m_Threshold);
+ m_MaxThreshold = a_IniFile.GetValueSetF("Generator", "NetherMaxThreshold", m_MaxThreshold);
}
diff --git a/src/Generating/CompoGen.h b/src/Generating/CompoGen.h
index 3847688cd..d4d38bfdd 100644
--- a/src/Generating/CompoGen.h
+++ b/src/Generating/CompoGen.h
@@ -99,7 +99,7 @@ protected:
cNoise m_Noise1;
cNoise m_Noise2;
- int m_Threshold;
+ double m_MaxThreshold;
// cTerrainCompositionGen overrides:
virtual void ComposeTerrain(cChunkDesc & a_ChunkDesc, const cChunkDesc::Shape & a_Shape) override;