From 1ed3b3aed2e538af2c3bffa41f54a30ac6535f12 Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Sun, 17 Mar 2013 17:55:03 +0000 Subject: Rewritten generators so that they use the cChunkDesc class (and thus can use cBlockArea merging) git-svn-id: http://mc-server.googlecode.com/svn/trunk@1282 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/Generating/FinishGen.h | 139 ++++++++++-------------------------------- 1 file changed, 33 insertions(+), 106 deletions(-) (limited to 'source/Generating/FinishGen.h') diff --git a/source/Generating/FinishGen.h b/source/Generating/FinishGen.h index dde073f67..b4bf67022 100644 --- a/source/Generating/FinishGen.h +++ b/source/Generating/FinishGen.h @@ -28,15 +28,7 @@ class cFinishGenSnow : { protected: // cFinishGen override: - virtual void GenFinish( - int a_ChunkX, int a_ChunkZ, - cChunkDef::BlockTypes & a_BlockTypes, // Block types to read and change - cChunkDef::BlockNibbles & a_BlockMeta, // Block meta to read and change - cChunkDef::HeightMap & a_HeightMap, // Height map to read and change by the current data - const cChunkDef::BiomeMap & a_BiomeMap, // Biomes to adhere to - cEntityList & a_Entities, // Entities may be added or deleted - cBlockEntityList & a_BlockEntities // Block entities may be added or deleted - ) override; + virtual void GenFinish(cChunkDesc & a_ChunkDesc) override; } ; @@ -48,15 +40,7 @@ class cFinishGenIce : { protected: // cFinishGen override: - virtual void GenFinish( - int a_ChunkX, int a_ChunkZ, - cChunkDef::BlockTypes & a_BlockTypes, // Block types to read and change - cChunkDef::BlockNibbles & a_BlockMeta, // Block meta to read and change - cChunkDef::HeightMap & a_HeightMap, // Height map to read and change by the current data - const cChunkDef::BiomeMap & a_BiomeMap, // Biomes to adhere to - cEntityList & a_Entities, // Entities may be added or deleted - cBlockEntityList & a_BlockEntities // Block entities may be added or deleted - ) override; + virtual void GenFinish(cChunkDesc & a_ChunkDesc) override; } ; @@ -67,59 +51,57 @@ class cFinishGenSprinkleFoliage : public cFinishGen { public: - cFinishGenSprinkleFoliage(int a_Seed) : m_Seed(a_Seed) {} + cFinishGenSprinkleFoliage(int a_Seed) : m_Noise(a_Seed), m_Seed(a_Seed) {} protected: - int m_Seed; + cNoise m_Noise; + int m_Seed; /// Tries to place sugarcane at the coords specified, returns true if successful - bool TryAddSugarcane( - int a_ChunkX, int a_ChunkZ, - int a_RelX, int a_RelY, int a_RelZ, // relative block coords of the sugarcane's base - cChunkDef::BlockTypes & a_BlockTypes, // Block types to read and change - cChunkDef::BlockNibbles & a_BlockMeta // Block meta to read and change - ); + bool TryAddSugarcane(cChunkDesc & a_ChunkDesc, int a_RelX, int a_RelY, int a_RelZ); // cFinishGen override: - virtual void GenFinish( - int a_ChunkX, int a_ChunkZ, - cChunkDef::BlockTypes & a_BlockTypes, // Block types to read and change - cChunkDef::BlockNibbles & a_BlockMeta, // Block meta to read and change - cChunkDef::HeightMap & a_HeightMap, // Height map to read and change by the current data - const cChunkDef::BiomeMap & a_BiomeMap, // Biomes to adhere to - cEntityList & a_Entities, // Entities may be added or deleted - cBlockEntityList & a_BlockEntities // Block entities may be added or deleted - ) override; + virtual void GenFinish(cChunkDesc & a_ChunkDesc) override; } ; -class cFinishGenLilypads : +/** This class adds a single top block in random positions in the specified biome on top of specified allowed blocks. +Used for: +- Lilypads finisher +- DeadBushes finisher +*/ +class cFinishGenSingleBiomeSingleTopBlock : public cFinishGen { public: - cFinishGenLilypads(int a_Seed) : - m_Noise(a_Seed) + cFinishGenSingleBiomeSingleTopBlock( + int a_Seed, BLOCKTYPE a_BlockType, EMCSBiome a_Biome, int a_Amount, + BLOCKTYPE a_AllowedBelow1, BLOCKTYPE a_AllowedBelow2 + ) : + m_Noise(a_Seed), + m_BlockType(a_BlockType), + m_Biome(a_Biome), + m_Amount(a_Amount), + m_AllowedBelow1(a_AllowedBelow1), + m_AllowedBelow2(a_AllowedBelow2) { } 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 GetNumLilypads(const cChunkDef::BiomeMap & a_BiomeMap); + int GetNumToGen(const cChunkDef::BiomeMap & a_BiomeMap); // cFinishGen override: - virtual void GenFinish( - int a_ChunkX, int a_ChunkZ, - cChunkDef::BlockTypes & a_BlockTypes, // Block types to read and change - cChunkDef::BlockNibbles & a_BlockMeta, // Block meta to read and change - cChunkDef::HeightMap & a_HeightMap, // Height map to read and change by the current data - const cChunkDef::BiomeMap & a_BiomeMap, // Biomes to adhere to - cEntityList & a_Entities, // Entities may be added or deleted - cBlockEntityList & a_BlockEntities // Block entities may be added or deleted - ) override; + virtual void GenFinish(cChunkDesc & a_ChunkDesc) override; } ; @@ -139,15 +121,7 @@ protected: int m_Level; // cFinishGen override: - virtual void GenFinish( - int a_ChunkX, int a_ChunkZ, - cChunkDef::BlockTypes & a_BlockTypes, // Block types to read and change - cChunkDef::BlockNibbles & a_BlockMeta, // Block meta to read and change - cChunkDef::HeightMap & a_HeightMap, // Height map to read and change by the current data - const cChunkDef::BiomeMap & a_BiomeMap, // Biomes to adhere to - cEntityList & a_Entities, // Entities may be added or deleted - cBlockEntityList & a_BlockEntities // Block entities may be added or deleted - ) override; + virtual void GenFinish(cChunkDesc & a_ChunkDesc) override; } ; @@ -179,52 +153,13 @@ protected: ); // cFinishGen override: - virtual void GenFinish( - int a_ChunkX, int a_ChunkZ, - cChunkDef::BlockTypes & a_BlockTypes, // Block types to read and change - cChunkDef::BlockNibbles & a_BlockMeta, // Block meta to read and change - cChunkDef::HeightMap & a_HeightMap, // Height map to read and change by the current data - const cChunkDef::BiomeMap & a_BiomeMap, // Biomes to adhere to - cEntityList & a_Entities, // Entities may be added or deleted - cBlockEntityList & a_BlockEntities // Block entities may be added or deleted - ) override; -} ; - - - - - -class cFinishGenDeadBushes : - public cFinishGen -{ -public: - cFinishGenDeadBushes(int a_Seed) : - m_Noise(a_Seed) - { - } - -protected: - cNoise m_Noise; - - int GetNumDeadBushes(const cChunkDef::BiomeMap & a_BiomeMap); - - // cFinishGen override: - virtual void GenFinish( - int a_ChunkX, int a_ChunkZ, - cChunkDef::BlockTypes & a_BlockTypes, // Block types to read and change - cChunkDef::BlockNibbles & a_BlockMeta, // Block meta to read and change - cChunkDef::HeightMap & a_HeightMap, // Height map to read and change by the current data - const cChunkDef::BiomeMap & a_BiomeMap, // Biomes to adhere to - cEntityList & a_Entities, // Entities may be added or deleted - cBlockEntityList & a_BlockEntities // Block entities may be added or deleted - ) override; + virtual void GenFinish(cChunkDesc & a_ChunkDesc) override; } ; - class cFinishGenFluidSprings : public cFinishGen { @@ -239,15 +174,7 @@ protected: int m_Chance; ///< Chance, [0..100], that a spring will be generated in a chunk // cFinishGen override: - virtual void GenFinish( - int a_ChunkX, int a_ChunkZ, - cChunkDef::BlockTypes & a_BlockTypes, // Block types to read and change - cChunkDef::BlockNibbles & a_BlockMeta, // Block meta to read and change - cChunkDef::HeightMap & a_HeightMap, // Height map to read and change by the current data - const cChunkDef::BiomeMap & a_BiomeMap, // Biomes to adhere to - cEntityList & a_Entities, // Entities may be added or deleted - cBlockEntityList & a_BlockEntities // Block entities may be added or deleted - ) override; + virtual void GenFinish(cChunkDesc & a_ChunkDesc) override; /// Tries to place a spring at the specified coords, checks neighbors. Returns true if successful bool TryPlaceSpring( -- cgit v1.2.3