aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Entities/GameObject
diff options
context:
space:
mode:
authorRat <none@none>2010-10-25 18:11:52 +0200
committerRat <none@none>2010-10-25 18:11:52 +0200
commit064b3fd2b36dcae8ee59f62c28868d3f2e548a8b (patch)
tree02cb643bc9e4f019936a70d6907c69ed526c4393 /src/server/game/Entities/GameObject
parentb28243819890bace21ddd4cd8da4d0ca430ee69a (diff)
Core/AI: use NullGameObjectAI for gameobjects with ScriptName
- use GameObjectAI with Transports too --HG-- branch : trunk
Diffstat (limited to 'src/server/game/Entities/GameObject')
-rwxr-xr-xsrc/server/game/Entities/GameObject/GameObject.cpp6
-rwxr-xr-xsrc/server/game/Entities/GameObject/GameObject.h2
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