[7667] Add to CreatureAI field pointing to creature itself. Use it instead diff. fields in subclases.

Also send pointer to AI constructors ans mark constructors as explicit.

This changes allow move now some generic often used AI code to CreatureAI helper functions.
This commit is contained in:
VladimirMangos 2009-04-14 06:43:31 +04:00
parent 721e005b84
commit 69fb9736cc
18 changed files with 379 additions and 382 deletions

View file

@ -80,7 +80,7 @@ struct Script
struct MANGOS_DLL_DECL ScriptedAI : public CreatureAI
{
ScriptedAI(Creature* creature) : m_creature(creature) {}
explicit ScriptedAI(Creature* creature) : CreatureAI(creature) {}
~ScriptedAI() {}
// Called if IsVisible(Unit *who) is true at each *who move
@ -122,8 +122,6 @@ struct MANGOS_DLL_DECL ScriptedAI : public CreatureAI
// Called when spell hits creature's target
void SpellHitTarget(Unit*, const SpellEntry*) {}
Creature* m_creature;
//= Some useful helpers =========================
// Start attack of victim and go to him