diff options
author | Malcrom <malcromdev@gmail.com> | 2012-01-22 13:04:57 -0330 |
---|---|---|
committer | Malcrom <malcromdev@gmail.com> | 2012-01-22 13:04:57 -0330 |
commit | 95cb29a70827ef7b25d3c32e88dbbed54712ded2 (patch) | |
tree | c807c531b09a6b6462d7021864ade8d81dd1ca06 /src | |
parent | 7142e229f5bf7ebed7c3b41fb40381acca62697f (diff) | |
parent | 6d7a64a5aa2ba459ff5f8bd3e4a30224ac360211 (diff) |
Merge branch 'master' of git://github.com/TrinityCore/TrinityCore
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/AI/SmartScripts/SmartScript.cpp | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index 0266ee45f28..08583406127 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -1783,10 +1783,10 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u case SMART_ACTION_GO_SET_LOOT_STATE: { ObjectList* targets = GetTargets(e, unit); - + if (!targets) return; - + for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) if (IsGameObject(*itr)) (*itr)->ToGameObject()->SetLootState((LootState)e.action.setGoLootState.state); @@ -1797,23 +1797,25 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u case SMART_ACTION_SEND_TARGET_TO_TARGET: { ObjectList* targets = GetTargets(e, unit); - if (!targets) return; - + for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) { - SmartAI* ai = NULL; - if (IsGameObject(*itr)) - ai = CAST_AI(SmartAI, (*itr)->ToGameObject()->AI()); - if (IsCreature(*itr)) - ai = CAST_AI(SmartAI, (*itr)->ToCreature()->AI()); - - if (ai) - ai->GetScript()->StoreTargetList(GetTargetList(e.action.sendTargetToTarget.id), e.action.sendTargetToTarget.id); - else - sLog->outErrorDb("SmartScript: Action target for SMART_ACTION_SEND_TARGET_TO_TARGET is not using SmartAI, skipping"); + { + if (SmartAI* ai = CAST_AI(SmartAI, (*itr)->ToCreature()->AI())) + ai->GetScript()->StoreTargetList(GetTargetList(e.action.sendTargetToTarget.id), e.action.sendTargetToTarget.id); + else + sLog->outErrorDb("SmartScript: Action target for SMART_ACTION_SEND_TARGET_TO_TARGET is not using SmartAI, skipping"); + } + else if (IsGameObject(*itr)) + { + if (SmartGameObjectAI* ai = CAST_AI(SmartGameObjectAI, (*itr)->ToGameObject()->AI())) + ai->GetScript()->StoreTargetList(GetTargetList(e.action.sendTargetToTarget.id), e.action.sendTargetToTarget.id); + else + sLog->outErrorDb("SmartScript: Action target for SMART_ACTION_SEND_TARGET_TO_TARGET is not using SmartGameObjectAI, skipping"); + } } delete targets; |