aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/AI/SmartScripts
diff options
context:
space:
mode:
authorkaelima <kaelima@live.se>2012-11-05 12:02:08 +0100
committerkaelima <kaelima@live.se>2012-11-05 12:02:08 +0100
commit3c13454ad71b259c50d394a8a467a2570f683827 (patch)
tree13b8744efdb5fc8930630f5e5c513f2727c7bb18 /src/server/game/AI/SmartScripts
parent19d7f68592d653067c3b84c3d409e59b2724a85d (diff)
parentc5fdb02305c78d8193f8c3161449e3955d4f7e8a (diff)
Merge git://github.com/TrinityCore/TrinityCore into mmaps
Conflicts: src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp src/server/game/Movement/Spline/MoveSplineInit.cpp
Diffstat (limited to 'src/server/game/AI/SmartScripts')
-rw-r--r--src/server/game/AI/SmartScripts/SmartScript.cpp24
1 files changed, 11 insertions, 13 deletions
diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp
index 6097edf6641..a1fb2147cc2 100644
--- a/src/server/game/AI/SmartScripts/SmartScript.cpp
+++ b/src/server/game/AI/SmartScripts/SmartScript.cpp
@@ -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;
@@ -432,8 +430,8 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
if (!me)
break;
- std::list<HostileReference*> const& threatList = me->getThreatManager().getThreatList();
- for (std::list<HostileReference*>::const_iterator i = threatList.begin(); i != threatList.end(); ++i)
+ ThreatContainer::StorageType threatList = me->getThreatManager().getThreatList();
+ for (ThreatContainer::StorageType::const_iterator i = threatList.begin(); i != threatList.end(); ++i)
{
if (Unit* target = Unit::GetUnit(*me, (*i)->getUnitGuid()))
{
@@ -2348,8 +2346,8 @@ ObjectList* SmartScript::GetTargets(SmartScriptHolder const& e, Unit* invoker /*
{
if (me)
{
- std::list<HostileReference*> const& threatList = me->getThreatManager().getThreatList();
- for (std::list<HostileReference*>::const_iterator i = threatList.begin(); i != threatList.end(); ++i)
+ ThreatContainer::StorageType threatList = me->getThreatManager().getThreatList();
+ for (ThreatContainer::StorageType::const_iterator i = threatList.begin(); i != threatList.end(); ++i)
if (Unit* temp = Unit::GetUnit(*me, (*i)->getUnitGuid()))
l->push_back(temp);
}