aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Chat/ChatLink.cpp
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2013-03-15 20:09:48 +0100
committerShauren <shauren.trinity@gmail.com>2013-03-15 20:09:48 +0100
commite58e05d9d5da894447b81ded17c3b8fd9f4820a8 (patch)
treee41b9ed702da6dc1063e8bddd0f270c2d47f0d7b /src/server/game/Chat/ChatLink.cpp
parent51b9e6d2c947d2151af09d7a25af45ff75b0d530 (diff)
parent11846f5990f5af421ff2fc087925245f61b4ac84 (diff)
Merge branch '4.3.4' of github.com:TrinityCore/TrinityCore into 4.3.4
Diffstat (limited to 'src/server/game/Chat/ChatLink.cpp')
-rw-r--r--src/server/game/Chat/ChatLink.cpp29
1 files changed, 12 insertions, 17 deletions
diff --git a/src/server/game/Chat/ChatLink.cpp b/src/server/game/Chat/ChatLink.cpp
index 4ec8488466c..7f517d99b2c 100644
--- a/src/server/game/Chat/ChatLink.cpp
+++ b/src/server/game/Chat/ChatLink.cpp
@@ -167,7 +167,7 @@ bool ItemChatLink::Initialize(std::istringstream& iss)
return true;
}
-inline std::string ItemChatLink::FormatName(uint8 index, ItemLocale const* locale, char* const* suffixStrings) const
+inline std::string ItemChatLink::FormatName(uint8 index, ItemLocale const* locale, char* suffixStrings) const
{
std::stringstream ss;
if (locale == NULL || index >= locale->Name.size())
@@ -183,7 +183,7 @@ bool ItemChatLink::ValidateName(char* buffer, const char* context)
{
ChatLink::ValidateName(buffer, context);
- char* const* suffixStrings = _suffix ? _suffix->nameSuffix : (_property ? _property->nameSuffix : NULL);
+ char* suffixStrings = _suffix ? _suffix->nameSuffix : (_property ? _property->nameSuffix : NULL);
bool res = (FormatName(LOCALE_enUS, NULL, suffixStrings) == buffer);
if (!res)
@@ -306,22 +306,18 @@ bool SpellChatLink::ValidateName(char* buffer, const char* context)
return false;
}
- for (uint8 i = 0; i < TOTAL_LOCALES; ++i)
+ uint32 skillLineNameLength = strlen(skillLine->name);
+ if (skillLineNameLength > 0 && strncmp(skillLine->name, buffer, skillLineNameLength) == 0)
{
- uint32 skillLineNameLength = strlen(skillLine->name[i]);
- if (skillLineNameLength > 0 && strncmp(skillLine->name[i], buffer, skillLineNameLength) == 0)
- {
- // found the prefix, remove it to perform spellname validation below
- // -2 = strlen(": ")
- uint32 spellNameLength = strlen(buffer) - skillLineNameLength - 2;
- memcpy(buffer, buffer + skillLineNameLength + 2, spellNameLength + 1);
- }
+ // found the prefix, remove it to perform spellname validation below
+ // -2 = strlen(": ")
+ uint32 spellNameLength = strlen(buffer) - skillLineNameLength - 2;
+ memcpy(buffer, buffer + skillLineNameLength + 2, spellNameLength + 1);
}
}
- for (uint8 i = 0; i < TOTAL_LOCALES; ++i)
- if (*_spell->SpellName[i] && strcmp(_spell->SpellName[i], buffer) == 0)
- return true;
+ if (*_spell->SpellName && strcmp(_spell->SpellName, buffer) == 0)
+ return true;
sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): linked spell (id: %u) name wasn't found in any localization", context, _spell->Id);
return false;
@@ -376,9 +372,8 @@ bool AchievementChatLink::ValidateName(char* buffer, const char* context)
{
ChatLink::ValidateName(buffer, context);
- for (uint8 i = 0; i < TOTAL_LOCALES; ++i)
- if (*_achievement->name[i] && strcmp(_achievement->name[i], buffer) == 0)
- return true;
+ if (*_achievement->name && strcmp(_achievement->name, buffer) == 0)
+ return true;
sLog->outTrace(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): linked achievement (id: %u) name wasn't found in any localization", context, _achievement->ID);
return false;