From 80807eec2cc1c497c4766a0c7cddb9c3ddc29e45 Mon Sep 17 00:00:00 2001 From: Tycho Date: Mon, 3 Feb 2014 12:26:17 -0800 Subject: Increased Type safety of Biomes Changed a number of funcictions from using integers to store biomes to using EMCSBiome Note that switching from an int to an Enum is a non-breaking chang to the lua bindings --- src/BiomeDef.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/BiomeDef.h') diff --git a/src/BiomeDef.h b/src/BiomeDef.h index df1e387f0..f015dd836 100644 --- a/src/BiomeDef.h +++ b/src/BiomeDef.h @@ -20,6 +20,9 @@ BiomeIDs over 255 are used by MCServer internally and are translated to MC biome */ enum EMCSBiome { + biInvalidBiome = -1, + + biFirstBiome = 0, biOcean = 0, biPlains = 1, biDesert = 2, @@ -74,6 +77,7 @@ enum EMCSBiome biVariant = 128, // Release 1.7 biome variants: + biFirstVarientBiome = 129, biSunflowerPlains = 129, biDesertM = 130, biExtremeHillsM = 131, @@ -95,9 +99,12 @@ enum EMCSBiome biMesaBryce = 165, biMesaPlateauFM = 166, biMesaPlateauM = 167, + // Automatically capture the maximum consecutive biome value into biVarientMaxBiome: + biNumVarientBiomes, // True number of biomes, since they are zero-based + biMaxVarientBiome = biNumVarientBiomes - 1, // The maximum biome value } ; -/// Translates a biome string to biome enum. Takes either a number or a biome alias (built-in). Returns -1 on failure. +/// Translates a biome string to biome enum. Takes either a number or a biome alias (built-in). Returns biInvalidBiome on failure. extern EMCSBiome StringToBiome(const AString & a_BiomeString); /// Returns true if the biome has no downfall - deserts and savannas -- cgit v1.2.3 From d9fb83300cf831ea31a74d509f9be9f2ed4f1189 Mon Sep 17 00:00:00 2001 From: Tycho Date: Mon, 3 Feb 2014 13:01:12 -0800 Subject: Fixed Compile errors c++11 introduces scoped enums, so the code didn't fail in clang --- src/BiomeDef.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/BiomeDef.h') diff --git a/src/BiomeDef.h b/src/BiomeDef.h index f015dd836..474d4df76 100644 --- a/src/BiomeDef.h +++ b/src/BiomeDef.h @@ -77,7 +77,7 @@ enum EMCSBiome biVariant = 128, // Release 1.7 biome variants: - biFirstVarientBiome = 129, + biFirstVariantBiome = 129, biSunflowerPlains = 129, biDesertM = 130, biExtremeHillsM = 131, @@ -100,8 +100,8 @@ enum EMCSBiome biMesaPlateauFM = 166, biMesaPlateauM = 167, // Automatically capture the maximum consecutive biome value into biVarientMaxBiome: - biNumVarientBiomes, // True number of biomes, since they are zero-based - biMaxVarientBiome = biNumVarientBiomes - 1, // The maximum biome value + biNumVariantBiomes, // True number of biomes, since they are zero-based + biMaxVariantBiome = biNumVariantBiomes - 1, // The maximum biome value } ; /// Translates a biome string to biome enum. Takes either a number or a biome alias (built-in). Returns biInvalidBiome on failure. -- cgit v1.2.3