MCPcopy Create free account
hub / github.com/cuberite/cuberite / StringToBiome

Function StringToBiome

src/BiomeDef.cpp:10–112  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8
9
10EMCSBiome 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"},

Callers 2

InitializeBiomeGenMethod · 0.85
InitializeBiomesMethod · 0.85

Calls 3

NoCaseCompareFunction · 0.85
c_strMethod · 0.80
compareMethod · 0.80

Tested by

no test coverage detected