Skip to content
This repository
Browse code

Core/Scripts: Corrected previous commit and added a few AI hooks to G…

…ameObjectAI
  • Loading branch information...
commit 4f14693ef29402c6cfdab38879f9722235e4e1a9 1 parent b7a9db1
Shauren Shauren authored
23 src/server/game/AI/CoreAI/GameObjectAI.h
@@ -33,21 +33,24 @@ class GameObjectAI
33 33 explicit GameObjectAI(GameObject* g) : go(g) {}
34 34 virtual ~GameObjectAI() {}
35 35
36   - virtual void UpdateAI(const uint32 /*diff*/) {}
  36 + virtual void UpdateAI(uint32 /*diff*/) {}
37 37
38 38 virtual void InitializeAI() { Reset(); }
39 39
40 40 virtual void Reset() {};
41 41
42   - static int Permissible(const GameObject* go);
  42 + static int Permissible(GameObject const* go);
43 43
44   - virtual bool GossipHello(Player* /*player*/) {return false;}
45   - virtual bool GossipSelect(Player* /*player*/, uint32 /*sender*/, uint32 /*action*/) {return false;}
46   - virtual bool GossipSelectCode(Player* /*player*/, uint32 /*sender*/, uint32 /*action*/, const char* /*code*/) {return false;}
47   - virtual bool QuestAccept(Player* /*player*/, Quest const* /*quest*/) {return false;}
48   - virtual bool QuestReward(Player* /*player*/, Quest const* /*quest*/, uint32 /*opt*/) {return false;}
49   - virtual uint32 GetDialogStatus(Player* /*player*/) {return 100;}
  44 + virtual bool GossipHello(Player* /*player*/) { return false; }
  45 + virtual bool GossipSelect(Player* /*player*/, uint32 /*sender*/, uint32 /*action*/) { return false; }
  46 + virtual bool GossipSelectCode(Player* /*player*/, uint32 /*sender*/, uint32 /*action*/, char const* /*code*/) { return false; }
  47 + virtual bool QuestAccept(Player* /*player*/, Quest const* /*quest*/) { return false; }
  48 + virtual bool QuestReward(Player* /*player*/, Quest const* /*quest*/, uint32 /*opt*/) { return false; }
  49 + virtual uint32 GetDialogStatus(Player* /*player*/) { return 100; }
50 50 virtual void Destroyed(Player* /*player*/, uint32 /*eventId*/) {}
  51 + virtual uint32 GetData(uint32 /*id*/) { return 0; }
  52 + virtual void SetData64(uint32 /*id*/, uint64 /*value*/) {}
  53 + virtual uint64 GetData64(uint32 /*id*/) { return 0; }
51 54 virtual void SetData(uint32 /*id*/, uint32 /*value*/) {}
52 55 virtual void OnGameEvent(bool /*start*/, uint16 /*eventId*/) {}
53 56 virtual void OnStateChanged(uint32 /*state*/, Unit* /*unit*/) { }
@@ -58,8 +61,8 @@ class NullGameObjectAI : public GameObjectAI
58 61 public:
59 62 explicit NullGameObjectAI(GameObject* g);
60 63
61   - void UpdateAI(const uint32 /*diff*/) {}
  64 + void UpdateAI(uint32 /*diff*/) {}
62 65
63   - static int Permissible(const GameObject* /*go*/) { return PERMIT_BASE_IDLE; }
  66 + static int Permissible(GameObject const* /*go*/) { return PERMIT_BASE_IDLE; }
64 67 };
65 68 #endif
2  src/server/game/AI/SmartScripts/SmartAI.cpp
@@ -854,7 +854,7 @@ int SmartGameObjectAI::Permissible(const GameObject* g)
854 854 return PERMIT_BASE_NO;
855 855 }
856 856
857   -void SmartGameObjectAI::UpdateAI(const uint32 diff)
  857 +void SmartGameObjectAI::UpdateAI(uint32 diff)
858 858 {
859 859 GetScript()->OnUpdate(diff);
860 860 }
2  src/server/game/AI/SmartScripts/SmartAI.h
@@ -239,7 +239,7 @@ class SmartGameObjectAI : public GameObjectAI
239 239 SmartGameObjectAI(GameObject* g) : GameObjectAI(g), go(g) {}
240 240 ~SmartGameObjectAI() {}
241 241
242   - void UpdateAI(const uint32 diff);
  242 + void UpdateAI(uint32 diff);
243 243 void InitializeAI();
244 244 void Reset();
245 245 SmartScript* GetScript() { return &mScript; }
2  src/server/game/Scripting/ScriptMgr.cpp
@@ -959,7 +959,7 @@ GameObjectAI* ScriptMgr::GetGameObjectAI(GameObject* go)
959 959 ASSERT(go);
960 960
961 961 GET_SCRIPT_RET(GameObjectScript, go->GetScriptId(), tmpscript, NULL);
962   - tmpscript->GetAI(go);
  962 + return tmpscript->GetAI(go);
963 963 }
964 964
965 965 bool ScriptMgr::OnAreaTrigger(Player* player, AreaTriggerEntry const* trigger)

0 comments on commit 4f14693

Please sign in to comment.
Something went wrong with that request. Please try again.