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
This commit is contained in:
@@ -13,8 +13,16 @@ EMCSBiome StringToBiome(const AString & a_BiomeString)
|
||||
int res = atoi(a_BiomeString.c_str());
|
||||
if ((res != 0) || (a_BiomeString.compare("0") == 0))
|
||||
{
|
||||
// It was a valid number
|
||||
return (EMCSBiome)res;
|
||||
if(res >= biFirstBiome && res < biNumBiomes)
|
||||
{
|
||||
return (EMCSBiome)res;
|
||||
}
|
||||
else if(res >= biFirstVarientBiome && res < biNumVarientBiomes)
|
||||
{
|
||||
return (EMCSBiome)res;
|
||||
}
|
||||
// It was an invalid number
|
||||
return biInvalidBiome;
|
||||
}
|
||||
|
||||
// Convert using the built-in map:
|
||||
@@ -100,7 +108,7 @@ EMCSBiome StringToBiome(const AString & a_BiomeString)
|
||||
return BiomeMap[i].m_Biome;
|
||||
}
|
||||
} // for i - BiomeMap[]
|
||||
return (EMCSBiome)-1;
|
||||
return biInvalidBiome;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user