summaryrefslogtreecommitdiffstats
path: root/src/Generating/FinishGen.h
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2014-07-29 17:47:40 +0200
committerMattes D <github@xoft.cz>2014-07-29 17:47:40 +0200
commitd715eb7f5e1e39bbf87bf68a6a677f709e783b13 (patch)
tree5581af7a1f1cb55f2520e7a01ab7339a6b706710 /src/Generating/FinishGen.h
parentMerge pull request #1252 from mc-server/RoughRavinesGen (diff)
parentSome finishing touches (diff)
downloadcuberite-d715eb7f5e1e39bbf87bf68a6a677f709e783b13.tar
cuberite-d715eb7f5e1e39bbf87bf68a6a677f709e783b13.tar.gz
cuberite-d715eb7f5e1e39bbf87bf68a6a677f709e783b13.tar.bz2
cuberite-d715eb7f5e1e39bbf87bf68a6a677f709e783b13.tar.lz
cuberite-d715eb7f5e1e39bbf87bf68a6a677f709e783b13.tar.xz
cuberite-d715eb7f5e1e39bbf87bf68a6a677f709e783b13.tar.zst
cuberite-d715eb7f5e1e39bbf87bf68a6a677f709e783b13.zip
Diffstat (limited to '')
-rw-r--r--src/Generating/FinishGen.h59
1 files changed, 48 insertions, 11 deletions
diff --git a/src/Generating/FinishGen.h b/src/Generating/FinishGen.h
index 810bb4a91..ed32768b3 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 (int 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 (int 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;