From a2925ee6c83fa1db41fb8e27444a4e76bd858de4 Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Sun, 3 Mar 2013 15:02:50 +0000 Subject: [PATCH] FinishGen: Fixed sand collapsing and fluid stationarizing git-svn-id: http://mc-server.googlecode.com/svn/trunk@1246 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/Generating/FinishGen.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/source/Generating/FinishGen.cpp b/source/Generating/FinishGen.cpp index 84aa019af..83788fcab 100644 --- a/source/Generating/FinishGen.cpp +++ b/source/Generating/FinishGen.cpp @@ -429,6 +429,7 @@ void cFinishGenPreSimulator::CollapseSandGravel( for (int x = 0; x < cChunkDef::Width; x++) { int LastY = -1; + int HeightY = 0; for (int y = 0; y < cChunkDef::Height; y++) { BLOCKTYPE Block = cChunkDef::GetBlock(a_BlockTypes, x, y, z); @@ -438,16 +439,22 @@ void cFinishGenPreSimulator::CollapseSandGravel( { // Set the last block onto which stuff can fall to this height: LastY = y; + HeightY = y; break; } case E_BLOCK_AIR: + { + // Do nothing + break; + } case E_BLOCK_FIRE: case E_BLOCK_WATER: case E_BLOCK_STATIONARY_WATER: case E_BLOCK_LAVA: case E_BLOCK_STATIONARY_LAVA: { - // Do nothing + // Do nothing, only remember this height as potentially highest + HeightY = y; break; } case E_BLOCK_SAND: @@ -459,11 +466,15 @@ void cFinishGenPreSimulator::CollapseSandGravel( cChunkDef::SetBlock(a_BlockTypes, x, y, z, E_BLOCK_AIR); } LastY++; + if (LastY > HeightY) + { + HeightY = LastY; + } break; } } // switch (GetBlock) } // for y - cChunkDef::SetHeight(a_HeightMap, x, z, LastY); + cChunkDef::SetHeight(a_HeightMap, x, z, HeightY); } // for x } // for z } @@ -525,7 +536,7 @@ void cFinishGenPreSimulator::StationarizeFluid( // Turn fluid at the chunk edges into non-stationary fluid: for (int y = 0; y < cChunkDef::Height; y++) { - for (int i = 1; i < cChunkDef::Width; i++) // i stands for both x and z here + for (int i = 0; i < cChunkDef::Width; i++) // i stands for both x and z here { if (cChunkDef::GetBlock(a_BlockTypes, 0, y, i) == a_StationaryFluid) {