diff options
author | x12xx12x <44411062+12xx12@users.noreply.github.com> | 2021-11-26 00:51:47 +0100 |
---|---|---|
committer | Alexander Harkness <me@bearbin.net> | 2022-01-14 20:43:29 +0100 |
commit | 250b8eb652a57dcbdff4af7b6efb9c2554b45798 (patch) | |
tree | 1d8bf1aaeac6974d75c83524c8000161d8cc104c /src/Generating | |
parent | Fix WriteXZYPosition64 and add tests (diff) | |
download | cuberite-250b8eb652a57dcbdff4af7b6efb9c2554b45798.tar cuberite-250b8eb652a57dcbdff4af7b6efb9c2554b45798.tar.gz cuberite-250b8eb652a57dcbdff4af7b6efb9c2554b45798.tar.bz2 cuberite-250b8eb652a57dcbdff4af7b6efb9c2554b45798.tar.lz cuberite-250b8eb652a57dcbdff4af7b6efb9c2554b45798.tar.xz cuberite-250b8eb652a57dcbdff4af7b6efb9c2554b45798.tar.zst cuberite-250b8eb652a57dcbdff4af7b6efb9c2554b45798.zip |
Diffstat (limited to 'src/Generating')
-rw-r--r-- | src/Generating/BioGen.cpp | 38 | ||||
-rw-r--r-- | src/Generating/FinishGen.cpp | 2 | ||||
-rw-r--r-- | src/Generating/PieceModifier.cpp | 21 | ||||
-rw-r--r-- | src/Generating/PrefabPiecePool.cpp | 16 | ||||
-rw-r--r-- | src/Generating/Trees.cpp | 2 | ||||
-rw-r--r-- | src/Generating/VerticalLimit.cpp | 16 | ||||
-rw-r--r-- | src/Generating/VerticalStrategy.cpp | 15 |
7 files changed, 24 insertions, 86 deletions
diff --git a/src/Generating/BioGen.cpp b/src/Generating/BioGen.cpp index 5e8f5dddc..b71259f08 100644 --- a/src/Generating/BioGen.cpp +++ b/src/Generating/BioGen.cpp @@ -796,7 +796,7 @@ EMCSBiome cBioGenTwoLevel::SelectBiome(int a_BiomeGroup, size_t a_BiomeIdx, int EMCSBiome OuterBiome; } ; - static BiomeLevels bgOcean[] = + static BiomeLevels bgOceanBlocks[] = { { biOcean, biOcean, }, { biOcean, biOcean, }, @@ -810,7 +810,7 @@ EMCSBiome cBioGenTwoLevel::SelectBiome(int a_BiomeGroup, size_t a_BiomeIdx, int { biDeepOcean, biDeepOcean, }, { biMushroomIsland, biMushroomShore, } } ; - static BiomeLevels bgFrozen[] = + static BiomeLevels bgFrozenBlocks[] = { { biIcePlains, biIcePlains, }, { biIceMountains, biIceMountains, }, @@ -823,7 +823,7 @@ EMCSBiome cBioGenTwoLevel::SelectBiome(int a_BiomeGroup, size_t a_BiomeIdx, int { biExtremeHillsPlus, biExtremeHillsEdge, }, { biExtremeHillsPlusM, biExtremeHillsPlusM, }, } ; - static BiomeLevels bgTemperate[] = + static BiomeLevels bgTemperateBlocks[] = { { biBirchForestHills, biBirchForest, }, { biBirchForest, biBirchForest, }, @@ -839,7 +839,7 @@ EMCSBiome cBioGenTwoLevel::SelectBiome(int a_BiomeGroup, size_t a_BiomeIdx, int { biSwampland, biSwampland, }, { biSwamplandM, biSwamplandM, }, } ; - static BiomeLevels bgWarm[] = + static BiomeLevels bgWarmBlocks[] = { { biDesertHills, biDesert, }, { biDesert, biDesert, }, @@ -848,7 +848,7 @@ EMCSBiome cBioGenTwoLevel::SelectBiome(int a_BiomeGroup, size_t a_BiomeIdx, int { biSavanna, biSavanna, }, { biSavannaM, biSavannaM, }, } ; - static BiomeLevels bgMesa[] = + static BiomeLevels bgMesaBlocks[] = { { biMesaPlateau, biMesa, }, { biMesaPlateauF, biMesa, }, @@ -858,7 +858,7 @@ EMCSBiome cBioGenTwoLevel::SelectBiome(int a_BiomeGroup, size_t a_BiomeIdx, int { biSavanna, biSavanna, }, { biSavannaPlateau, biSavanna, }, } ; - static BiomeLevels bgConifers[] = + static BiomeLevels bgConifersBlocks[] = { { biTaiga, biTaiga, }, { biTaigaM, biTaigaM, }, @@ -866,7 +866,7 @@ EMCSBiome cBioGenTwoLevel::SelectBiome(int a_BiomeGroup, size_t a_BiomeIdx, int { biMegaSpruceTaiga, biMegaSpruceTaiga, }, { biMegaSpruceTaigaHills, biMegaSpruceTaiga, } } ; - static BiomeLevels bgDenseTrees[] = + static BiomeLevels bgDenseTreesBlocks[] = { { biJungleHills, biJungle, }, { biJungle, biJungleEdge, }, @@ -878,18 +878,18 @@ EMCSBiome cBioGenTwoLevel::SelectBiome(int a_BiomeGroup, size_t a_BiomeIdx, int size_t Count; } BiomeGroups[] = { - { bgOcean, ARRAYCOUNT(bgOcean), }, - { bgOcean, ARRAYCOUNT(bgOcean), }, - { bgFrozen, ARRAYCOUNT(bgFrozen), }, - { bgFrozen, ARRAYCOUNT(bgFrozen), }, - { bgTemperate, ARRAYCOUNT(bgTemperate), }, - { bgTemperate, ARRAYCOUNT(bgTemperate), }, - { bgConifers, ARRAYCOUNT(bgConifers), }, - { bgConifers, ARRAYCOUNT(bgConifers), }, - { bgWarm, ARRAYCOUNT(bgWarm), }, - { bgWarm, ARRAYCOUNT(bgWarm), }, - { bgMesa, ARRAYCOUNT(bgMesa), }, - { bgDenseTrees, ARRAYCOUNT(bgDenseTrees), }, + { bgOceanBlocks, ARRAYCOUNT(bgOceanBlocks), }, + { bgOceanBlocks, ARRAYCOUNT(bgOceanBlocks), }, + { bgFrozenBlocks, ARRAYCOUNT(bgFrozenBlocks), }, + { bgFrozenBlocks, ARRAYCOUNT(bgFrozenBlocks), }, + { bgTemperateBlocks, ARRAYCOUNT(bgTemperateBlocks), }, + { bgTemperateBlocks, ARRAYCOUNT(bgTemperateBlocks), }, + { bgConifersBlocks, ARRAYCOUNT(bgConifersBlocks), }, + { bgConifersBlocks, ARRAYCOUNT(bgConifersBlocks), }, + { bgWarmBlocks, ARRAYCOUNT(bgWarmBlocks), }, + { bgWarmBlocks, ARRAYCOUNT(bgWarmBlocks), }, + { bgMesaBlocks, ARRAYCOUNT(bgMesaBlocks), }, + { bgDenseTreesBlocks, ARRAYCOUNT(bgDenseTreesBlocks), }, } ; size_t Group = static_cast<size_t>(a_BiomeGroup) % ARRAYCOUNT(BiomeGroups); size_t Index = a_BiomeIdx % BiomeGroups[Group].Count; diff --git a/src/Generating/FinishGen.cpp b/src/Generating/FinishGen.cpp index 984957e60..34ca30b26 100644 --- a/src/Generating/FinishGen.cpp +++ b/src/Generating/FinishGen.cpp @@ -1822,7 +1822,7 @@ cFinishGenOres::OreInfos cFinishGenOres::OreInfosFromString(const AString & a_Or ); continue; } - auto oreType = BlockStringToType(parts[0]); + auto oreType = static_cast<BLOCKTYPE>(BlockStringToType(parts[0])); if (oreType < 0) { LOGWARNING("Cannot parse ore information from string, invalid OreType: \"%s\".", parts[0].c_str()); diff --git a/src/Generating/PieceModifier.cpp b/src/Generating/PieceModifier.cpp index 54d6a2c21..922e68e40 100644 --- a/src/Generating/PieceModifier.cpp +++ b/src/Generating/PieceModifier.cpp @@ -16,21 +16,6 @@ static const int SEED_OFFSET = 135 * 13; - - -// Emit a warning if the first param is true -#define CONDWARNING(ShouldLog, Fmt, ...) \ - do { \ - if (ShouldLog) \ - { \ - LOGWARNING(Fmt, __VA_ARGS__); \ - } \ - } while (false) - - - - - //////////////////////////////////////////////////////////////////////////////// /** A modifier which is pseudo-randomly replacing blocks to other types and metas. */ class cPieceModifierRandomizeBlocks: @@ -252,7 +237,7 @@ public: { if (m_BlocksToReplace.count(BlockTypes[i])) { - float BlockRnd = PieceNoise.IntNoise2DInRange(a_PieceRot, static_cast<int>(i), 0, m_AllWeights); + float BlockRnd = PieceNoise.IntNoise2DInRange(a_PieceRot, static_cast<int>(i), 0.0F, static_cast<float>(m_AllWeights)); int weightDelta = 0; for (auto & blockToRnd : m_BlocksToRandomize) @@ -265,7 +250,7 @@ public: // Per block meta params if (blockToRnd.m_MinMeta < blockToRnd.m_MaxMeta) { - int BlockMetaRnd = std::clamp(static_cast<int>(PieceNoise.IntNoise2DInRange(a_PieceRot*2, static_cast<int>(i), blockToRnd.m_MinNoiseMeta, blockToRnd.m_MaxNoiseMeta)), blockToRnd.m_MinMeta, blockToRnd.m_MaxMeta); + char BlockMetaRnd = static_cast<char>(std::clamp<int>(static_cast<int>(PieceNoise.IntNoise2DInRange(a_PieceRot*2, static_cast<int>(i), static_cast<float>(blockToRnd.m_MinNoiseMeta), static_cast<float>(blockToRnd.m_MaxNoiseMeta))), blockToRnd.m_MinMeta, blockToRnd.m_MaxMeta)); BlockMetas[i] = static_cast<NIBBLETYPE>(BlockMetaRnd); } else if ((blockToRnd.m_MaxMeta > -1) && (blockToRnd.m_MaxMeta == blockToRnd.m_MinMeta)) @@ -280,7 +265,7 @@ public: // All blocks meta params if (m_MaxMeta > m_MinMeta) { - int BlockMetaRnd = std::clamp(static_cast<int>(PieceNoise.IntNoise2DInRange(a_PieceRot*2, static_cast<int>(i), m_MinNoiseMeta, m_MaxNoiseMeta)), m_MinMeta, m_MaxMeta); + char BlockMetaRnd = static_cast<char>(std::clamp<int>(static_cast<int>(PieceNoise.IntNoise2DInRange(a_PieceRot * 2, static_cast<int>(i), static_cast<float>(m_MinNoiseMeta), static_cast<float>(m_MaxNoiseMeta))), m_MinMeta, m_MaxMeta)); BlockMetas[i] = static_cast<NIBBLETYPE>(BlockMetaRnd); } else if ((m_MaxMeta > -1) && (m_MaxMeta == m_MinMeta)) diff --git a/src/Generating/PrefabPiecePool.cpp b/src/Generating/PrefabPiecePool.cpp index 67d464d13..4deee38ef 100644 --- a/src/Generating/PrefabPiecePool.cpp +++ b/src/Generating/PrefabPiecePool.cpp @@ -11,22 +11,6 @@ #include "../StringCompression.h" - - - -// Conditionally log a warning -#define CONDWARNING(ShouldLog, ...) \ - do { \ - if (ShouldLog) \ - { \ - LOGWARNING(__VA_ARGS__); \ - } \ - } while (false) - - - - - /** Returns the map of string => eMergeStrategy used when translating cubeset file merge strategies. */ static std::map<AString, cBlockArea::eMergeStrategy> & GetMergeStrategyMap(void) { diff --git a/src/Generating/Trees.cpp b/src/Generating/Trees.cpp index 53017ce06..4b3d2c24e 100644 --- a/src/Generating/Trees.cpp +++ b/src/Generating/Trees.cpp @@ -949,7 +949,7 @@ void GetSmallSpruceTreeImage(Vector3i a_BlockPos, cNoise & a_Noise, int a_Seq, s { a_LogBlocks.emplace_back(a_BlockPos.addedY(i), E_BLOCK_LOG, E_META_LOG_CONIFER); } - Height += a_BlockPos.y; + Height += static_cast<HEIGHTTYPE>(a_BlockPos.y); // Optional size-1 bottom leaves layer: if ((MyRandom & 1) == 0) diff --git a/src/Generating/VerticalLimit.cpp b/src/Generating/VerticalLimit.cpp index b3e8ea35d..8ae8c4d9b 100644 --- a/src/Generating/VerticalLimit.cpp +++ b/src/Generating/VerticalLimit.cpp @@ -5,22 +5,6 @@ #include "VerticalLimit.h" - - - -// Emit a warning if the first param is true -#define CONDWARNING(ShouldLog, Fmt, ...) \ - do { \ - if (ShouldLog) \ - { \ - LOGWARNING(Fmt, __VA_ARGS__); \ - } \ - } while (false) - - - - - //////////////////////////////////////////////////////////////////////////////// // Globals: diff --git a/src/Generating/VerticalStrategy.cpp b/src/Generating/VerticalStrategy.cpp index 9fd11865b..3b0307167 100644 --- a/src/Generating/VerticalStrategy.cpp +++ b/src/Generating/VerticalStrategy.cpp @@ -16,21 +16,6 @@ static const int SEED_OFFSET = 135; - - -// Emit a warning if the first param is true -#define CONDWARNING(ShouldLog, Fmt, ...) \ - do { \ - if (ShouldLog) \ - { \ - LOGWARNING(Fmt, __VA_ARGS__); \ - } \ - } while (false) - - - - - //////////////////////////////////////////////////////////////////////////////// // Globals: |