diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2013-05-05 18:27:08 +0200 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2013-05-05 18:27:08 +0200 |
commit | 270560a198db49464a5a5a6d75d9650a30208bc7 (patch) | |
tree | a1ab9162becfd1b0888a0beb359d09edb228093f /source/Generating/ComposableGenerator.cpp | |
parent | Lighting: Fixed underwater lighting (FS #369) (diff) | |
download | cuberite-270560a198db49464a5a5a6d75d9650a30208bc7.tar cuberite-270560a198db49464a5a5a6d75d9650a30208bc7.tar.gz cuberite-270560a198db49464a5a5a6d75d9650a30208bc7.tar.bz2 cuberite-270560a198db49464a5a5a6d75d9650a30208bc7.tar.lz cuberite-270560a198db49464a5a5a6d75d9650a30208bc7.tar.xz cuberite-270560a198db49464a5a5a6d75d9650a30208bc7.tar.zst cuberite-270560a198db49464a5a5a6d75d9650a30208bc7.zip |
Diffstat (limited to 'source/Generating/ComposableGenerator.cpp')
-rw-r--r-- | source/Generating/ComposableGenerator.cpp | 37 |
1 files changed, 35 insertions, 2 deletions
diff --git a/source/Generating/ComposableGenerator.cpp b/source/Generating/ComposableGenerator.cpp index 178ed4537..0dd14aa50 100644 --- a/source/Generating/ComposableGenerator.cpp +++ b/source/Generating/ComposableGenerator.cpp @@ -18,6 +18,7 @@ #include "FinishGen.h"
#include "Caves.h"
+#include "DistortedHeightmap.h"
#include "MineShafts.h"
#include "Noise3DGenerator.h"
#include "Ravines.h"
@@ -37,7 +38,9 @@ cComposableGenerator::cComposableGenerator(cChunkGenerator & a_ChunkGenerator) : m_HeightGen(NULL),
m_CompositionGen(NULL),
m_Noise3DComposable(NULL),
- m_NumNoise3DComposableUses(0)
+ m_NumNoise3DComposableUses(0),
+ m_DistortedHeightmap(NULL),
+ m_NumDistortedHeightmapUses(0)
{
}
@@ -60,7 +63,16 @@ cComposableGenerator::~cComposableGenerator() m_StructureGens.clear();
// CompositionGen must not be freed if it is shared between HeightGenCache and CompositionGen:
- if ((m_NumNoise3DComposableUses < 2) || (m_CompositionGen != m_Noise3DComposable))
+ int NumUsed = 1;
+ if (m_CompositionGen == m_Noise3DComposable)
+ {
+ NumUsed = m_NumNoise3DComposableUses;
+ }
+ else if (m_CompositionGen == m_DistortedHeightmap)
+ {
+ NumUsed = m_NumDistortedHeightmapUses;
+ }
+ if (NumUsed == 1)
{
delete m_CompositionGen;
}
@@ -241,6 +253,17 @@ void cComposableGenerator::InitHeightGen(cIniFile & a_IniFile) float HeightAmp3 = (float)a_IniFile.GetValueSetF("Generator", "ClassicHeightAmp3", 0.5);
m_HeightGen = new cHeiGenClassic(Seed, HeightFreq1, HeightAmp1, HeightFreq2, HeightAmp2, HeightFreq3, HeightAmp3);
}
+ else if (NoCaseCompare(HeightGenName, "DistortedHeightmap") == 0)
+ {
+ if (m_DistortedHeightmap == NULL)
+ {
+ m_DistortedHeightmap = new cDistortedHeightmap(Seed, *m_BiomeGen);
+ m_DistortedHeightmap->Initialize(a_IniFile);
+ }
+ m_HeightGen = m_DistortedHeightmap;
+ m_NumDistortedHeightmapUses++;
+ // TODO: Optimize by sharing with CompoGen
+ }
else if (NoCaseCompare(HeightGenName, "Noise3D") == 0)
{
if (m_Noise3DComposable == NULL)
@@ -327,6 +350,16 @@ void cComposableGenerator::InitCompositionGen(cIniFile & a_IniFile) BlockBeachBottom, BlockSea
);
}
+ else if (NoCaseCompare(CompoGenName, "DistortedHeightmap") == 0)
+ {
+ if (m_DistortedHeightmap == NULL)
+ {
+ m_DistortedHeightmap = new cDistortedHeightmap(m_ChunkGenerator.GetSeed(), *m_BiomeGen);
+ m_DistortedHeightmap->Initialize(a_IniFile);
+ }
+ m_CompositionGen = m_DistortedHeightmap;
+ m_NumDistortedHeightmapUses++;
+ }
else if (NoCaseCompare(CompoGenName, "nether") == 0)
{
m_CompositionGen = new cCompoGenNether(m_ChunkGenerator.GetSeed());
|