Fixed a possible crash in Ravines.
git-svn-id: http://mc-server.googlecode.com/svn/trunk@695 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
parent
3f30d5dfd2
commit
a68b9bd986
@ -315,7 +315,7 @@ void cStructGenRavines::cRavine::Smooth(void)
|
|||||||
|
|
||||||
void cStructGenRavines::cRavine::FinishLinear(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)
|
// _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
|
// 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);
|
int DistSq = (DifX + x) * (DifX + x) + (DifZ + z) * (DifZ + z);
|
||||||
if (DistSq <= RadiusSq)
|
if (DistSq <= RadiusSq)
|
||||||
{
|
{
|
||||||
int Top = itr->m_Top;
|
int Top = std::min(itr->m_Top, cChunkDef::Height);
|
||||||
for (int y = itr->m_Bottom; y <= Top; y++)
|
for (int y = std::max(itr->m_Bottom, 1); y <= Top; y++)
|
||||||
{
|
{
|
||||||
cChunkDef::SetBlock(a_BlockTypes, x, y, z, E_BLOCK_AIR);
|
cChunkDef::SetBlock(a_BlockTypes, x, y, z, E_BLOCK_AIR);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user