summaryrefslogtreecommitdiffstats
path: root/source/Generating/DistortedHeightmap.cpp
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-05-12 22:04:07 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-05-12 22:04:07 +0200
commitb1bd1001f713b3f4af95f46093bbd48e43227fa7 (patch)
tree7c8c9a79eb569fdf8c914282af9b90f4be754ca4 /source/Generating/DistortedHeightmap.cpp
parentRenamed linear interpolation from Noise.h to a more proper LinearUpscale and moved it to a separate file. (diff)
downloadcuberite-b1bd1001f713b3f4af95f46093bbd48e43227fa7.tar
cuberite-b1bd1001f713b3f4af95f46093bbd48e43227fa7.tar.gz
cuberite-b1bd1001f713b3f4af95f46093bbd48e43227fa7.tar.bz2
cuberite-b1bd1001f713b3f4af95f46093bbd48e43227fa7.tar.lz
cuberite-b1bd1001f713b3f4af95f46093bbd48e43227fa7.tar.xz
cuberite-b1bd1001f713b3f4af95f46093bbd48e43227fa7.tar.zst
cuberite-b1bd1001f713b3f4af95f46093bbd48e43227fa7.zip
Diffstat (limited to 'source/Generating/DistortedHeightmap.cpp')
-rw-r--r--source/Generating/DistortedHeightmap.cpp42
1 files changed, 39 insertions, 3 deletions
diff --git a/source/Generating/DistortedHeightmap.cpp b/source/Generating/DistortedHeightmap.cpp
index d44ef60e5..f1b74e70d 100644
--- a/source/Generating/DistortedHeightmap.cpp
+++ b/source/Generating/DistortedHeightmap.cpp
@@ -270,18 +270,54 @@ void cDistortedHeightmap::ComposeTerrain(cChunkDesc & a_ChunkDesc)
continue;
}
// "ground" part:
- if (LastAir - y > 4)
+ if (y < LastAir - 4)
{
a_ChunkDesc.SetBlockType(x, y, z, E_BLOCK_STONE);
continue;
}
if (HasHadWater)
{
- a_ChunkDesc.SetBlockType(x, y, z, E_BLOCK_SAND);
+ // TODO: Decide between sand and dirt
+ a_ChunkDesc.SetBlockType(x, y, z, (y < LastAir - 3) ? E_BLOCK_SANDSTONE : E_BLOCK_SAND);
}
else
{
- a_ChunkDesc.SetBlockType(x, y, z, (LastAir == y + 1) ? E_BLOCK_GRASS : E_BLOCK_DIRT);
+ switch (a_ChunkDesc.GetBiome(x, z))
+ {
+ case biOcean:
+ case biPlains:
+ case biExtremeHills:
+ case biForest:
+ case biTaiga:
+ case biSwampland:
+ case biRiver:
+ case biFrozenOcean:
+ case biFrozenRiver:
+ case biIcePlains:
+ case biIceMountains:
+ case biForestHills:
+ case biTaigaHills:
+ case biExtremeHillsEdge:
+ case biJungle:
+ case biJungleHills:
+ {
+ a_ChunkDesc.SetBlockType(x, y, z, (y == LastAir - 1) ? E_BLOCK_GRASS : E_BLOCK_DIRT);
+ break;
+ }
+ case biDesertHills:
+ case biDesert:
+ case biBeach:
+ {
+ a_ChunkDesc.SetBlockType(x, y, z, (y < LastAir - 3) ? E_BLOCK_SANDSTONE : E_BLOCK_SAND);
+ break;
+ }
+ case biMushroomIsland:
+ case biMushroomShore:
+ {
+ a_ChunkDesc.SetBlockType(x, y, z, (y == LastAir - 1) ? E_BLOCK_MYCELIUM : E_BLOCK_DIRT);
+ break;
+ }
+ }
}
} // for y
a_ChunkDesc.SetBlockType(x, 0, z, E_BLOCK_BEDROCK);