diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2013-06-22 20:41:08 +0200 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2013-06-22 20:41:08 +0200 |
commit | 9dd0486faf6f52eb40e47f003d4c02eefc28c8f9 (patch) | |
tree | 3ca4ff0762816fe69ff0f7baf22232c9d30cf8f6 /source/BlockID.cpp | |
parent | Made redstone lamps turn on when powered and turn off when not powered. (diff) | |
download | cuberite-9dd0486faf6f52eb40e47f003d4c02eefc28c8f9.tar cuberite-9dd0486faf6f52eb40e47f003d4c02eefc28c8f9.tar.gz cuberite-9dd0486faf6f52eb40e47f003d4c02eefc28c8f9.tar.bz2 cuberite-9dd0486faf6f52eb40e47f003d4c02eefc28c8f9.tar.lz cuberite-9dd0486faf6f52eb40e47f003d4c02eefc28c8f9.tar.xz cuberite-9dd0486faf6f52eb40e47f003d4c02eefc28c8f9.tar.zst cuberite-9dd0486faf6f52eb40e47f003d4c02eefc28c8f9.zip |
Diffstat (limited to 'source/BlockID.cpp')
-rw-r--r-- | source/BlockID.cpp | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/source/BlockID.cpp b/source/BlockID.cpp index f9a76daa2..a3bb75cf4 100644 --- a/source/BlockID.cpp +++ b/source/BlockID.cpp @@ -290,6 +290,7 @@ EMCSBiome StringToBiome(const AString & a_BiomeString) {biHell, "Hell"}, {biHell, "Nether"}, {biSky, "Sky"}, + {biSky, "End"}, {biFrozenOcean, "FrozenOcean"}, {biFrozenRiver, "FrozenRiver"}, {biIcePlains, "IcePlains"}, @@ -320,6 +321,46 @@ EMCSBiome StringToBiome(const AString & a_BiomeString) +eDimension StringToDimension(const AString & a_DimensionString) +{ + int res = atoi(a_DimensionString.c_str()); + if ((res != 0) || (a_DimensionString == "0")) + { + // It was a valid number + return (eDimension)res; + } + + // Convert using a built-in map: + static struct + { + eDimension m_Dimension; + const char * m_String; + } DimensionMap [] = + { + { dimOverworld, "Overworld"}, + { dimOverworld, "Normal"}, + { dimOverworld, "World"}, + { dimNether, "Nether"}, + { dimNether, "Hell"}, // Alternate name for End + { dimEnd, "End"}, + { dimEnd, "Sky"}, // Old name for End + } ; + for (int i = 0; i < ARRAYCOUNT(DimensionMap); i++) + { + if (NoCaseCompare(DimensionMap[i].m_String, a_DimensionString) == 0) + { + return DimensionMap[i].m_Dimension; + } + } // for i - DimensionMap[] + + // Not found + return (eDimension)-1000; +} + + + + + // 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 { |