diff options
author | madmaxoft <github@xoft.cz> | 2014-07-31 23:17:49 +0200 |
---|---|---|
committer | madmaxoft <github@xoft.cz> | 2014-07-31 23:17:49 +0200 |
commit | 6d02fce9a26d4272baea08dc58238321cca0183a (patch) | |
tree | 0109076ae52c67513259d7946a44b9f7b5a563fb /src/Generating/FinishGen.h | |
parent | Removed trailing whitespace. (diff) | |
parent | Merge pull request #1267 from mc-server/RoofedForest (diff) | |
download | cuberite-6d02fce9a26d4272baea08dc58238321cca0183a.tar cuberite-6d02fce9a26d4272baea08dc58238321cca0183a.tar.gz cuberite-6d02fce9a26d4272baea08dc58238321cca0183a.tar.bz2 cuberite-6d02fce9a26d4272baea08dc58238321cca0183a.tar.lz cuberite-6d02fce9a26d4272baea08dc58238321cca0183a.tar.xz cuberite-6d02fce9a26d4272baea08dc58238321cca0183a.tar.zst cuberite-6d02fce9a26d4272baea08dc58238321cca0183a.zip |
Diffstat (limited to 'src/Generating/FinishGen.h')
-rw-r--r-- | src/Generating/FinishGen.h | 66 |
1 files changed, 54 insertions, 12 deletions
diff --git a/src/Generating/FinishGen.h b/src/Generating/FinishGen.h index 810bb4a91..4a08d70c8 100644 --- a/src/Generating/FinishGen.h +++ b/src/Generating/FinishGen.h @@ -143,32 +143,69 @@ Used for: - Lilypads finisher - DeadBushes finisher */ -class cFinishGenSingleBiomeSingleTopBlock : +class cFinishGenSingleTopBlock : public cFinishGen { public: - cFinishGenSingleBiomeSingleTopBlock( - int a_Seed, BLOCKTYPE a_BlockType, EMCSBiome a_Biome, int a_Amount, - BLOCKTYPE a_AllowedBelow1, BLOCKTYPE a_AllowedBelow2 + typedef std::vector<BLOCKTYPE> BlockList; + bool m_IsAllowedBelow[256]; + + typedef std::vector<EMCSBiome> BiomeList; + bool m_IsBiomeAllowed[256]; + + + cFinishGenSingleTopBlock( + int a_Seed, BLOCKTYPE a_BlockType, BiomeList a_Biomes, int a_Amount, + BlockList a_AllowedBelow ) : m_Noise(a_Seed), m_BlockType(a_BlockType), - m_Biome(a_Biome), - m_Amount(a_Amount), - m_AllowedBelow1(a_AllowedBelow1), - m_AllowedBelow2(a_AllowedBelow2) + m_Amount(a_Amount) { + // Initialize all the block types. + for (size_t idx = 0; idx < ARRAYCOUNT(m_IsAllowedBelow); ++idx) + { + m_IsAllowedBelow[idx] = false; + } + + // Load the allowed blocks into m_IsAllowedBelow + for (BlockList::iterator itr = a_AllowedBelow.begin(); itr != a_AllowedBelow.end(); ++itr) + { + m_IsAllowedBelow[*itr] = true; + } + + // Initialize all the biome types. + for (size_t idx = 0; idx < ARRAYCOUNT(m_IsBiomeAllowed); ++idx) + { + m_IsBiomeAllowed[idx] = false; + } + + // Load the allowed biomes into m_IsBiomeAllowed + for (BiomeList::iterator itr = a_Biomes.begin(); itr != a_Biomes.end(); ++itr) + { + m_IsBiomeAllowed[*itr] = true; + } } protected: cNoise m_Noise; BLOCKTYPE m_BlockType; - EMCSBiome m_Biome; int m_Amount; ///< Relative amount of blocks to try adding. 1 = one block per 256 biome columns. - BLOCKTYPE m_AllowedBelow1; ///< First of the two blocktypes that are allowed below m_BlockType - BLOCKTYPE m_AllowedBelow2; ///< Second of the two blocktypes that are allowed below m_BlockType int GetNumToGen(const cChunkDef::BiomeMap & a_BiomeMap); + + // Returns true if the given biome is a biome that is allowed. + inline bool IsAllowedBiome(EMCSBiome a_Biome) + { + return m_IsBiomeAllowed[a_Biome]; + } + + // Returns true if the given blocktype may be below m_BlockType + inline bool IsAllowedBlockBelow(BLOCKTYPE a_BlockBelow) + { + return m_IsAllowedBelow[a_BlockBelow]; + } + // cFinishGen override: virtual void GenFinish(cChunkDesc & a_ChunkDesc) override; @@ -203,9 +240,14 @@ class cFinishGenPreSimulator : public cFinishGen { public: - cFinishGenPreSimulator(void); + cFinishGenPreSimulator(bool a_PreSimulateFallingBlocks, bool a_PreSimulateWater, bool a_PreSimulateLava); protected: + + bool m_PreSimulateFallingBlocks; + bool m_PreSimulateWater; + bool m_PreSimulateLava; + // Drops hanging sand and gravel down to the ground, recalculates heightmap void CollapseSandGravel( cChunkDef::BlockTypes & a_BlockTypes, // Block types to read and change |