| 8 | |
| 9 | |
| 10 | EMCSBiome StringToBiome(const AString & a_BiomeString) |
| 11 | { |
| 12 | // If it is a number, return it: |
| 13 | int res = atoi(a_BiomeString.c_str()); |
| 14 | if ((res != 0) || (a_BiomeString.compare("0") == 0)) |
| 15 | { |
| 16 | if ((res >= biFirstBiome) && (res < biNumBiomes)) |
| 17 | { |
| 18 | return (EMCSBiome)res; |
| 19 | } |
| 20 | else if ((res >= biFirstVariantBiome) && (res < biNumVariantBiomes)) |
| 21 | { |
| 22 | return (EMCSBiome)res; |
| 23 | } |
| 24 | // It was an invalid number |
| 25 | return biInvalidBiome; |
| 26 | } |
| 27 | |
| 28 | // Convert using the built-in map: |
| 29 | static struct { |
| 30 | EMCSBiome m_Biome; |
| 31 | const char * m_String; |
| 32 | } BiomeMap[] = |
| 33 | { |
| 34 | {biOcean, "Ocean"} , |
| 35 | {biPlains, "Plains"}, |
| 36 | {biDesert, "Desert"}, |
| 37 | {biExtremeHills, "ExtremeHills"}, |
| 38 | {biForest, "Forest"}, |
| 39 | {biTaiga, "Taiga"}, |
| 40 | {biSwampland, "Swampland"}, |
| 41 | {biRiver, "River"}, |
| 42 | {biNether, "Hell"}, |
| 43 | {biNether, "Nether"}, |
| 44 | {biEnd, "Sky"}, |
| 45 | {biEnd, "End"}, |
| 46 | {biFrozenOcean, "FrozenOcean"}, |
| 47 | {biFrozenRiver, "FrozenRiver"}, |
| 48 | {biIcePlains, "IcePlains"}, |
| 49 | {biIcePlains, "Tundra"}, |
| 50 | {biIceMountains, "IceMountains"}, |
| 51 | {biMushroomIsland, "MushroomIsland"}, |
| 52 | {biMushroomShore, "MushroomShore"}, |
| 53 | {biBeach, "Beach"}, |
| 54 | {biDesertHills, "DesertHills"}, |
| 55 | {biForestHills, "ForestHills"}, |
| 56 | {biTaigaHills, "TaigaHills"}, |
| 57 | {biExtremeHillsEdge, "ExtremeHillsEdge"}, |
| 58 | {biJungle, "Jungle"}, |
| 59 | {biJungleHills, "JungleHills"}, |
| 60 | |
| 61 | // Release 1.7 biomes: |
| 62 | {biJungleEdge, "JungleEdge"}, |
| 63 | {biDeepOcean, "DeepOcean"}, |
| 64 | {biStoneBeach, "StoneBeach"}, |
| 65 | {biColdBeach, "ColdBeach"}, |
| 66 | {biBirchForest, "BirchForest"}, |
| 67 | {biBirchForestHills, "BirchForestHills"}, |
no test coverage detected