Magic numbers cleanup:

- Replace many magic numbers with constants
- Use enum for vehicle flags/seat flags
- Correct structure for ItemRandomSuffixEntry

--HG--
branch : trunk
This commit is contained in:
Shocker
2010-09-28 08:21:51 +03:00
parent 192e972a59
commit 78803c9f09
44 changed files with 245 additions and 194 deletions
+6 -6
View File
@@ -1740,9 +1740,9 @@ void World::DetectDBCLang()
{
uint8 m_lang_confid = sConfig.GetIntDefault("DBC.Locale", 255);
if (m_lang_confid != 255 && m_lang_confid >= MAX_LOCALE)
if (m_lang_confid != 255 && m_lang_confid >= TOTAL_LOCALES)
{
sLog.outError("Incorrect DBC.Locale! Must be >= 0 and < %d (set to 0)",MAX_LOCALE);
sLog.outError("Incorrect DBC.Locale! Must be >= 0 and < %d (set to 0)", TOTAL_LOCALES);
m_lang_confid = LOCALE_enUS;
}
@@ -1750,8 +1750,8 @@ void World::DetectDBCLang()
std::string availableLocalsStr;
uint8 default_locale = MAX_LOCALE;
for (uint8 i = default_locale-1; i < MAX_LOCALE; --i) // -1 will be 255 due to uint8
uint8 default_locale = TOTAL_LOCALES;
for (uint8 i = default_locale-1; i < TOTAL_LOCALES; --i) // -1 will be 255 due to uint8
{
if (strlen(race->name[i]) > 0) // check by race names
{
@@ -1762,13 +1762,13 @@ void World::DetectDBCLang()
}
}
if (default_locale != m_lang_confid && m_lang_confid < MAX_LOCALE &&
if (default_locale != m_lang_confid && m_lang_confid < TOTAL_LOCALES &&
(m_availableDbcLocaleMask & (1 << m_lang_confid)))
{
default_locale = m_lang_confid;
}
if (default_locale >= MAX_LOCALE)
if (default_locale >= TOTAL_LOCALES)
{
sLog.outError("Unable to determine your DBC Locale! (corrupt DBC?)");
exit(1);