summaryrefslogtreecommitdiffstats
path: root/src/Generating
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2014-05-18 23:10:23 +0200
committermadmaxoft <github@xoft.cz>2014-05-18 23:10:23 +0200
commite69a11012fb7543d47230663a01af2a7ec20960c (patch)
tree2c4a5b6759f76059736bdf5b30ea17f2a6ee8570 /src/Generating
parentUpdated SandVillage prefabs to latest Gallery content. (diff)
parentThere's no "round" function in MSVC2008. (diff)
downloadcuberite-e69a11012fb7543d47230663a01af2a7ec20960c.tar
cuberite-e69a11012fb7543d47230663a01af2a7ec20960c.tar.gz
cuberite-e69a11012fb7543d47230663a01af2a7ec20960c.tar.bz2
cuberite-e69a11012fb7543d47230663a01af2a7ec20960c.tar.lz
cuberite-e69a11012fb7543d47230663a01af2a7ec20960c.tar.xz
cuberite-e69a11012fb7543d47230663a01af2a7ec20960c.tar.zst
cuberite-e69a11012fb7543d47230663a01af2a7ec20960c.zip
Diffstat (limited to 'src/Generating')
-rw-r--r--src/Generating/StructGen.cpp28
-rw-r--r--src/Generating/Trees.cpp34
2 files changed, 40 insertions, 22 deletions
diff --git a/src/Generating/StructGen.cpp b/src/Generating/StructGen.cpp
index db9d5578c..636364e17 100644
--- a/src/Generating/StructGen.cpp
+++ b/src/Generating/StructGen.cpp
@@ -596,24 +596,22 @@ void cStructGenDirectOverhangs::GenFinish(cChunkDesc & a_ChunkDesc)
// Interpolate between FloorLo and FloorHi:
for (int z = 0; z < 16; z++) for (int x = 0; x < 16; x++)
{
- switch (a_ChunkDesc.GetBiome(x, z))
+ EMCSBiome biome = a_ChunkDesc.GetBiome(x, z);
+
+ if ((biome == biExtremeHills) || (biome == biExtremeHillsEdge))
{
- case biExtremeHills:
- case biExtremeHillsEdge:
+ int Lo = FloorLo[x + 17 * z] / 256;
+ int Hi = FloorHi[x + 17 * z] / 256;
+ for (int y = 0; y < SEGMENT_HEIGHT; y++)
{
- int Lo = FloorLo[x + 17 * z] / 256;
- int Hi = FloorHi[x + 17 * z] / 256;
- for (int y = 0; y < SEGMENT_HEIGHT; y++)
+ int Val = Lo + (Hi - Lo) * y / SEGMENT_HEIGHT;
+ if (Val < 0)
{
- int Val = Lo + (Hi - Lo) * y / SEGMENT_HEIGHT;
- if (Val < 0)
- {
- a_ChunkDesc.SetBlockType(x, y + Segment, z, E_BLOCK_AIR);
- }
- } // for y
- break;
- }
- } // switch (biome)
+ a_ChunkDesc.SetBlockType(x, y + Segment, z, E_BLOCK_AIR);
+ }
+ } // for y
+ break;
+ } // if (biome)
} // for z, x
// Swap the floors:
diff --git a/src/Generating/Trees.cpp b/src/Generating/Trees.cpp
index 4f1553c36..522f45148 100644
--- a/src/Generating/Trees.cpp
+++ b/src/Generating/Trees.cpp
@@ -174,7 +174,7 @@ void GetTreeImageByBiome(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_No
{
GetBirchTreeImage(a_BlockX, a_BlockY, a_BlockZ, a_Noise, a_Seq, a_LogBlocks, a_OtherBlocks);
}
- break;
+ return;
}
case biTaiga:
@@ -184,14 +184,14 @@ void GetTreeImageByBiome(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_No
{
// Conifers
GetConiferTreeImage(a_BlockX, a_BlockY, a_BlockZ, a_Noise, a_Seq, a_LogBlocks, a_OtherBlocks);
- break;
+ return;
}
case biSwampland:
{
// Swamp trees:
GetSwampTreeImage(a_BlockX, a_BlockY, a_BlockZ, a_Noise, a_Seq, a_LogBlocks, a_OtherBlocks);
- break;
+ return;
}
case biJungle:
@@ -207,21 +207,21 @@ void GetTreeImageByBiome(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_No
{
GetJungleTreeImage(a_BlockX, a_BlockY, a_BlockZ, a_Noise, a_Seq, a_LogBlocks, a_OtherBlocks);
}
- break;
+ return;
}
case biBirchForest:
case biBirchForestHills:
{
GetBirchTreeImage(a_BlockX, a_BlockY, a_BlockZ, a_Noise, a_Seq, a_LogBlocks, a_OtherBlocks);
- break;
+ return;
}
case biBirchForestM:
case biBirchForestHillsM:
{
GetTallBirchTreeImage(a_BlockX, a_BlockY, a_BlockZ, a_Noise, a_Seq, a_LogBlocks, a_OtherBlocks);
- break;
+ return;
}
case biRoofedForest:
@@ -257,9 +257,29 @@ void GetTreeImageByBiome(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_No
{
// TODO: These need their special trees
GetBirchTreeImage(a_BlockX, a_BlockY, a_BlockZ, a_Noise, a_Seq, a_LogBlocks, a_OtherBlocks);
- break;
+ return;
+ }
+
+ case biDesert:
+ case biDesertHills:
+ case biRiver:
+ case biBeach:
+ case biHell:
+ case biSky:
+ case biOcean:
+ case biFrozenOcean:
+ case biFrozenRiver:
+ case biVariant:
+ case biNumBiomes:
+ case biNumVariantBiomes:
+ case biInvalidBiome:
+ {
+ // These biomes have no trees, or are non-biome members of the enum.
+ return;
}
}
+
+ ASSERT(!"Invalid biome type!");
}