[9229] Add AI function SummonedMovementInform

Informing summoner of summoned when it reach a movement point (MovePoint)
This commit is contained in:
NoFantasy 2010-01-21 18:58:24 +01:00
parent 4178d5bb6a
commit 0ed769c828
3 changed files with 19 additions and 2 deletions

View file

@ -118,6 +118,9 @@ class MANGOS_DLL_SPEC CreatureAI
// Called at waypoint reached or point movement finished
virtual void MovementInform(uint32 /*MovementType*/, uint32 /*Data*/) {}
// Called if a temporary summoned of m_creature reach a move point
virtual void SummonedMovementInform(Creature* /*summoned*/, uint32 /*motion_type*/, uint32 /*point_id*/) {}
// Called at text emote receive from player
virtual void ReceiveEmote(Player* /*pPlayer*/, uint32 /*text_emote*/) {}

View file

@ -20,6 +20,7 @@
#include "Errors.h"
#include "Creature.h"
#include "CreatureAI.h"
#include "TemporarySummon.h"
#include "DestinationHolderImp.h"
#include "World.h"
@ -90,7 +91,20 @@ void PointMovementGenerator<Player>::MovementInform(Player&)
template <>
void PointMovementGenerator<Creature>::MovementInform(Creature &unit)
{
unit.AI()->MovementInform(POINT_MOTION_TYPE, id);
if (unit.AI())
unit.AI()->MovementInform(POINT_MOTION_TYPE, id);
if (TemporarySummon* pSummon = dynamic_cast<TemporarySummon*>(&unit))
{
if (Unit* pSummoner = pSummon->GetSummoner())
{
if (pSummoner->GetTypeId() == TYPEID_UNIT)
{
if (((Creature*)pSummoner)->AI())
((Creature*)pSummoner)->AI()->SummonedMovementInform(&unit, POINT_MOTION_TYPE, id);
}
}
}
}
template void PointMovementGenerator<Player>::Initialize(Player&);