From c4ea25e136026004526a63516cbed498e2b6fabe Mon Sep 17 00:00:00 2001 From: Mattes D Date: Thu, 8 May 2014 20:16:35 +0200 Subject: Fixed MSVC 64-bit build warnings. --- src/Generating/Caves.cpp | 10 ++++++++-- src/Generating/MineShafts.cpp | 6 +++--- src/Generating/PieceGenerator.cpp | 4 ++-- src/Generating/Ravines.cpp | 10 ++++++++-- src/Generating/Trees.cpp | 2 +- 5 files changed, 22 insertions(+), 10 deletions(-) (limited to 'src/Generating') diff --git a/src/Generating/Caves.cpp b/src/Generating/Caves.cpp index 5cad11d2a..6df22a14a 100644 --- a/src/Generating/Caves.cpp +++ b/src/Generating/Caves.cpp @@ -239,9 +239,15 @@ void cCaveTunnel::Randomize(cNoise & a_Noise) bool cCaveTunnel::RefineDefPoints(const cCaveDefPoints & a_Src, cCaveDefPoints & a_Dst) { + if (a_Src.size() < 2) + { + // There are no midpoints, nothing to smooth + return true; + } + // Smoothing: for each line segment, add points on its 1/4 lengths bool res = false; - int Num = a_Src.size() - 2; // this many intermediary points + size_t Num = a_Src.size() - 2; // this many intermediary points a_Dst.clear(); a_Dst.reserve(Num * 2 + 2); cCaveDefPoints::const_iterator itr = a_Src.begin() + 1; @@ -251,7 +257,7 @@ bool cCaveTunnel::RefineDefPoints(const cCaveDefPoints & a_Src, cCaveDefPoints & int PrevY = Source.m_BlockY; int PrevZ = Source.m_BlockZ; int PrevR = Source.m_Radius; - for (int i = 0; i <= Num; ++i, ++itr) + for (size_t i = 0; i <= Num; ++i, ++itr) { int dx = itr->m_BlockX - PrevX; int dy = itr->m_BlockY - PrevY; diff --git a/src/Generating/MineShafts.cpp b/src/Generating/MineShafts.cpp index 231295c3f..af63e549b 100644 --- a/src/Generating/MineShafts.cpp +++ b/src/Generating/MineShafts.cpp @@ -543,7 +543,7 @@ cMineShaft * cMineShaftCorridor::CreateAndFit( { cCuboid BoundingBox(a_PivotX, a_PivotY - 1, a_PivotZ); BoundingBox.p2.y += 3; - int rnd = a_Noise.IntNoise3DInt(a_PivotX, a_PivotY + a_ParentSystem.m_MineShafts.size(), a_PivotZ) / 7; + int rnd = a_Noise.IntNoise3DInt(a_PivotX, a_PivotY + (int)a_ParentSystem.m_MineShafts.size(), a_PivotZ) / 7; int NumSegments = 2 + (rnd) % (MAX_SEGMENTS - 1); // 2 .. MAX_SEGMENTS switch (a_Direction) { @@ -985,7 +985,7 @@ cMineShaft * cMineShaftCrossing::CreateAndFit( ) { cCuboid BoundingBox(a_PivotX, a_PivotY - 1, a_PivotZ); - int rnd = a_Noise.IntNoise3DInt(a_PivotX, a_PivotY + a_ParentSystem.m_MineShafts.size(), a_PivotZ) / 7; + int rnd = a_Noise.IntNoise3DInt(a_PivotX, a_PivotY + (int)a_ParentSystem.m_MineShafts.size(), a_PivotZ) / 7; BoundingBox.p2.y += 3; if ((rnd % 4) < 2) { @@ -1127,7 +1127,7 @@ cMineShaft * cMineShaftStaircase::CreateAndFit( cNoise & a_Noise ) { - int rnd = a_Noise.IntNoise3DInt(a_PivotX, a_PivotY + a_ParentSystem.m_MineShafts.size(), a_PivotZ) / 7; + int rnd = a_Noise.IntNoise3DInt(a_PivotX, a_PivotY + (int)a_ParentSystem.m_MineShafts.size(), a_PivotZ) / 7; cCuboid Box; switch (a_Direction) { diff --git a/src/Generating/PieceGenerator.cpp b/src/Generating/PieceGenerator.cpp index db45cd08b..ce19c1c95 100644 --- a/src/Generating/PieceGenerator.cpp +++ b/src/Generating/PieceGenerator.cpp @@ -339,9 +339,9 @@ cPlacedPiece * cPieceGenerator::PlaceStartingPiece(int a_BlockX, int a_BlockY, i int NumRotations = 1; for (size_t i = 1; i < ARRAYCOUNT(Rotations); i++) { - if (StartingPiece->CanRotateCCW(i)) + if (StartingPiece->CanRotateCCW((int)i)) { - Rotations[NumRotations] = i; + Rotations[NumRotations] = (int)i; NumRotations += 1; } } diff --git a/src/Generating/Ravines.cpp b/src/Generating/Ravines.cpp index 267dcbbf9..a036cf25f 100644 --- a/src/Generating/Ravines.cpp +++ b/src/Generating/Ravines.cpp @@ -306,8 +306,14 @@ void cStructGenRavines::cRavine::GenerateBaseDefPoints(int a_BlockX, int a_Block void cStructGenRavines::cRavine::RefineDefPoints(const cRavDefPoints & a_Src, cRavDefPoints & a_Dst) { + if (a_Src.size() < 2) + { + // No midpoints, nothing to refine + return; + } + // Smoothing: for each line segment, add points on its 1/4 lengths - int Num = a_Src.size() - 2; // this many intermediary points + size_t Num = a_Src.size() - 2; // this many intermediary points a_Dst.clear(); a_Dst.reserve(Num * 2 + 2); cRavDefPoints::const_iterator itr = a_Src.begin() + 1; @@ -318,7 +324,7 @@ void cStructGenRavines::cRavine::RefineDefPoints(const cRavDefPoints & a_Src, cR int PrevR = Source.m_Radius; int PrevT = Source.m_Top; int PrevB = Source.m_Bottom; - for (int i = 0; i <= Num; ++i, ++itr) + for (size_t i = 0; i <= Num; ++i, ++itr) { int dx = itr->m_BlockX - PrevX; int dz = itr->m_BlockZ - PrevZ; diff --git a/src/Generating/Trees.cpp b/src/Generating/Trees.cpp index 4909587b1..4f1553c36 100644 --- a/src/Generating/Trees.cpp +++ b/src/Generating/Trees.cpp @@ -136,7 +136,7 @@ inline void PushSomeColumns(int a_BlockX, int a_Height, int a_BlockZ, int a_Colu { int x = a_BlockX + a_Coords[i].x; int z = a_BlockZ + a_Coords[i].z; - if (a_Noise.IntNoise3DInt(x + 64 * a_Seq, a_Height + i, z + 64 * a_Seq) <= a_Chance) + if (a_Noise.IntNoise3DInt(x + 64 * a_Seq, a_Height + (int)i, z + 64 * a_Seq) <= a_Chance) { for (int j = 0; j < a_ColumnHeight; j++) { -- cgit v1.2.3