diff options
author | Julian Laubstein <julianlaubstein@yahoo.de> | 2015-11-25 16:52:32 +0100 |
---|---|---|
committer | Julian Laubstein <julianlaubstein@yahoo.de> | 2015-11-25 16:52:32 +0100 |
commit | d6ad5245b3590cc71686a763d71db82542b2f279 (patch) | |
tree | e03a27694e4b589f5bf04d2a595393661fa36654 /src/Generating/StructGen.cpp | |
parent | Merge pull request #2687 from Gargaj/signfix (diff) | |
parent | OrePockets finisher is now configurable. (diff) | |
download | cuberite-d6ad5245b3590cc71686a763d71db82542b2f279.tar cuberite-d6ad5245b3590cc71686a763d71db82542b2f279.tar.gz cuberite-d6ad5245b3590cc71686a763d71db82542b2f279.tar.bz2 cuberite-d6ad5245b3590cc71686a763d71db82542b2f279.tar.lz cuberite-d6ad5245b3590cc71686a763d71db82542b2f279.tar.xz cuberite-d6ad5245b3590cc71686a763d71db82542b2f279.tar.zst cuberite-d6ad5245b3590cc71686a763d71db82542b2f279.zip |
Diffstat (limited to 'src/Generating/StructGen.cpp')
-rw-r--r-- | src/Generating/StructGen.cpp | 110 |
1 files changed, 0 insertions, 110 deletions
diff --git a/src/Generating/StructGen.cpp b/src/Generating/StructGen.cpp index 3b04f66b7..29cab86f1 100644 --- a/src/Generating/StructGen.cpp +++ b/src/Generating/StructGen.cpp @@ -273,116 +273,6 @@ int cStructGenTrees::GetNumTrees( //////////////////////////////////////////////////////////////////////////////// -// cStructGenOreNests: - -void cStructGenOreNests::GenFinish(cChunkDesc & a_ChunkDesc) -{ - int ChunkX = a_ChunkDesc.GetChunkX(); - int ChunkZ = a_ChunkDesc.GetChunkZ(); - cChunkDef::BlockTypes & BlockTypes = a_ChunkDesc.GetBlockTypes(); - cChunkDesc::BlockNibbleBytes & BlockMetas = a_ChunkDesc.GetBlockMetasUncompressed(); - - int seq = 1; - - // Generate the ores from the ore list. - for (OreList::const_iterator itr = m_OreList.begin(); itr != m_OreList.end(); ++itr) - { - GenerateOre(ChunkX, ChunkZ, itr->BlockType, itr->BlockMeta, itr->MaxHeight, itr->NumNests, itr->NestSize, BlockTypes, BlockMetas, seq); - seq++; - } -} - - - - - -void cStructGenOreNests::GenerateOre(int a_ChunkX, int a_ChunkZ, BLOCKTYPE a_OreType, NIBBLETYPE a_BlockMeta, int a_MaxHeight, int a_NumNests, int a_NestSize, cChunkDef::BlockTypes & a_BlockTypes, cChunkDesc::BlockNibbleBytes & a_BlockMetas, int a_Seq) -{ - // This function generates several "nests" of ore, each nest consisting of number of ore blocks relatively adjacent to each other. - // It does so by making a random XYZ walk and adding ore along the way in cuboids of different (random) sizes - // Only stone gets replaced with ore, all other blocks stay (so the nest can actually be smaller than specified). - - for (int i = 0; i < a_NumNests; i++) - { - int Nestrnd = m_Noise.IntNoise3DInt(a_ChunkX + i, a_Seq, a_ChunkZ + 64 * i) / 8; - int BaseX = Nestrnd % cChunkDef::Width; - Nestrnd /= cChunkDef::Width; - int BaseZ = Nestrnd % cChunkDef::Width; - Nestrnd /= cChunkDef::Width; - int BaseY = Nestrnd % a_MaxHeight; - Nestrnd /= a_MaxHeight; - int NestSize = a_NestSize + (Nestrnd % (a_NestSize / 4)); // The actual nest size may be up to 1 / 4 larger - int Num = 0; - while (Num < NestSize) - { - // Put a cuboid around [BaseX, BaseY, BaseZ] - int rnd = m_Noise.IntNoise3DInt(a_ChunkX + 64 * i, 2 * a_Seq + Num, a_ChunkZ + 32 * i) / 8; - int xsize = rnd % 2; - int ysize = (rnd / 4) % 2; - int zsize = (rnd / 16) % 2; - rnd >>= 8; - for (int x = xsize; x >= 0; --x) - { - int BlockX = BaseX + x; - if ((BlockX < 0) || (BlockX >= cChunkDef::Width)) - { - Num++; // So that the cycle finishes even if the base coords wander away from the chunk - continue; - } - for (int y = ysize; y >= 0; --y) - { - int BlockY = BaseY + y; - if ((BlockY < 0) || (BlockY >= cChunkDef::Height)) - { - Num++; // So that the cycle finishes even if the base coords wander away from the chunk - continue; - } - for (int z = zsize; z >= 0; --z) - { - int BlockZ = BaseZ + z; - if ((BlockZ < 0) || (BlockZ >= cChunkDef::Width)) - { - Num++; // So that the cycle finishes even if the base coords wander away from the chunk - continue; - } - - int Index = cChunkDef::MakeIndexNoCheck(BlockX, BlockY, BlockZ); - if (a_BlockTypes[Index] == m_ToReplace) - { - a_BlockTypes[Index] = a_OreType; - a_BlockMetas[Index] = a_BlockMeta; - } - Num++; - } // for z - } // for y - } // for x - - // Move the base to a neighbor voxel - switch (rnd % 4) - { - case 0: BaseX--; break; - case 1: BaseX++; break; - } - switch ((rnd >> 3) % 4) - { - case 0: BaseY--; break; - case 1: BaseY++; break; - } - switch ((rnd >> 6) % 4) - { - case 0: BaseZ--; break; - case 1: BaseZ++; break; - } - } // while (Num < NumBlocks) - } // for i - NumNests -} - - - - - - -//////////////////////////////////////////////////////////////////////////////// // cStructGenLakes: void cStructGenLakes::GenFinish(cChunkDesc & a_ChunkDesc) |