summaryrefslogtreecommitdiffstats
path: root/src/Generating/Ravines.cpp
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2014-05-08 20:17:31 +0200
committerMattes D <github@xoft.cz>2014-05-08 20:17:31 +0200
commitccf44f18d1258e7b75db36afdc39bc816f7c78fe (patch)
tree7a5a436db251e032af712374830d394753fccc83 /src/Generating/Ravines.cpp
parentcNetherFortGen uses cGridStructGen. (diff)
parentFixed MSVC 64-bit build warnings. (diff)
downloadcuberite-ccf44f18d1258e7b75db36afdc39bc816f7c78fe.tar
cuberite-ccf44f18d1258e7b75db36afdc39bc816f7c78fe.tar.gz
cuberite-ccf44f18d1258e7b75db36afdc39bc816f7c78fe.tar.bz2
cuberite-ccf44f18d1258e7b75db36afdc39bc816f7c78fe.tar.lz
cuberite-ccf44f18d1258e7b75db36afdc39bc816f7c78fe.tar.xz
cuberite-ccf44f18d1258e7b75db36afdc39bc816f7c78fe.tar.zst
cuberite-ccf44f18d1258e7b75db36afdc39bc816f7c78fe.zip
Diffstat (limited to 'src/Generating/Ravines.cpp')
-rw-r--r--src/Generating/Ravines.cpp10
1 files changed, 8 insertions, 2 deletions
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;