summaryrefslogtreecommitdiffstats
path: root/src/Generating
diff options
context:
space:
mode:
authorNiLSPACE <NiLSPACE@users.noreply.github.com>2015-02-28 18:05:06 +0100
committerNiLSPACE <NiLSPACE@users.noreply.github.com>2015-02-28 18:05:06 +0100
commit24bb911c3cce1eefc6fce198ae8696c25342515e (patch)
tree3abaabac7549e5038261e48a7c74bf21ba0b72a6 /src/Generating
parentMerge pull request #1779 from mc-server/DoorHingesFix (diff)
parentGetSnowStartHeight returns an int (diff)
downloadcuberite-24bb911c3cce1eefc6fce198ae8696c25342515e.tar
cuberite-24bb911c3cce1eefc6fce198ae8696c25342515e.tar.gz
cuberite-24bb911c3cce1eefc6fce198ae8696c25342515e.tar.bz2
cuberite-24bb911c3cce1eefc6fce198ae8696c25342515e.tar.lz
cuberite-24bb911c3cce1eefc6fce198ae8696c25342515e.tar.xz
cuberite-24bb911c3cce1eefc6fce198ae8696c25342515e.tar.zst
cuberite-24bb911c3cce1eefc6fce198ae8696c25342515e.zip
Diffstat (limited to 'src/Generating')
-rw-r--r--src/Generating/FinishGen.cpp81
1 files changed, 33 insertions, 48 deletions
diff --git a/src/Generating/FinishGen.cpp b/src/Generating/FinishGen.cpp
index e10cb00f8..d8fb9c8c0 100644
--- a/src/Generating/FinishGen.cpp
+++ b/src/Generating/FinishGen.cpp
@@ -470,30 +470,22 @@ void cFinishGenSnow::GenFinish(cChunkDesc & a_ChunkDesc)
{
for (int x = 0; x < cChunkDef::Width; x++)
{
- switch (a_ChunkDesc.GetBiome(x, z))
+ int Height = a_ChunkDesc.GetHeight(x, z);
+ if (GetSnowStartHeight(a_ChunkDesc.GetBiome(x, z)) > Height)
{
- case biIcePlains:
- case biIceMountains:
- case biTaiga:
- case biTaigaHills:
- case biFrozenRiver:
- case biFrozenOcean:
- {
- int Height = a_ChunkDesc.GetHeight(x, z);
- if (cBlockInfo::IsSnowable(a_ChunkDesc.GetBlockType(x, Height, z)) && (Height < cChunkDef::Height - 1))
- {
- a_ChunkDesc.SetBlockType(x, Height + 1, z, E_BLOCK_SNOW);
- a_ChunkDesc.SetHeight(x, z, Height + 1);
- }
- break;
- }
- default:
- {
- // There's no snow in the other biomes.
- break;
- }
+ // Height isn't high enough for snow to start forming.
+ continue;
}
- }
+
+ if (!cBlockInfo::IsSnowable(a_ChunkDesc.GetBlockType(x, Height, z)) && (Height < cChunkDef::Height - 1))
+ {
+ // The top block can't be snown over.
+ continue;
+ }
+
+ a_ChunkDesc.SetBlockType(x, Height + 1, z, E_BLOCK_SNOW);
+ a_ChunkDesc.SetHeight(x, z, Height + 1);
+ } // for x
} // for z
}
@@ -511,34 +503,27 @@ void cFinishGenIce::GenFinish(cChunkDesc & a_ChunkDesc)
{
for (int x = 0; x < cChunkDef::Width; x++)
{
- switch (a_ChunkDesc.GetBiome(x, z))
+ int Height = a_ChunkDesc.GetHeight(x, z);
+ if (GetSnowStartHeight(a_ChunkDesc.GetBiome(x, z)) > Height)
{
- case biIcePlains:
- case biIceMountains:
- case biTaiga:
- case biTaigaHills:
- case biFrozenRiver:
- case biFrozenOcean:
- {
- int Height = a_ChunkDesc.GetHeight(x, z);
- switch (a_ChunkDesc.GetBlockType(x, Height, z))
- {
- case E_BLOCK_WATER:
- case E_BLOCK_STATIONARY_WATER:
- {
- a_ChunkDesc.SetBlockType(x, Height, z, E_BLOCK_ICE);
- break;
- }
- }
- break;
- }
- default:
- {
- // No icy water in other biomes.
- break;
- }
+ // Height isn't high enough for snow to start forming.
+ continue;
}
- }
+
+ if (!IsBlockWater(a_ChunkDesc.GetBlockType(x, Height, z)))
+ {
+ // The block isn't a water block.
+ continue;
+ }
+
+ if (a_ChunkDesc.GetBlockMeta(x, Height, z) != 0)
+ {
+ // The water block isn't a source block.
+ continue;
+ }
+
+ a_ChunkDesc.SetBlockType(x, Height, z, E_BLOCK_ICE);
+ } // for x
} // for z
}