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:
Subv2112
2012-01-22 10:42:13 -05:00
parent f4778a6b72
commit 8e8be7e358

View File

@@ -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;
}