From ecfae286064b4a8fcf6e4df38c09e8055e83de33 Mon Sep 17 00:00:00 2001 From: STRWarrior Date: Sun, 10 Aug 2014 11:40:33 +0200 Subject: Changed cStructGenOreNests to take a list of ores + the block to replace. --- src/Generating/ComposableGenerator.cpp | 52 +++++++++++++++++++++++++++++- src/Generating/StructGen.cpp | 58 ++++++---------------------------- src/Generating/StructGen.h | 26 ++++++++++++--- 3 files changed, 83 insertions(+), 53 deletions(-) diff --git a/src/Generating/ComposableGenerator.cpp b/src/Generating/ComposableGenerator.cpp index cedb9aeb7..79a92171f 100644 --- a/src/Generating/ComposableGenerator.cpp +++ b/src/Generating/ComposableGenerator.cpp @@ -400,7 +400,57 @@ void cComposableGenerator::InitFinishGens(cIniFile & a_IniFile) } else if (NoCaseCompare(*itr, "OreNests") == 0) { - m_FinishGens.push_back(new cStructGenOreNests(Seed)); + cStructGenOreNests::OreList Ores; + + // Coal vein + cStructGenOreNests::OreInfo CoalVein; + CoalVein.BlockType = E_BLOCK_COAL_ORE; + CoalVein.MaxHeight = 127; + CoalVein.NumNests = 50; + CoalVein.NestSize = 10; + Ores.push_back(CoalVein); + + // Iron vein + cStructGenOreNests::OreInfo IronVein; + IronVein.BlockType = E_BLOCK_IRON_ORE; + IronVein.MaxHeight = 64; + IronVein.NumNests = 14; + IronVein.NestSize = 6; + Ores.push_back(IronVein); + + // Gold vein + cStructGenOreNests::OreInfo GoldVein; + GoldVein.BlockType = E_BLOCK_GOLD_ORE; + GoldVein.MaxHeight = 32; + GoldVein.NumNests = 2; + GoldVein.NestSize = 6; + Ores.push_back(GoldVein); + + // Redstone vein + cStructGenOreNests::OreInfo RedstoneVein; + RedstoneVein.BlockType = E_BLOCK_REDSTONE_ORE; + RedstoneVein.MaxHeight = 16; + RedstoneVein.NumNests = 4; + RedstoneVein.NestSize = 6; + Ores.push_back(RedstoneVein); + + // Lapis vein + cStructGenOreNests::OreInfo LapisVein; + LapisVein.BlockType = E_BLOCK_LAPIS_ORE; + LapisVein.MaxHeight = 30; + LapisVein.NumNests = 2; + LapisVein.NestSize = 5; + Ores.push_back(LapisVein); + + // Diamond vein + cStructGenOreNests::OreInfo DiamondVein; + DiamondVein.BlockType = E_BLOCK_DIAMOND_ORE; + DiamondVein.MaxHeight = 15; + DiamondVein.NumNests = 1; + DiamondVein.NestSize = 4; + Ores.push_back(DiamondVein); + + m_FinishGens.push_back(new cStructGenOreNests(Seed, Ores, E_BLOCK_STONE)); } else if (NoCaseCompare(*itr, "POCPieces") == 0) { diff --git a/src/Generating/StructGen.cpp b/src/Generating/StructGen.cpp index f7e609353..1a43f2b2e 100644 --- a/src/Generating/StructGen.cpp +++ b/src/Generating/StructGen.cpp @@ -12,45 +12,6 @@ -//////////////////////////////////////////////////////////////////////////////// -// cStructGenOreNests configuration: - -const int MAX_HEIGHT_COAL = 127; -const int NUM_NESTS_COAL = 50; -const int NEST_SIZE_COAL = 10; - -const int MAX_HEIGHT_IRON = 64; -const int NUM_NESTS_IRON = 14; -const int NEST_SIZE_IRON = 6; - -const int MAX_HEIGHT_REDSTONE = 16; -const int NUM_NESTS_REDSTONE = 4; -const int NEST_SIZE_REDSTONE = 6; - -const int MAX_HEIGHT_GOLD = 32; -const int NUM_NESTS_GOLD = 2; -const int NEST_SIZE_GOLD = 6; - -const int MAX_HEIGHT_DIAMOND = 15; -const int NUM_NESTS_DIAMOND = 1; -const int NEST_SIZE_DIAMOND = 4; - -const int MAX_HEIGHT_LAPIS = 30; -const int NUM_NESTS_LAPIS = 2; -const int NEST_SIZE_LAPIS = 5; - -const int MAX_HEIGHT_DIRT = 127; -const int NUM_NESTS_DIRT = 20; -const int NEST_SIZE_DIRT = 32; - -const int MAX_HEIGHT_GRAVEL = 70; -const int NUM_NESTS_GRAVEL = 15; -const int NEST_SIZE_GRAVEL = 32; - - - - - //////////////////////////////////////////////////////////////////////////////// // cStructGenTrees: @@ -311,14 +272,15 @@ void cStructGenOreNests::GenFinish(cChunkDesc & a_ChunkDesc) int ChunkX = a_ChunkDesc.GetChunkX(); int ChunkZ = a_ChunkDesc.GetChunkZ(); cChunkDef::BlockTypes & BlockTypes = a_ChunkDesc.GetBlockTypes(); - GenerateOre(ChunkX, ChunkZ, E_BLOCK_COAL_ORE, MAX_HEIGHT_COAL, NUM_NESTS_COAL, NEST_SIZE_COAL, BlockTypes, 1); - GenerateOre(ChunkX, ChunkZ, E_BLOCK_IRON_ORE, MAX_HEIGHT_IRON, NUM_NESTS_IRON, NEST_SIZE_IRON, BlockTypes, 2); - GenerateOre(ChunkX, ChunkZ, E_BLOCK_REDSTONE_ORE, MAX_HEIGHT_REDSTONE, NUM_NESTS_REDSTONE, NEST_SIZE_REDSTONE, BlockTypes, 3); - GenerateOre(ChunkX, ChunkZ, E_BLOCK_GOLD_ORE, MAX_HEIGHT_GOLD, NUM_NESTS_GOLD, NEST_SIZE_GOLD, BlockTypes, 4); - GenerateOre(ChunkX, ChunkZ, E_BLOCK_DIAMOND_ORE, MAX_HEIGHT_DIAMOND, NUM_NESTS_DIAMOND, NEST_SIZE_DIAMOND, BlockTypes, 5); - GenerateOre(ChunkX, ChunkZ, E_BLOCK_LAPIS_ORE, MAX_HEIGHT_LAPIS, NUM_NESTS_LAPIS, NEST_SIZE_LAPIS, BlockTypes, 6); - GenerateOre(ChunkX, ChunkZ, E_BLOCK_DIRT, MAX_HEIGHT_DIRT, NUM_NESTS_DIRT, NEST_SIZE_DIRT, BlockTypes, 10); - GenerateOre(ChunkX, ChunkZ, E_BLOCK_GRAVEL, MAX_HEIGHT_GRAVEL, NUM_NESTS_GRAVEL, NEST_SIZE_GRAVEL, BlockTypes, 11); + + int seq = 1; + + // Generate the ores from the ore list. + for (OreList::iterator itr = m_OreList.begin(); itr != m_OreList.end(); ++itr) + { + GenerateOre(ChunkX, ChunkZ, itr->BlockType, itr->MaxHeight, itr->NumNests, itr->NestSize, BlockTypes, seq); + seq++; + } } @@ -376,7 +338,7 @@ void cStructGenOreNests::GenerateOre(int a_ChunkX, int a_ChunkZ, BLOCKTYPE a_Ore } int Index = cChunkDef::MakeIndexNoCheck(BlockX, BlockY, BlockZ); - if (a_BlockTypes[Index] == E_BLOCK_STONE) + if (a_BlockTypes[Index] == m_ToReplace) { a_BlockTypes[Index] = a_OreType; } diff --git a/src/Generating/StructGen.h b/src/Generating/StructGen.h index 9176bc192..e2fe8bc1a 100644 --- a/src/Generating/StructGen.h +++ b/src/Generating/StructGen.h @@ -76,11 +76,29 @@ class cStructGenOreNests : public cFinishGen { public: - cStructGenOreNests(int a_Seed) : m_Noise(a_Seed), m_Seed(a_Seed) {} - + struct OreInfo + { + BLOCKTYPE BlockType; // The type of the nest. + int MaxHeight; // The highest possible a nest can occur + int NumNests; // How many nests per chunk + int NestSize; // The amount of blocks a nest can have. + }; + + typedef std::vector OreList; + + cStructGenOreNests(int a_Seed, OreList a_OreList, BLOCKTYPE a_ToReplace) : + m_Noise(a_Seed), + m_Seed(a_Seed), + m_OreList(a_OreList), + m_ToReplace(a_ToReplace) + {} + protected: - cNoise m_Noise; - int m_Seed; + cNoise m_Noise; + int m_Seed; + + OreList m_OreList; // A list of possible ores. + BLOCKTYPE m_ToReplace; // cFinishGen override: virtual void GenFinish(cChunkDesc & a_ChunkDesc) override; -- cgit v1.2.3 From 0ac3c67a21ae6fbd060322d65fcdad4f98148567 Mon Sep 17 00:00:00 2001 From: STRWarrior Date: Sun, 10 Aug 2014 11:48:05 +0200 Subject: Added NetherOreNests. It generates Nether Quarts. --- src/Generating/ComposableGenerator.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/Generating/ComposableGenerator.cpp b/src/Generating/ComposableGenerator.cpp index 79a92171f..1ae86a29f 100644 --- a/src/Generating/ComposableGenerator.cpp +++ b/src/Generating/ComposableGenerator.cpp @@ -398,6 +398,21 @@ void cComposableGenerator::InitFinishGens(cIniFile & a_IniFile) int MaxDepth = a_IniFile.GetValueSetI("Generator", "NetherFortsMaxDepth", 12); m_FinishGens.push_back(new cNetherFortGen(Seed, GridSize, MaxOffset, MaxDepth)); } + else if (NoCaseCompare(*itr, "NetherOreNests") == 0) + { + cStructGenOreNests::OreList Ores; + + // Quarts vein + cStructGenOreNests::OreInfo QuartsVein; + QuartsVein.BlockType = E_BLOCK_NETHER_QUARTZ_ORE; + QuartsVein.MaxHeight = 255; + QuartsVein.NumNests = 80; + QuartsVein.NestSize = 8; + Ores.push_back(QuartsVein); + + m_FinishGens.push_back(new cStructGenOreNests(Seed, Ores, E_BLOCK_NETHERRACK)); + + } else if (NoCaseCompare(*itr, "OreNests") == 0) { cStructGenOreNests::OreList Ores; -- cgit v1.2.3 From e529401dbb6d9c6de3b5e81b3308a478fe1a36db Mon Sep 17 00:00:00 2001 From: STRWarrior Date: Sun, 10 Aug 2014 11:57:05 +0200 Subject: Added NaturalPatches generator It generates gravel and dirt. --- src/Generating/ComposableGenerator.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/Generating/ComposableGenerator.cpp b/src/Generating/ComposableGenerator.cpp index 1ae86a29f..58ad8fc2e 100644 --- a/src/Generating/ComposableGenerator.cpp +++ b/src/Generating/ComposableGenerator.cpp @@ -387,6 +387,28 @@ void cComposableGenerator::InitFinishGens(cIniFile & a_IniFile) m_FinishGens.push_back(new cFinishGenSingleTopBlock(Seed, E_BLOCK_LILY_PAD, AllowedBiomes, 4, AllowedBlocks)); } + else if (NoCaseCompare(*itr, "NaturalPatches") == 0) + { + cStructGenOreNests::OreList Ores; + + // Dirt vein + cStructGenOreNests::OreInfo DirtVein; + DirtVein.BlockType = E_BLOCK_DIRT; + DirtVein.MaxHeight = 127; + DirtVein.NumNests = 20; + DirtVein.NestSize = 32; + Ores.push_back(DirtVein); + + // Gravel vein + cStructGenOreNests::OreInfo GravelVein; + GravelVein.BlockType = E_BLOCK_DIRT; + GravelVein.MaxHeight = 127; + GravelVein.NumNests = 20; + GravelVein.NestSize = 32; + Ores.push_back(GravelVein); + + m_FinishGens.push_back(new cStructGenOreNests(Seed, Ores, E_BLOCK_STONE)); + } else if (NoCaseCompare(*itr, "NetherClumpFoliage") == 0) { m_FinishGens.push_back(new cFinishGenNetherClumpFoliage(Seed)); -- cgit v1.2.3 From d95768d01a93a14df38f6e0e33ca180b779c5df0 Mon Sep 17 00:00:00 2001 From: STRWarrior Date: Sun, 10 Aug 2014 22:36:02 +0200 Subject: Bunch of tweaks: Renamed Quarts to Quartz Using const_iterator instead of iterator Used CheckBasicStyle script to find style errors --- src/Generating/ComposableGenerator.cpp | 14 +++++++------- src/Generating/StructGen.cpp | 2 +- src/Generating/StructGen.h | 14 +++++++------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/Generating/ComposableGenerator.cpp b/src/Generating/ComposableGenerator.cpp index 58ad8fc2e..2f575fe27 100644 --- a/src/Generating/ComposableGenerator.cpp +++ b/src/Generating/ComposableGenerator.cpp @@ -424,13 +424,13 @@ void cComposableGenerator::InitFinishGens(cIniFile & a_IniFile) { cStructGenOreNests::OreList Ores; - // Quarts vein - cStructGenOreNests::OreInfo QuartsVein; - QuartsVein.BlockType = E_BLOCK_NETHER_QUARTZ_ORE; - QuartsVein.MaxHeight = 255; - QuartsVein.NumNests = 80; - QuartsVein.NestSize = 8; - Ores.push_back(QuartsVein); + // Quartz vein + cStructGenOreNests::OreInfo QuartzVein; + QuartzVein.BlockType = E_BLOCK_NETHER_QUARTZ_ORE; + QuartzVein.MaxHeight = 255; + QuartzVein.NumNests = 80; + QuartzVein.NestSize = 8; + Ores.push_back(QuartzVein); m_FinishGens.push_back(new cStructGenOreNests(Seed, Ores, E_BLOCK_NETHERRACK)); diff --git a/src/Generating/StructGen.cpp b/src/Generating/StructGen.cpp index 1a43f2b2e..731324b0d 100644 --- a/src/Generating/StructGen.cpp +++ b/src/Generating/StructGen.cpp @@ -276,7 +276,7 @@ void cStructGenOreNests::GenFinish(cChunkDesc & a_ChunkDesc) int seq = 1; // Generate the ores from the ore list. - for (OreList::iterator itr = m_OreList.begin(); itr != m_OreList.end(); ++itr) + for (OreList::const_iterator itr = m_OreList.begin(); itr != m_OreList.end(); ++itr) { GenerateOre(ChunkX, ChunkZ, itr->BlockType, itr->MaxHeight, itr->NumNests, itr->NestSize, BlockTypes, seq); seq++; diff --git a/src/Generating/StructGen.h b/src/Generating/StructGen.h index e2fe8bc1a..55d5bc1c7 100644 --- a/src/Generating/StructGen.h +++ b/src/Generating/StructGen.h @@ -78,16 +78,16 @@ class cStructGenOreNests : public: struct OreInfo { - BLOCKTYPE BlockType; // The type of the nest. - int MaxHeight; // The highest possible a nest can occur - int NumNests; // How many nests per chunk - int NestSize; // The amount of blocks a nest can have. + BLOCKTYPE BlockType; // The type of the nest. + int MaxHeight; // The highest possible a nest can occur + int NumNests; // How many nests per chunk + int NestSize; // The amount of blocks a nest can have. }; typedef std::vector OreList; - cStructGenOreNests(int a_Seed, OreList a_OreList, BLOCKTYPE a_ToReplace) : - m_Noise(a_Seed), + cStructGenOreNests(int a_Seed, OreList a_OreList, BLOCKTYPE a_ToReplace) : + m_Noise(a_Seed), m_Seed(a_Seed), m_OreList(a_OreList), m_ToReplace(a_ToReplace) @@ -97,7 +97,7 @@ protected: cNoise m_Noise; int m_Seed; - OreList m_OreList; // A list of possible ores. + OreList m_OreList; // A list of possible ores. BLOCKTYPE m_ToReplace; // cFinishGen override: -- cgit v1.2.3