From 3c527f14571950a79ea6040d1e566955ba14de71 Mon Sep 17 00:00:00 2001 From: NoFantasy Date: Thu, 21 Jan 2010 18:58:24 +0100 Subject: [PATCH] [9229] Add AI function SummonedMovementInform Informing summoner of summoned when it reach a movement point (MovePoint) --- src/game/CreatureAI.h | 3 +++ src/game/PointMovementGenerator.cpp | 16 +++++++++++++++- src/shared/revision_nr.h | 2 +- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/game/CreatureAI.h b/src/game/CreatureAI.h index 6447f2c45..270018cf6 100644 --- a/src/game/CreatureAI.h +++ b/src/game/CreatureAI.h @@ -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*/) {} diff --git a/src/game/PointMovementGenerator.cpp b/src/game/PointMovementGenerator.cpp index f54e99cb7..bce20f755 100644 --- a/src/game/PointMovementGenerator.cpp +++ b/src/game/PointMovementGenerator.cpp @@ -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::MovementInform(Player&) template <> void PointMovementGenerator::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(&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::Initialize(Player&); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 104d78f00..ba20033c5 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9228" + #define REVISION_NR "9229" #endif // __REVISION_NR_H__ -- 2.11.4.GIT