From a68b9bd986f557c79822d5ba61333747dd11bd80 Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Fri, 27 Jul 2012 16:46:15 +0000 Subject: Fixed a possible crash in Ravines. git-svn-id: http://mc-server.googlecode.com/svn/trunk@695 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/Ravines.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/Ravines.cpp b/source/Ravines.cpp index 726f3ffb4..cee1192d6 100644 --- a/source/Ravines.cpp +++ b/source/Ravines.cpp @@ -315,7 +315,7 @@ void cStructGenRavines::cRavine::Smooth(void) void cStructGenRavines::cRavine::FinishLinear(void) { - // For each segment, use Bresenham's algorithm to draw a "line" of defpoints + // For each segment, use Bresenham's line algorithm to draw a "line" of defpoints // _X 2012_07_20: I tried modifying this algorithm to produce "thick" lines (only one coord change per point) // But the results were about the same as the original, so I disposed of it again - no need to use twice the count of points @@ -450,8 +450,8 @@ void cStructGenRavines::cRavine::ProcessChunk( int DistSq = (DifX + x) * (DifX + x) + (DifZ + z) * (DifZ + z); if (DistSq <= RadiusSq) { - int Top = itr->m_Top; - for (int y = itr->m_Bottom; y <= Top; y++) + int Top = std::min(itr->m_Top, cChunkDef::Height); + for (int y = std::max(itr->m_Bottom, 1); y <= Top; y++) { cChunkDef::SetBlock(a_BlockTypes, x, y, z, E_BLOCK_AIR); } -- cgit v1.2.3