diff options
Diffstat (limited to 'src/server/game/Entities/GameObject')
| -rwxr-xr-x | src/server/game/Entities/GameObject/GameObject.cpp | 6 | ||||
| -rwxr-xr-x | src/server/game/Entities/GameObject/GameObject.h | 2 |
2 files changed, 5 insertions, 3 deletions
diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index eb9a25b17cc..33dd0422ce8 100755 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -239,9 +239,12 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map *map, uint32 phaseMa void GameObject::Update(uint32 diff) { - if(!m_AI) + if(!AI()) + { if (!AIM_Initialize()) sLog.outError("Could not initialize GameObjectAI"); + } else + AI()->UpdateAI(diff); if (IS_MO_TRANSPORT(GetGUID())) { @@ -550,7 +553,6 @@ void GameObject::Update(uint32 diff) break; } } - AI()->UpdateAI(diff); sScriptMgr.OnGameObjectUpdate(this, diff); } diff --git a/src/server/game/Entities/GameObject/GameObject.h b/src/server/game/Entities/GameObject/GameObject.h index 5da1fceae21..4ed40c7d6e9 100755 --- a/src/server/game/Entities/GameObject/GameObject.h +++ b/src/server/game/Entities/GameObject/GameObject.h @@ -752,6 +752,7 @@ class GameObject : public WorldObject, public GridObject<GameObject> std::string GetAIName() const; protected: + bool AIM_Initialize(); uint32 m_spellId; time_t m_respawnTime; // (secs) time of next respawn (or despawn if GO have owner()), uint32 m_respawnDelayTime; // (secs) if 0 then current GO state no dependent from timer @@ -779,6 +780,5 @@ class GameObject : public WorldObject, public GridObject<GameObject> private: void SwitchDoorOrButton(bool activate, bool alternative = false); GameObjectAI* m_AI; - bool AIM_Initialize(); }; #endif |
