mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-18 16:38:42 +01:00
Core/SAI: CAST_AI will return NULL if the cast was not successful, no need to check for AIName, thanks Shauren
This commit is contained in:
@@ -1803,22 +1803,17 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
|
||||
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
|
||||
{
|
||||
bool smart = false;
|
||||
SmartAI* ai = NULL;
|
||||
if (IsGameObject(*itr))
|
||||
{
|
||||
smart = IsSmartGO((*itr)->ToGameObject());
|
||||
ai = CAST_AI(SmartAI, (*itr)->ToGameObject()->AI());
|
||||
}
|
||||
|
||||
if (IsCreature(*itr))
|
||||
{
|
||||
smart = IsSmart((*itr)->ToCreature());
|
||||
ai = CAST_AI(SmartAI, (*itr)->ToCreature()->AI());
|
||||
}
|
||||
|
||||
if (smart && 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");
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user