summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@outlook.com>2020-08-19 22:00:17 +0200
committerTiger Wang <ziwei.tiger@outlook.com>2020-08-21 01:50:09 +0200
commit6617d439833060619b0fd99efd51ea5c550c69fd (patch)
treeeee8d2523c01ba1f06239c4ee8e3ae2bbc508a0b /src
parentMore tar incompatibility changes (diff)
downloadcuberite-6617d439833060619b0fd99efd51ea5c550c69fd.tar
cuberite-6617d439833060619b0fd99efd51ea5c550c69fd.tar.gz
cuberite-6617d439833060619b0fd99efd51ea5c550c69fd.tar.bz2
cuberite-6617d439833060619b0fd99efd51ea5c550c69fd.tar.lz
cuberite-6617d439833060619b0fd99efd51ea5c550c69fd.tar.xz
cuberite-6617d439833060619b0fd99efd51ea5c550c69fd.tar.zst
cuberite-6617d439833060619b0fd99efd51ea5c550c69fd.zip
Diffstat (limited to '')
-rw-r--r--src/Generating/FinishGen.cpp34
-rw-r--r--src/WorldStorage/NamespaceSerializer.cpp4
2 files changed, 20 insertions, 18 deletions
diff --git a/src/Generating/FinishGen.cpp b/src/Generating/FinishGen.cpp
index f9315333b..4077fd98e 100644
--- a/src/Generating/FinishGen.cpp
+++ b/src/Generating/FinishGen.cpp
@@ -1751,19 +1751,21 @@ void cFinishGenOreNests::GenerateOre(
// It does so by making a random XYZ walk and adding ore along the way in cuboids of different (random) sizes
// Only "terraformable" blocks get replaced with ore, all other blocks stay (so the nest can actually be smaller than specified).
- // If there is a try to generate Emerald ores in chunk where there's no mountains biome abort
- // There are just four points sampled to avoid searching the whole 16 * 16 Blocks
+ // If there is an attempt to generate Emerald ores in a chunk with no mountains biome abort
+ // There are just four points sampled to avoid searching all 16 * 16 blocks:
if (a_OreType == E_BLOCK_EMERALD_ORE)
{
- auto BiomeSampleOne = a_ChunkDesc.GetBiome( 4, 4);
- auto BiomeSampleTwo = a_ChunkDesc.GetBiome( 4, 12);
- auto BiomeSampleThree = a_ChunkDesc.GetBiome(12, 4);
- auto BiomeSampleFour = a_ChunkDesc.GetBiome(12, 12);
+ const auto BiomeSampleOne = a_ChunkDesc.GetBiome( 4, 4);
+ const auto BiomeSampleTwo = a_ChunkDesc.GetBiome( 4, 12);
+ const auto BiomeSampleThree = a_ChunkDesc.GetBiome(12, 4);
+ const auto BiomeSampleFour = a_ChunkDesc.GetBiome(12, 12);
- if (! (IsBiomeMountain(BiomeSampleOne) ||
- (IsBiomeMountain(BiomeSampleTwo)) ||
- (IsBiomeMountain(BiomeSampleThree)) ||
- (IsBiomeMountain(BiomeSampleFour))))
+ if (
+ !IsBiomeMountain(BiomeSampleOne) &&
+ !IsBiomeMountain(BiomeSampleTwo) &&
+ !IsBiomeMountain(BiomeSampleThree) &&
+ !IsBiomeMountain(BiomeSampleFour)
+ )
{
return;
}
@@ -1773,20 +1775,20 @@ void cFinishGenOreNests::GenerateOre(
// https://minecraft.gamepedia.com/Gold_Ore
if (a_OreType == E_BLOCK_GOLD_ORE)
{
- auto BiomeSampleOne = a_ChunkDesc.GetBiome( 4, 4);
- auto BiomeSampleTwo = a_ChunkDesc.GetBiome( 4, 12);
- auto BiomeSampleThree = a_ChunkDesc.GetBiome(12, 4);
- auto BiomeSampleFour = a_ChunkDesc.GetBiome(12, 12);
+ const auto BiomeSampleOne = a_ChunkDesc.GetBiome( 4, 4);
+ const auto BiomeSampleTwo = a_ChunkDesc.GetBiome( 4, 12);
+ const auto BiomeSampleThree = a_ChunkDesc.GetBiome(12, 4);
+ const auto BiomeSampleFour = a_ChunkDesc.GetBiome(12, 12);
if (
IsBiomeMesa(BiomeSampleOne) ||
IsBiomeMesa(BiomeSampleTwo) ||
IsBiomeMesa(BiomeSampleThree) ||
IsBiomeMesa(BiomeSampleFour)
- )
+ )
{
a_MaxHeight = 76;
- a_NumNests = 22; // 2 time default + 20 times mesa bonus
+ a_NumNests = 22; // 2 times default + 20 times mesa bonus
}
}
diff --git a/src/WorldStorage/NamespaceSerializer.cpp b/src/WorldStorage/NamespaceSerializer.cpp
index ee2f07dfd..e717e7b3e 100644
--- a/src/WorldStorage/NamespaceSerializer.cpp
+++ b/src/WorldStorage/NamespaceSerializer.cpp
@@ -258,14 +258,14 @@ namespace NamespaceSerializer
const auto NamespaceIndex = ID.find(':');
if (NamespaceIndex == std::string_view::npos)
{
- // No explicit namespace default to the Minecraft namespace:
+ // No explicit namespace defaults to the Minecraft namespace:
return { Namespace::Minecraft, ID };
}
const auto Namespace = ID.substr(0, NamespaceIndex);
if (Namespace == "minecraft")
{
- // An unprefixed ID in the vanilla Minecraft namespace
+ // An unprefixed ID in the vanilla Minecraft namespace.
const auto Value = ID.substr(NamespaceIndex + 1);
return { Namespace::Minecraft, Value };