diff options
author | NiLSPACE <niels.breuker@hotmail.nl> | 2016-03-05 23:56:08 +0100 |
---|---|---|
committer | NiLSPACE <niels.breuker@hotmail.nl> | 2016-08-14 13:32:39 +0200 |
commit | ab6e8b790c1269912aceb7b3759a7c03e4deca08 (patch) | |
tree | 034715fc9dee76e742c5e20cc95fd443d3033013 /src/Generating/FinishGen.h | |
parent | Typo in IniFile:GetNumKeys() code sample (#3317) (diff) | |
download | cuberite-ab6e8b790c1269912aceb7b3759a7c03e4deca08.tar cuberite-ab6e8b790c1269912aceb7b3759a7c03e4deca08.tar.gz cuberite-ab6e8b790c1269912aceb7b3759a7c03e4deca08.tar.bz2 cuberite-ab6e8b790c1269912aceb7b3759a7c03e4deca08.tar.lz cuberite-ab6e8b790c1269912aceb7b3759a7c03e4deca08.tar.xz cuberite-ab6e8b790c1269912aceb7b3759a7c03e4deca08.tar.zst cuberite-ab6e8b790c1269912aceb7b3759a7c03e4deca08.zip |
Diffstat (limited to 'src/Generating/FinishGen.h')
-rw-r--r-- | src/Generating/FinishGen.h | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/src/Generating/FinishGen.h b/src/Generating/FinishGen.h index 8e90f9f2a..30108b6da 100644 --- a/src/Generating/FinishGen.h +++ b/src/Generating/FinishGen.h @@ -70,6 +70,80 @@ protected: +class cFinishGenClumpTopBlock : + public cFinishGen +{ +public: + // Contains the meta, type and weight for a clump block + struct FoliageInfo + { + BLOCKTYPE m_BlockType; + NIBBLETYPE m_BlockMeta; + int m_Weight; + + FoliageInfo(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, int a_Weight) : + m_BlockType(a_BlockType), + m_BlockMeta(a_BlockMeta), + m_Weight(a_Weight) + {} + }; + + // Contains the minimum and maximum amount of clumps for a biome and it's blocks. + struct BiomeInfo + { + int m_MinNumClumpsPerChunk; + int m_MaxNumClumpsPerChunk; + std::vector<FoliageInfo> m_Blocks; + + BiomeInfo() : + m_MinNumClumpsPerChunk(0), + m_MaxNumClumpsPerChunk(2), + m_Blocks() + {} + + BiomeInfo(int a_MinNumClumpsPerChunk, int a_MaxNumClumpsPerChunk, std::vector<FoliageInfo> a_Blocks) : + m_MinNumClumpsPerChunk(a_MinNumClumpsPerChunk), + m_MaxNumClumpsPerChunk(a_MaxNumClumpsPerChunk), + m_Blocks(a_Blocks) + {} + }; + + + cFinishGenClumpTopBlock(int a_Seed, std::vector<BiomeInfo> a_BlockList) : + m_Noise(a_Seed), + m_FlowersPerBiome() + { + std::swap(a_BlockList, m_FlowersPerBiome); + } + + /** Parses a string and puts a vector with a length of biMaxVariantBiome in a_Output. + The format of the string is "<Biomes separated with a comma>;<Blocks separated with a comma>". This can also be repeated with a | */ + static void ParseConfigurationString(AString a_String, std::vector<BiomeInfo> & a_Output); + + /** Parses an inifile in search for all clumps */ + static std::vector<BiomeInfo> ParseIniFile(cIniFile & a_IniFile, AString a_ClumpPrefix); +protected: + + cNoise m_Noise; + std::vector<BiomeInfo> m_FlowersPerBiome; + + /** The maximum number of foliage per clump */ + const int MAX_NUM_FOLIAGE = 8; + + /** The mininum number of foliage per clump */ + const int MIN_NUM_FOLIAGE = 4; + + /** The maximum range a foliage can be placed from the center of the clump */ + const int RANGE_FROM_CENTER = 5; + + void TryPlaceFoliageClump(cChunkDesc & a_ChunkDesc, int a_RelX, int a_RelZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, bool a_IsDoubleTall); + virtual void GenFinish(cChunkDesc & a_ChunkDesc) override; +}; + + + + + class cFinishGenGlowStone : public cFinishGen { |