Core/DataStores: Simplified string memory allocation in db2 files, dropped unneccessary level of indirection

This commit is contained in:
Shauren
2020-06-27 13:33:17 +02:00
parent eccc015ce7
commit deca201f77
38 changed files with 333 additions and 380 deletions

View File

@@ -496,10 +496,10 @@ bool SpellChatLink::ValidateName(char* buffer, char const* context)
return false;
}
for (uint8 i = 0; i < TOTAL_LOCALES; ++i)
for (LocaleConstant i = LOCALE_enUS; i < TOTAL_LOCALES; i = LocaleConstant(i + 1))
{
uint32 skillLineNameLength = strlen(skillLine->DisplayName->Str[i]);
if (skillLineNameLength > 0 && strncmp(skillLine->DisplayName->Str[i], buffer, skillLineNameLength) == 0)
uint32 skillLineNameLength = strlen(skillLine->DisplayName[i]);
if (skillLineNameLength > 0 && strncmp(skillLine->DisplayName[i], buffer, skillLineNameLength) == 0)
{
// found the prefix, remove it to perform spellname validation below
// -2 = strlen(": ")
@@ -567,12 +567,12 @@ bool AchievementChatLink::ValidateName(char* buffer, char const* context)
{
ChatLink::ValidateName(buffer, context);
for (uint8 locale = LOCALE_enUS; locale < TOTAL_LOCALES; ++locale)
for (LocaleConstant locale = LOCALE_enUS; locale < TOTAL_LOCALES; locale = LocaleConstant(locale + 1))
{
if (locale == LOCALE_none)
continue;
if (strcmp(_achievement->Title->Str[locale], buffer) == 0)
if (strcmp(_achievement->Title[locale], buffer) == 0)
return true;
}