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/PieceModifier.cpp | |
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 '')
-rw-r--r-- | src/Generating/PieceModifier.cpp | 21 |
1 files changed, 3 insertions, 18 deletions
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)) |