summaryrefslogtreecommitdiffstats
path: root/source/BlockID.cpp
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-05-27 12:51:04 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-05-27 12:51:04 +0200
commitba2f0c6229870fd7c1d0b0f530dd1567d43e4e03 (patch)
treefc807d61b7656133a59a1113cbbda65d4bfed53f /source/BlockID.cpp
parentImproved logging on mis-configuration in cPlayer and cWorldStorage (diff)
downloadcuberite-ba2f0c6229870fd7c1d0b0f530dd1567d43e4e03.tar
cuberite-ba2f0c6229870fd7c1d0b0f530dd1567d43e4e03.tar.gz
cuberite-ba2f0c6229870fd7c1d0b0f530dd1567d43e4e03.tar.bz2
cuberite-ba2f0c6229870fd7c1d0b0f530dd1567d43e4e03.tar.lz
cuberite-ba2f0c6229870fd7c1d0b0f530dd1567d43e4e03.tar.xz
cuberite-ba2f0c6229870fd7c1d0b0f530dd1567d43e4e03.tar.zst
cuberite-ba2f0c6229870fd7c1d0b0f530dd1567d43e4e03.zip
Diffstat (limited to '')
-rw-r--r--source/BlockID.cpp56
1 files changed, 56 insertions, 0 deletions
diff --git a/source/BlockID.cpp b/source/BlockID.cpp
index 2e2484f21..32f9bb96e 100644
--- a/source/BlockID.cpp
+++ b/source/BlockID.cpp
@@ -63,6 +63,62 @@ int BlockStringToType(const AString & a_BlockTypeString)
+EMCSBiome StringToBiome(const AString & a_BiomeString)
+{
+ // If it is a number, return it:
+ int res = atoi(a_BiomeString.c_str());
+ if ((res != 0) || (a_BiomeString.compare("0") == 0))
+ {
+ // It was a valid number
+ return (EMCSBiome)res;
+ }
+
+ // Convert using the built-in map:
+ static struct {
+ EMCSBiome m_Biome;
+ const char * m_String;
+ } BiomeMap[] =
+ {
+ {biOcean, "Ocean"} ,
+ {biPlains, "Plains"},
+ {biDesert, "Desert"},
+ {biExtremeHills, "ExtremeHills"},
+ {biForest, "Forest"},
+ {biTaiga, "Taiga"},
+ {biSwampland, "Swampland"},
+ {biRiver, "River"},
+ {biHell, "Hell"},
+ {biHell, "Nether"},
+ {biSky, "Sky"},
+ {biFrozenOcean, "FrozenOcean"},
+ {biFrozenRiver, "FrozenRiver"},
+ {biIcePlains, "IcePlains"},
+ {biIceMountains, "IceMountains"},
+ {biMushroomIsland, "MushroomIsland"},
+ {biMushroomShore, "MushroomShore"},
+ {biBeach, "Beach"},
+ {biDesertHills, "DesertHills"},
+ {biForestHills, "ForestHills"},
+ {biTaigaHills, "TaigaHills"},
+ {biExtremeHillsEdge, "ExtremeHillsEdge "},
+ {biJungle, "Jungle"},
+ {biJungleHills, "JungleHills"},
+ } ;
+
+ for (int i = 0; i < ARRAYCOUNT(BiomeMap); i++)
+ {
+ if (NoCaseCompare(BiomeMap[i].m_String, a_BiomeString) == 0)
+ {
+ return BiomeMap[i].m_Biome;
+ }
+ } // for i - BiomeMap[]
+ return (EMCSBiome)-1;
+}
+
+
+
+
+
// This is actually just some code that needs to run at program startup, so it is wrapped into a global var's constructor:
class cBlockPropertiesInitializer
{