mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-16 04:59:41 -04:00
Core/Misc: reduced amount of string memory allocations (Step I)
This commit is contained in:
@@ -46,13 +46,13 @@ class TrinityStringTextBuilder
|
||||
size_t operator()(WorldPacket* data, LocaleConstant locale) const
|
||||
{
|
||||
std::string text = sObjectMgr->GetTrinityString(_textId, locale);
|
||||
char const* localizedName = _source->GetNameForLocaleIdx(locale);
|
||||
std::string localizedName = _source->GetNameForLocaleIdx(locale);
|
||||
|
||||
*data << uint8(_msgType);
|
||||
*data << uint32(_language);
|
||||
*data << uint64(_source->GetGUID());
|
||||
*data << uint32(1); // 2.1.0
|
||||
*data << uint32(strlen(localizedName)+1);
|
||||
*data << uint32(localizedName.size() + 1);
|
||||
*data << localizedName;
|
||||
size_t whisperGUIDpos = data->wpos();
|
||||
*data << uint64(_targetGUID); // Unit Target
|
||||
@@ -154,7 +154,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
mLastInvoker = unit->GetGUID();
|
||||
|
||||
if (Unit* tempInvoker = GetLastInvoker())
|
||||
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction: Invoker: %s (guidlow: %u)", tempInvoker->GetName(), tempInvoker->GetGUIDLow());
|
||||
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction: Invoker: %s (guidlow: %u)", tempInvoker->GetName().c_str(), tempInvoker->GetGUIDLow());
|
||||
|
||||
switch (e.GetActionType())
|
||||
{
|
||||
@@ -198,7 +198,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
mUseTextTimer = true;
|
||||
sCreatureTextMgr->SendChat(talker, uint8(e.action.talk.textGroupID), mTextGUID);
|
||||
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction: SMART_ACTION_TALK: talker: %s (GuidLow: %u), textGuid: %u",
|
||||
talker->GetName(), talker->GetGUIDLow(), GUID_LOPART(mTextGUID));
|
||||
talker->GetName().c_str(), talker->GetGUIDLow(), GUID_LOPART(mTextGUID));
|
||||
break;
|
||||
}
|
||||
case SMART_ACTION_SIMPLE_TALK:
|
||||
@@ -216,7 +216,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
sCreatureTextMgr->SendChat(me, uint8(e.action.talk.textGroupID), IsPlayer(templastInvoker) ? templastInvoker->GetGUID() : 0, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_NORMAL, 0, TEAM_OTHER, false, (*itr)->ToPlayer());
|
||||
}
|
||||
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_SIMPLE_TALK: talker: %s (GuidLow: %u), textGroupId: %u",
|
||||
(*itr)->GetName(), (*itr)->GetGUIDLow(), uint8(e.action.talk.textGroupID));
|
||||
(*itr)->GetName().c_str(), (*itr)->GetGUIDLow(), uint8(e.action.talk.textGroupID));
|
||||
}
|
||||
|
||||
delete targets;
|
||||
@@ -234,7 +234,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
{
|
||||
(*itr)->ToUnit()->HandleEmoteCommand(e.action.emote.emote);
|
||||
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_PLAY_EMOTE: target: %s (GuidLow: %u), emote: %u",
|
||||
(*itr)->GetName(), (*itr)->GetGUIDLow(), e.action.emote.emote);
|
||||
(*itr)->GetName().c_str(), (*itr)->GetGUIDLow(), e.action.emote.emote);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -253,7 +253,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
{
|
||||
(*itr)->SendPlaySound(e.action.sound.sound, e.action.sound.range > 0 ? true : false);
|
||||
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_SOUND: target: %s (GuidLow: %u), sound: %u, onlyself: %u",
|
||||
(*itr)->GetName(), (*itr)->GetGUIDLow(), e.action.sound.sound, e.action.sound.range);
|
||||
(*itr)->GetName().c_str(), (*itr)->GetGUIDLow(), e.action.sound.sound, e.action.sound.range);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -366,14 +366,12 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
|
||||
{
|
||||
if (IsPlayer(*itr))
|
||||
{
|
||||
if (Quest const* q = sObjectMgr->GetQuestTemplate(e.action.quest.quest))
|
||||
{
|
||||
(*itr)->ToPlayer()->AddQuest(q, NULL);
|
||||
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_ADD_QUEST: Player guidLow %u add quest %u",
|
||||
(*itr)->GetGUIDLow(), e.action.quest.quest);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
delete targets;
|
||||
|
||||
Reference in New Issue
Block a user