From 68776c4d5919638b3cecccd083155cd58ccac573 Mon Sep 17 00:00:00 2001 From: KingCol13 <48412633+KingCol13@users.noreply.github.com> Date: Fri, 9 Jul 2021 18:45:53 +0100 Subject: Item frame maps (#5258) + Send map data when item frame spawns. + Add some casts to placate compiler warnings. * size_t for array access. * Mark chunk dirty when rotation or item in item frame is changed. --- src/Generating/FinishGen.cpp | 2 +- src/Generating/IntGen.h | 3 +-- src/Generating/ProtIntGen.h | 2 +- src/Generating/Trees.cpp | 6 +++--- 4 files changed, 6 insertions(+), 7 deletions(-) (limited to 'src/Generating') diff --git a/src/Generating/FinishGen.cpp b/src/Generating/FinishGen.cpp index a6da93976..984957e60 100644 --- a/src/Generating/FinishGen.cpp +++ b/src/Generating/FinishGen.cpp @@ -613,7 +613,7 @@ void cFinishGenTallGrass::GenFinish(cChunkDesc & a_ChunkDesc) } else { - NIBBLETYPE meta = (m_Noise.IntNoise2DInt(xx * 50, zz * 50) / 7 % 2) + 1; + NIBBLETYPE meta = static_cast((m_Noise.IntNoise2DInt(xx * 50, zz * 50) / 7 % 2) + 1); a_ChunkDesc.SetBlockTypeMeta(x, y, z, E_BLOCK_TALL_GRASS, meta); a_ChunkDesc.SetHeight(x, z, static_cast(y)); } diff --git a/src/Generating/IntGen.h b/src/Generating/IntGen.h index 4ef8c3452..b56567f9f 100644 --- a/src/Generating/IntGen.h +++ b/src/Generating/IntGen.h @@ -1,4 +1,3 @@ - // IntGen.h // Declares the cIntGen class and descendants for generating and filtering various 2D arrays of ints @@ -494,7 +493,7 @@ public: if (IsBiomeOcean(above) || IsBiomeOcean(below) || IsBiomeOcean(left) || IsBiomeOcean(right)) { // First convert the value to a regular biome (drop the M flag), then modulo by our biome count: - val = ToBeach[(val % 128) % ARRAYCOUNT(ToBeach)]; + val = ToBeach[static_cast((val % 128)) % ARRAYCOUNT(ToBeach)]; } } a_Values[x + z * SizeX] = val; diff --git a/src/Generating/ProtIntGen.h b/src/Generating/ProtIntGen.h index 87e13c6cc..290998075 100644 --- a/src/Generating/ProtIntGen.h +++ b/src/Generating/ProtIntGen.h @@ -767,7 +767,7 @@ public: if (IsBiomeOcean(above) || IsBiomeOcean(below) || IsBiomeOcean(left) || IsBiomeOcean(right)) { // First convert the value to a regular biome (drop the M flag), then modulo by our biome count: - val = ToBeach[(val % 128) % ARRAYCOUNT(ToBeach)]; + val = ToBeach[static_cast(val % 128) % ARRAYCOUNT(ToBeach)]; } } a_Values[x + z * a_SizeX] = val; diff --git a/src/Generating/Trees.cpp b/src/Generating/Trees.cpp index 28f0da6ce..53017ce06 100644 --- a/src/Generating/Trees.cpp +++ b/src/Generating/Trees.cpp @@ -672,7 +672,7 @@ NIBBLETYPE GetLogMetaFromDirection(NIBBLETYPE a_BlockMeta, Vector3d a_Direction) void GetBirchTreeImage(Vector3i a_BlockPos, cNoise & a_Noise, int a_Seq, sSetBlockVector & a_LogBlocks, sSetBlockVector & a_OtherBlocks) { - HEIGHTTYPE Height = 5 + (a_Noise.IntNoise3DInt(a_BlockPos.addedX(64 * a_Seq)) % 3); + HEIGHTTYPE Height = 5 + static_cast(a_Noise.IntNoise3DInt(a_BlockPos.addedX(64 * a_Seq)) % 3); // Prealloc, so that we don't realloc too often later: a_LogBlocks.reserve(static_cast(Height)); @@ -839,7 +839,7 @@ void GetDarkoakTreeImage(Vector3i a_BlockPos, cNoise & a_Noise, int a_Seq, sSetB void GetTallBirchTreeImage(Vector3i a_BlockPos, cNoise & a_Noise, int a_Seq, sSetBlockVector & a_LogBlocks, sSetBlockVector & a_OtherBlocks) { - HEIGHTTYPE Height = 9 + (a_Noise.IntNoise3DInt(a_BlockPos.addedX(64 * a_Seq)) % 3); + HEIGHTTYPE Height = 9 + static_cast(a_Noise.IntNoise3DInt(a_BlockPos.addedX(64 * a_Seq)) % 3); // Prealloc, so that we don't realloc too often later: a_LogBlocks.reserve(static_cast(Height)); @@ -1078,7 +1078,7 @@ void GetLargeSpruceTreeImage(Vector3i a_BlockPos, cNoise & a_Noise, int a_Seq, s for (int i = 0; i < LeavesRingCount; i++) { - unsigned int Val = (a_Noise.IntNoise3DInt(a_BlockPos.addedXZ(32 * a_Seq, 32 * i)) / 23) % 8; + unsigned int Val = static_cast(a_Noise.IntNoise3DInt(a_BlockPos.addedXZ(32 * a_Seq, 32 * i)) / 23) % 8; if ((Val < 4) && RingRadius < 3) { RingRadius++; -- cgit v1.2.3