diff options
author | peterbell10 <peterbell10@live.co.uk> | 2017-09-14 10:48:57 +0200 |
---|---|---|
committer | Alexander Harkness <me@bearbin.net> | 2017-09-14 10:48:57 +0200 |
commit | 307e7aaff5c454b703db4d536c40d5715d96032b (patch) | |
tree | e217d6a073e6b87aaeb6618a933676d3251b9355 /src/Generating | |
parent | Updated compile.sh script (#4009) (diff) | |
download | cuberite-307e7aaff5c454b703db4d536c40d5715d96032b.tar cuberite-307e7aaff5c454b703db4d536c40d5715d96032b.tar.gz cuberite-307e7aaff5c454b703db4d536c40d5715d96032b.tar.bz2 cuberite-307e7aaff5c454b703db4d536c40d5715d96032b.tar.lz cuberite-307e7aaff5c454b703db4d536c40d5715d96032b.tar.xz cuberite-307e7aaff5c454b703db4d536c40d5715d96032b.tar.zst cuberite-307e7aaff5c454b703db4d536c40d5715d96032b.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Generating/CMakeLists.txt | 9 | ||||
-rw-r--r-- | src/Generating/FinishGen.cpp | 6 | ||||
-rw-r--r-- | src/Generating/StructGen.cpp | 135 |
3 files changed, 84 insertions, 66 deletions
diff --git a/src/Generating/CMakeLists.txt b/src/Generating/CMakeLists.txt index 67e0e8b22..02f94729f 100644 --- a/src/Generating/CMakeLists.txt +++ b/src/Generating/CMakeLists.txt @@ -71,14 +71,7 @@ SET (HDRS ) if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") - set_source_files_properties(BioGen.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=switch-enum") - set_source_files_properties(CompoGenBiomal.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=global-constructors ") - set_source_files_properties(ComposableGenerator.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=switch-enum") - set_source_files_properties(FinishGen.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=switch-enum -Wno-error=switch") - set_source_files_properties(PieceGenerator.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=global-constructors") - set_source_files_properties(Prefab.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=global-constructors") - set_source_files_properties(StructGen.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=switch-enum -Wno-error=switch") - set_source_files_properties(VillageGen.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=global-constructors -Wno-error=switch-enum") + set_source_files_properties(CompoGenBiomal.cpp PROPERTIES COMPILE_FLAGS "-Wno-error=global-constructors") endif() if(NOT MSVC) diff --git a/src/Generating/FinishGen.cpp b/src/Generating/FinishGen.cpp index fe5ce82be..aa7dd86c1 100644 --- a/src/Generating/FinishGen.cpp +++ b/src/Generating/FinishGen.cpp @@ -586,9 +586,11 @@ bool cFinishGenVines::IsJungleVariant(EMCSBiome a_Biome) { return true; } + default: + { + return false; + } } - - return false; } diff --git a/src/Generating/StructGen.cpp b/src/Generating/StructGen.cpp index a36ebc608..d0e8da26a 100644 --- a/src/Generating/StructGen.cpp +++ b/src/Generating/StructGen.cpp @@ -198,65 +198,88 @@ int cStructGenTrees::GetNumTrees( const cChunkDef::BiomeMap & a_Biomes ) { - int NumTrees = 0; - for (int x = 0; x < cChunkDef::Width; x++) for (int z = 0; z < cChunkDef::Width; z++) + auto BiomeTrees = [](EMCSBiome a_Biome) { - int Add = 0; - switch (cChunkDef::GetBiome(a_Biomes, x, z)) + switch (a_Biome) { - case biOcean: Add = 2; break; - case biDesert: Add = 0; break; - case biPlains: Add = 1; break; - case biExtremeHills: Add = 3; break; - case biForest: Add = 30; break; - case biTaiga: Add = 30; break; - case biSwampland: Add = 8; break; - case biIcePlains: Add = 1; break; - case biIceMountains: Add = 1; break; - case biMushroomIsland: Add = 3; break; - case biMushroomShore: Add = 3; break; - case biForestHills: Add = 20; break; - case biTaigaHills: Add = 20; break; - case biExtremeHillsEdge: Add = 5; break; - case biJungle: Add = 120; break; - case biJungleHills: Add = 90; break; - case biJungleEdge: Add = 90; break; - case biBirchForest: Add = 30; break; - case biBirchForestHills: Add = 20; break; - case biRoofedForest: Add = 50; break; - case biColdTaiga: Add = 20; break; - case biColdTaigaHills: Add = 15; break; - case biMegaTaiga: Add = 30; break; - case biMegaTaigaHills: Add = 25; break; - case biExtremeHillsPlus: Add = 3; break; - case biSavanna: Add = 8; break; - case biSavannaPlateau: Add = 12; break; - case biMesa: Add = 2; break; - case biMesaPlateauF: Add = 8; break; - case biMesaPlateau: Add = 8; break; - case biSunflowerPlains: Add = 1; break; - case biDesertM: Add = 0; break; - case biExtremeHillsM: Add = 4; break; - case biFlowerForest: Add = 30; break; - case biTaigaM: Add = 30; break; - case biSwamplandM: Add = 8; break; - case biIcePlainsSpikes: Add = 1; break; - case biJungleM: Add = 120; break; - case biJungleEdgeM: Add = 90; break; - case biBirchForestM: Add = 30; break; - case biBirchForestHillsM: Add = 20; break; - case biRoofedForestM: Add = 40; break; - case biColdTaigaM: Add = 30; break; - case biMegaSpruceTaiga: Add = 30; break; - case biMegaSpruceTaigaHills: Add = 30; break; - case biExtremeHillsPlusM: Add = 4; break; - case biSavannaM: Add = 8; break; - case biSavannaPlateauM: Add = 12; break; - case biMesaBryce: Add = 4; break; - case biMesaPlateauFM: Add = 12; break; - case biMesaPlateauM: Add = 12; break; + case biOcean: return 2; + case biPlains: return 1; + case biDesert: return 0; + case biExtremeHills: return 3; + case biForest: return 30; + case biTaiga: return 30; + case biSwampland: return 8; + case biRiver: return 0; + case biNether: return 0; + case biEnd: return 0; + case biFrozenOcean: return 0; + case biFrozenRiver: return 0; + case biIcePlains: return 1; + case biIceMountains: return 1; + case biMushroomIsland: return 3; + case biMushroomShore: return 3; + case biBeach: return 0; + case biDesertHills: return 0; + case biForestHills: return 20; + case biTaigaHills: return 20; + case biExtremeHillsEdge: return 5; + case biJungle: return 120; + case biJungleHills: return 90; + case biJungleEdge: return 90; + case biDeepOcean: return 0; + case biStoneBeach: return 0; + case biColdBeach: return 0; + case biBirchForest: return 30; + case biBirchForestHills: return 20; + case biRoofedForest: return 50; + case biColdTaiga: return 20; + case biColdTaigaHills: return 15; + case biMegaTaiga: return 30; + case biMegaTaigaHills: return 25; + case biExtremeHillsPlus: return 3; + case biSavanna: return 8; + case biSavannaPlateau: return 12; + case biMesa: return 2; + case biMesaPlateauF: return 8; + case biMesaPlateau: return 8; + // Biome variants + case biSunflowerPlains: return 1; + case biDesertM: return 0; + case biExtremeHillsM: return 4; + case biFlowerForest: return 30; + case biTaigaM: return 30; + case biSwamplandM: return 8; + case biIcePlainsSpikes: return 1; + case biJungleM: return 120; + case biJungleEdgeM: return 90; + case biBirchForestM: return 30; + case biBirchForestHillsM: return 20; + case biRoofedForestM: return 40; + case biColdTaigaM: return 30; + case biMegaSpruceTaiga: return 30; + case biMegaSpruceTaigaHills: return 30; + case biExtremeHillsPlusM: return 4; + case biSavannaM: return 8; + case biSavannaPlateauM: return 12; + case biMesaBryce: return 4; + case biMesaPlateauFM: return 12; + case biMesaPlateauM: return 12; + // Non-biomes + case biInvalidBiome: + case biNumBiomes: + case biVariant: + case biNumVariantBiomes: + { + ASSERT(!"Invalid biome in cStructGenTrees::GetNumTrees"); + return 0; + } } - NumTrees += Add; + }; + + int NumTrees = 0; + for (auto Biome : a_Biomes) + { + NumTrees += BiomeTrees(Biome); } return NumTrees / 1024; } |