Instructions Jenkins Doxygen

[ai] move behavitor from actor to agent class. 43/743/1
authorwashu <sal.scotto@gmail.com>
Tue, 3 Sep 2013 18:08:11 +0000 (18:08 +0000)
committerwashu <sal.scotto@gmail.com>
Tue, 3 Sep 2013 18:08:11 +0000 (18:08 +0000)
Change-Id: I4f79430a5562669c03b87dd97d0dc9fb1bb995c8

14 files changed:
MMOCoreORB/src/server/zone/objects/creature/AiAgent.cpp
MMOCoreORB/src/server/zone/objects/creature/AiAgent.h
MMOCoreORB/src/server/zone/objects/creature/AiAgent.idl
MMOCoreORB/src/server/zone/objects/creature/AiAgentImplementation.cpp
MMOCoreORB/src/server/zone/objects/creature/ai/bt/Behavior.h
MMOCoreORB/src/server/zone/objects/creature/ai/bt/BehaviorTree.cpp
MMOCoreORB/src/server/zone/objects/creature/ai/bt/BehaviorTree.h
MMOCoreORB/src/server/zone/objects/creature/ai/bt/LuaBehavior.cpp
MMOCoreORB/src/server/zone/objects/creature/ai/bt/LuaBehavior.h
MMOCoreORB/src/server/zone/objects/creature/ai/bt/SequenceBehavior.cpp
MMOCoreORB/src/server/zone/objects/creature/ai/bt/SequenceBehavior.h
MMOCoreORB/src/server/zone/objects/creature/ai/bt/tests/BehaviorTest.cpp
MMOCoreORB/src/server/zone/objects/creature/ai/bt/tests/MockBehavior.h
MMOCoreORB/src/server/zone/objects/creature/ai/bt/tests/MockSequenceBehavior.h

index 4195e51..2c7a5ad 100644 (file)
 
 #include "server/zone/objects/player/PlayerObject.h"
 
+#include "server/zone/objects/creature/ai/bt/Behavior.h"
+
+#include "server/zone/objects/creature/ai/bt/BehaviorTree.h"
+
 /*
  *     AiAgentStub
  */
 
-enum {RPC_INITIALIZETRANSIENTMEMBERS__ = 6,RPC_FINALIZE__,RPC_ACTIVATERECOVERY__,RPC_ACTIVATEMOVEMENTEVENT__,RPC_ACTIVATEWAITEVENT__,RPC_ACTIVATEAWARENESSEVENT__CREATUREOBJECT_,RPC_TRYRETREAT__,RPC_DORECOVERY__,RPC_DOATTACK__,RPC_DOMOVEMENT__,RPC_SETLEVEL__INT_,RPC_SENDBASELINESTO__SCENEOBJECT_,RPC_CALCULATEATTACKMINDAMAGE__INT_,RPC_CALCULATEATTACKMAXDAMAGE__INT_,RPC_CALCULATEATTACKSPEED__INT_,RPC_ISCAMOUFLAGED__CREATUREOBJECT_,RPC_ISSCENTMASKED__CREATUREOBJECT_,RPC_ISCONCEALED__CREATUREOBJECT_,RPC_HANDLEOBJECTMENUSELECT__CREATUREOBJECT_BYTE_,RPC_CHECKNEWANGLE__,RPC_FILLATTRIBUTELIST__ATTRIBUTELISTMESSAGE_CREATUREOBJECT_,RPC_SETNEXTPOSITION__FLOAT_FLOAT_FLOAT_SCENEOBJECT_,RPC_NOTIFYPOSITIONUPDATE__QUADTREEENTRY_,RPC_CLEARPATROLPOINTS__,RPC_INFLICTDAMAGE__TANGIBLEOBJECT_INT_FLOAT_BOOL_BOOL_,RPC_INFLICTDAMAGE__TANGIBLEOBJECT_INT_FLOAT_BOOL_STRING_BOOL_,RPC_SENDCONVERSATIONSTARTTO__SCENEOBJECT_,RPC_SENDDEFAULTCONVERSATIONTO__SCENEOBJECT_,RPC_SELECTCONVERSATIONOPTION__INT_SCENEOBJECT_,RPC_NOTIFYOBJECTDESTRUCTIONOBSERVERS__TANGIBLEOBJECT_INT_,RPC_NOTIFYCONVERSEOBSERVERS__CREATUREOBJECT_,RPC_NOTIFYATTACK__OBSERVABLE_,RPC_NOTIFYCALLFORHELP__OBSERVABLE_MANAGEDOBJECT_,RPC_DESTROYOBJECTFROMWORLD__BOOL_,RPC_ACTIVATEPOSTURERECOVERY__,RPC_QUEUEDIZZYFALLEVENT__,RPC_CLEARCOMBATSTATE__BOOL_,RPC_SETDEFENDER__SCENEOBJECT_,RPC_ADDDEFENDER__SCENEOBJECT_,RPC_REMOVEDEFENDER__SCENEOBJECT_,RPC_SETDESPAWNONNOPLAYERINRANGE__BOOL_,RPC_NOTIFYDESPAWN__ZONE_,RPC_SCHEDULEDESPAWN__,RPC_SCHEDULEDESPAWN__INT_,RPC_RESPAWN__ZONE_INT_,RPC_SETHOMELOCATION__FLOAT_FLOAT_FLOAT_SCENEOBJECT_,RPC_SETRESPAWNTIMER__FLOAT_,RPC_ISATTACKABLEBY__CREATUREOBJECT_,RPC_ISAGGRESSIVETO__CREATUREOBJECT_,RPC_SETOBLIVIOUS__,RPC_SETWATCHOBJECT__SCENEOBJECT_,RPC_SETSTALKOBJECT__SCENEOBJECT_,RPC_SETFOLLOWOBJECT__SCENEOBJECT_,RPC_SETTARGETOBJECT__SCENEOBJECT_,RPC_GETFOLLOWOBJECT__,RPC_SELECTWEAPON__,RPC_VALIDATESTATEATTACK__CREATUREOBJECT_STRING_,RPC_ISRETREATING__,RPC_ISFLEEING__,RPC_CLEARDESPAWNEVENT__,RPC_GETKINETIC__,RPC_GETENERGY__,RPC_GETELECTRICITY__,RPC_GETSTUN__,RPC_GETBLAST__,RPC_GETHEAT__,RPC_GETCOLD__,RPC_GETACID__,RPC_GETLIGHTSABER__,RPC_ISSTALKER__,RPC_ISKILLER__,RPC_GETFEROCITY__,RPC_GETARMOR__,RPC_GETDESPAWNONNOPLAYERINRANGE__,RPC_GETNUMBEROFPLAYERSINRANGE__,RPC_GETFACTIONSTRING__,RPC_GETSOCIALGROUP__,RPC_GETCHANCEHIT__,RPC_GETDAMAGEMIN__,RPC_GETDAMAGEMAX__,RPC_GETBASEXP__,RPC_GETDIET__,RPC_GETRESPAWNTIMER__,RPC_ISAIAGENT__,RPC_HASLOOT__,RPC_SETSHOWNEXTPOSITION__BOOL_,RPC_ISEVENTMOB__,RPC_GETPVPFACTION__};
+enum {RPC_INITIALIZETRANSIENTMEMBERS__ = 6,RPC_FINALIZE__,RPC_ACTIVATERECOVERY__,RPC_ACTIVATEMOVEMENTEVENT__,RPC_ACTIVATEWAITEVENT__,RPC_ACTIVATEAWARENESSEVENT__CREATUREOBJECT_,RPC_TRYRETREAT__,RPC_DORECOVERY__,RPC_DOATTACK__,RPC_DOMOVEMENT__,RPC_SETLEVEL__INT_,RPC_SENDBASELINESTO__SCENEOBJECT_,RPC_CALCULATEATTACKMINDAMAGE__INT_,RPC_CALCULATEATTACKMAXDAMAGE__INT_,RPC_CALCULATEATTACKSPEED__INT_,RPC_ISCAMOUFLAGED__CREATUREOBJECT_,RPC_ISSCENTMASKED__CREATUREOBJECT_,RPC_ISCONCEALED__CREATUREOBJECT_,RPC_HANDLEOBJECTMENUSELECT__CREATUREOBJECT_BYTE_,RPC_CHECKNEWANGLE__,RPC_FILLATTRIBUTELIST__ATTRIBUTELISTMESSAGE_CREATUREOBJECT_,RPC_SETNEXTPOSITION__FLOAT_FLOAT_FLOAT_SCENEOBJECT_,RPC_NOTIFYPOSITIONUPDATE__QUADTREEENTRY_,RPC_CLEARPATROLPOINTS__,RPC_INFLICTDAMAGE__TANGIBLEOBJECT_INT_FLOAT_BOOL_BOOL_,RPC_INFLICTDAMAGE__TANGIBLEOBJECT_INT_FLOAT_BOOL_STRING_BOOL_,RPC_SENDCONVERSATIONSTARTTO__SCENEOBJECT_,RPC_SENDDEFAULTCONVERSATIONTO__SCENEOBJECT_,RPC_SELECTCONVERSATIONOPTION__INT_SCENEOBJECT_,RPC_NOTIFYOBJECTDESTRUCTIONOBSERVERS__TANGIBLEOBJECT_INT_,RPC_NOTIFYCONVERSEOBSERVERS__CREATUREOBJECT_,RPC_NOTIFYATTACK__OBSERVABLE_,RPC_NOTIFYCALLFORHELP__OBSERVABLE_MANAGEDOBJECT_,RPC_DESTROYOBJECTFROMWORLD__BOOL_,RPC_ACTIVATEPOSTURERECOVERY__,RPC_QUEUEDIZZYFALLEVENT__,RPC_CLEARCOMBATSTATE__BOOL_,RPC_SETDEFENDER__SCENEOBJECT_,RPC_ADDDEFENDER__SCENEOBJECT_,RPC_REMOVEDEFENDER__SCENEOBJECT_,RPC_SETDESPAWNONNOPLAYERINRANGE__BOOL_,RPC_NOTIFYDESPAWN__ZONE_,RPC_SCHEDULEDESPAWN__,RPC_SCHEDULEDESPAWN__INT_,RPC_RESPAWN__ZONE_INT_,RPC_SETHOMELOCATION__FLOAT_FLOAT_FLOAT_SCENEOBJECT_,RPC_SETRESPAWNTIMER__FLOAT_,RPC_ISATTACKABLEBY__CREATUREOBJECT_,RPC_ISAGGRESSIVETO__CREATUREOBJECT_,RPC_SETOBLIVIOUS__,RPC_SETWATCHOBJECT__SCENEOBJECT_,RPC_SETSTALKOBJECT__SCENEOBJECT_,RPC_SETFOLLOWOBJECT__SCENEOBJECT_,RPC_SETTARGETOBJECT__SCENEOBJECT_,RPC_GETFOLLOWOBJECT__,RPC_SELECTWEAPON__,RPC_VALIDATESTATEATTACK__CREATUREOBJECT_STRING_,RPC_ISRETREATING__,RPC_ISFLEEING__,RPC_CLEARDESPAWNEVENT__,RPC_GETKINETIC__,RPC_GETENERGY__,RPC_GETELECTRICITY__,RPC_GETSTUN__,RPC_GETBLAST__,RPC_GETHEAT__,RPC_GETCOLD__,RPC_GETACID__,RPC_GETLIGHTSABER__,RPC_ISSTALKER__,RPC_ISKILLER__,RPC_GETFEROCITY__,RPC_GETARMOR__,RPC_GETDESPAWNONNOPLAYERINRANGE__,RPC_GETNUMBEROFPLAYERSINRANGE__,RPC_GETFACTIONSTRING__,RPC_GETSOCIALGROUP__,RPC_GETCHANCEHIT__,RPC_GETDAMAGEMIN__,RPC_GETDAMAGEMAX__,RPC_GETBASEXP__,RPC_GETDIET__,RPC_GETRESPAWNTIMER__,RPC_ISAIAGENT__,RPC_HASLOOT__,RPC_SETSHOWNEXTPOSITION__BOOL_,RPC_ISEVENTMOB__,RPC_GETPVPFACTION__,};
 
 AiAgent::AiAgent() : CreatureObject(DummyConstructorParameter::instance()) {
        AiAgentImplementation* _implementation = new AiAgentImplementation();
@@ -1362,6 +1366,51 @@ String AiAgent::getPvPFaction() {
                return _implementation->getPvPFaction();
 }
 
+int AiAgent::getBehaviorStatus(Behavior* b) {
+       AiAgentImplementation* _implementation = static_cast<AiAgentImplementation*>(_getImplementation());
+       if (_implementation == NULL) {
+               throw ObjectNotLocalException(this);
+
+       } else
+               return _implementation->getBehaviorStatus(b);
+}
+
+void AiAgent::setBehaviorStatus(Behavior* b, int status) {
+       AiAgentImplementation* _implementation = static_cast<AiAgentImplementation*>(_getImplementation());
+       if (_implementation == NULL) {
+               throw ObjectNotLocalException(this);
+
+       } else
+               _implementation->setBehaviorStatus(b, status);
+}
+
+void AiAgent::addBehaviorToTree(BehaviorTree* tree, Behavior* b) {
+       AiAgentImplementation* _implementation = static_cast<AiAgentImplementation*>(_getImplementation());
+       if (_implementation == NULL) {
+               throw ObjectNotLocalException(this);
+
+       } else
+               _implementation->addBehaviorToTree(tree, b);
+}
+
+Behavior* AiAgent::getNextBehaviorFromTree(BehaviorTree* tree) {
+       AiAgentImplementation* _implementation = static_cast<AiAgentImplementation*>(_getImplementation());
+       if (_implementation == NULL) {
+               throw ObjectNotLocalException(this);
+
+       } else
+               return _implementation->getNextBehaviorFromTree(tree);
+}
+
+void AiAgent::resetBehaviorList(BehaviorTree* tree) {
+       AiAgentImplementation* _implementation = static_cast<AiAgentImplementation*>(_getImplementation());
+       if (_implementation == NULL) {
+               throw ObjectNotLocalException(this);
+
+       } else
+               _implementation->resetBehaviorList(tree);
+}
+
 DistributedObjectServant* AiAgent::_getImplementation() {
 
         if (!_updated) _updated = true;
index 4aa7f79..194cbe1 100644 (file)
@@ -217,6 +217,44 @@ class PlayerObject;
 
 using namespace server::zone::objects::player;
 
+namespace server {
+namespace zone {
+namespace objects {
+namespace creature {
+namespace ai {
+namespace bt {
+
+class Behavior;
+
+} // namespace bt
+} // namespace ai
+} // namespace creature
+} // namespace objects
+} // namespace zone
+} // namespace server
+
+using namespace server::zone::objects::creature::ai::bt;
+
+namespace server {
+namespace zone {
+namespace objects {
+namespace creature {
+namespace ai {
+namespace bt {
+
+class BehaviorTree;
+
+} // namespace bt
+} // namespace ai
+} // namespace creature
+} // namespace objects
+} // namespace zone
+} // namespace server
+
+using namespace server::zone::objects::creature::ai::bt;
+
+#include "gmock/gmock.h"
+
 #include "server/zone/objects/creature/PatrolPointsVector.h"
 
 #include "server/zone/objects/creature/PatrolPoint.h"
@@ -239,6 +277,8 @@ using namespace server::zone::objects::player;
 
 #include "server/zone/objects/creature/variables/CurrentFoundPath.h"
 
+#include "server/zone/objects/creature/ai/bt/BehaviorTreeList.h"
+
 #include "engine/lua/LuaObject.h"
 
 #include "system/util/Vector.h"
@@ -478,6 +518,16 @@ public:
 
        String getPvPFaction();
 
+       int getBehaviorStatus(Behavior* b);
+
+       void setBehaviorStatus(Behavior* b, int status);
+
+       void addBehaviorToTree(BehaviorTree* tree, Behavior* b);
+
+       Behavior* getNextBehaviorFromTree(BehaviorTree* tree);
+
+       void resetBehaviorList(BehaviorTree* tree);
+
        DistributedObjectServant* _getImplementation();
        DistributedObjectServant* _getImplementationForRead();
 
@@ -576,6 +626,12 @@ public:
 
        unsigned static const int PATROLING = 4;
 
+protected:
+       HashTable<Behavior*, int> statuses;
+
+       HashTable<BehaviorTree*, BehaviorTreeList*> trees;
+
+public:
        AiAgentImplementation();
 
        AiAgentImplementation(DummyConstructorParameter* param);
@@ -784,6 +840,16 @@ public:
 
        String getPvPFaction();
 
+       int getBehaviorStatus(Behavior* b);
+
+       void setBehaviorStatus(Behavior* b, int status);
+
+       void addBehaviorToTree(BehaviorTree* tree, Behavior* b);
+
+       Behavior* getNextBehaviorFromTree(BehaviorTree* tree);
+
+       void resetBehaviorList(BehaviorTree* tree);
+
        WeakReference<AiAgent*> _this;
 
        operator const AiAgent*();
@@ -1020,6 +1086,12 @@ public:
        friend class Singleton<AiAgentHelper>;
 };
 
+class MockAiAgent : public AiAgent {
+public:
+
+
+};
+
 } // namespace creature
 } // namespace objects
 } // namespace zone
index ad9348e..d39c4ae 100644 (file)
@@ -79,7 +79,11 @@ include server.zone.objects.scene.components.AiInterfaceComponent;
 include server.zone.objects.creature.variables.CreatureTemplateReference;
 include system.thread.ReadWriteLock;
 include server.zone.objects.creature.variables.CurrentFoundPath;
+import server.zone.objects.creature.ai.bt.Behavior;
+include server.zone.objects.creature.ai.bt.BehaviorTreeList;
+import server.zone.objects.creature.ai.bt.BehaviorTree;
 
+@mock
 class AiAgent extends CreatureObject {
        protected transient AiThinkEvent thinkEvent;
        
@@ -155,6 +159,14 @@ class AiAgent extends CreatureObject {
        public static final unsigned int STALKING = 2;
        public static final unsigned int FOLLOWING = 3;
        public static final unsigned int PATROLING = 4;
+
+       // AI bits
+       @dereferenced
+       protected transient HashTable<Behavior, int> statuses;
+       
+       @dereferenced
+       protected transient HashTable<BehaviorTree, BehaviorTreeList> trees;
+       
        
        public AiAgent() {
                baby = false;
@@ -730,4 +742,19 @@ class AiAgent extends CreatureObject {
        public string getPvPFaction(){
                return npcTemplate.get().getPvpFaction();
        }
+       @local
+       public native int getBehaviorStatus(Behavior b);
+       
+       @local
+       public native void setBehaviorStatus(Behavior b,int status);
+       
+       @local
+       public native void addBehaviorToTree(BehaviorTree tree, Behavior b);
+       
+       @local
+       public native Behavior getNextBehaviorFromTree(BehaviorTree tree);
+       
+       @local
+       public native void resetBehaviorList(BehaviorTree tree);
+       
 }
index b263387..3a14c15 100644 (file)
@@ -1840,3 +1840,34 @@ bool AiAgentImplementation::isEventMob() {
 
        return false;
 }
+int AiAgentImplementation::getBehaviorStatus(Behavior* b) {
+               return statuses.get(b);
+}
+void AiAgentImplementation::setBehaviorStatus(Behavior* b,int status) {
+               statuses.put(b,status);
+}
+void AiAgentImplementation::addBehaviorToTree(BehaviorTree* tree, Behavior* b) {
+       if (trees.containsKey(tree)) {
+               BehaviorTreeList* list = trees.get(tree);
+               list->add(b);
+       } else {
+               BehaviorTreeList* list = new BehaviorTreeList();
+               list->add(b);
+               trees.put(tree,list);
+       }
+}
+Behavior* AiAgentImplementation::getNextBehaviorFromTree(BehaviorTree* tree) {
+       if (trees.containsKey(tree)) {
+               BehaviorTreeList* list = trees.get(tree);
+               return list->remove();
+       } else {
+               return NULL;
+       }
+}
+void AiAgentImplementation::resetBehaviorList(BehaviorTree* tree) {
+       if (trees.containsKey(tree)) {
+               BehaviorTreeList* list = trees.get(tree);
+               trees.remove(tree);
+               delete list;
+       }
+}
index b010dd8..de106bf 100644 (file)
@@ -9,7 +9,7 @@
 #define BEHAVIOR_H_
 
 #include "engine/engine.h"
-#include "../AiActor.h"
+#include "server/zone/objects/creature/AiAgent.h"
 
 namespace server {
 namespace zone {
@@ -29,16 +29,16 @@ public:
        static const int RUNNING = 3;
        static const int SUSPENDED = 4;
        virtual ~Behavior(){}
-       int tick(AiActor* actor) {
+       int tick(AiAgent* actor) {
                if (actor->getBehaviorStatus(this) == INVALID || actor->getBehaviorStatus(this) == -1) { onInitialize(actor); }
                int status = update(actor);
                if (status != RUNNING) { onTerminate(actor,status); }
                return status;
        }
-       virtual int update(AiActor* actor) = 0;
-       virtual void onInitialize(AiActor* actor) { actor->setBehaviorStatus(this,INVALID);}
-       virtual void onTerminate(AiActor* actor, int s) {}
-       virtual void observe(AiActor* actor){}
+       virtual int update(AiAgent* actor) = 0;
+       virtual void onInitialize(AiAgent* actor) { actor->setBehaviorStatus(this,INVALID);}
+       virtual void onTerminate(AiAgent* actor, int s) {}
+       virtual void observe(AiAgent* actor){}
        virtual bool canObserve() { return false; }
 };
 
index 899ec43..055dac7 100644 (file)
@@ -15,10 +15,10 @@ BehaviorTree::BehaviorTree() {
 BehaviorTree::~BehaviorTree() {
 }
 
-void BehaviorTree::start(Behavior* behavior,AiActor* actor) {
+void BehaviorTree::start(Behavior* behavior,AiAgent* actor) {
        actor->addBehaviorToTree(this,behavior);
 }
-void BehaviorTree::stop(Behavior* behavior, AiActor* actor) {
+void BehaviorTree::stop(Behavior* behavior, AiAgent* actor) {
        if (actor->getBehaviorStatus(behavior) != Behavior::RUNNING) {
                return;
        }
@@ -26,7 +26,7 @@ void BehaviorTree::stop(Behavior* behavior, AiActor* actor) {
                behavior->observe(actor);
        }
 }
-void BehaviorTree::tick(AiActor* actor) {
+void BehaviorTree::tick(AiAgent* actor) {
        Behavior* stop = NULL;
        if (actor == NULL)
                return;
@@ -36,7 +36,7 @@ void BehaviorTree::tick(AiActor* actor) {
                continue;
        }
 }
-bool BehaviorTree::step(AiActor* actor) {
+bool BehaviorTree::step(AiAgent* actor) {
        Behavior* current = actor->getNextBehaviorFromTree(this);
        if (current == NULL) {
                return false;
index c93aa83..873c8e0 100644 (file)
@@ -22,10 +22,10 @@ class BehaviorTree {
 public:
        BehaviorTree();
        virtual ~BehaviorTree();
-       void start(Behavior* behavior,AiActor* actor);
-       void stop(Behavior* behavior, AiActor* actor);
-       void tick(AiActor* actor);
-       bool step(AiActor* actor);
+       void start(Behavior* behavior,AiAgent* actor);
+       void stop(Behavior* behavior, AiAgent* actor);
+       void tick(AiAgent* actor);
+       bool step(AiAgent* actor);
 };
 
 }
index 08f80ae..ad83840 100644 (file)
@@ -24,7 +24,7 @@ LuaBehavior::LuaBehavior(String name) {
 LuaBehavior::~LuaBehavior() {
 }
 
-int LuaBehavior::update(AiActor* actor) {
+int LuaBehavior::update(AiAgent* actor) {
        // re-use director maager
        Lua* lua = DirectorManager::instance()->getLuaInstance();
        LuaFunction update(lua->getLuaState(), this->className, "update", 1);
@@ -34,7 +34,7 @@ int LuaBehavior::update(AiActor* actor) {
        int rc = lua_tonumber(L, -1);
        return rc;
 }
-void LuaBehavior::onInitialize(AiActor* actor) {
+void LuaBehavior::onInitialize(AiAgent* actor) {
        // re-use director maager
        Lua* lua = DirectorManager::instance()->getLuaInstance();
        LuaFunction initialize(lua->getLuaState(), this->className, "OnInitialize", 0);
@@ -42,7 +42,7 @@ void LuaBehavior::onInitialize(AiActor* actor) {
        // run the function and fetch result
        lua->callFunction(&initialize);
 }
-void LuaBehavior::onTerminate(AiActor* actor, int s) {
+void LuaBehavior::onTerminate(AiAgent* actor, int s) {
        // re-use director maager
        Lua* lua = DirectorManager::instance()->getLuaInstance();
        LuaFunction terminate(lua->getLuaState(), this->className, "OnTerminiate", 0);
index 034361a..8621b27 100644 (file)
@@ -22,9 +22,9 @@ public:
 
        LuaBehavior(String name);
        virtual ~LuaBehavior();
-       virtual int update(AiActor* actor);
-       virtual void onInitialize(AiActor* actor);
-       virtual void onTerminate(AiActor* actor, int s);
+       virtual int update(AiAgent* actor);
+       virtual void onInitialize(AiAgent* actor);
+       virtual void onTerminate(AiAgent* actor, int s);
 protected:
        String className;
 };
index 9c9dc8a..f4c155b 100644 (file)
@@ -14,13 +14,13 @@ SequenceBehavior::SequenceBehavior(BehaviorTree* sequenceTree) {
 SequenceBehavior::~SequenceBehavior() {
 }
 
-void SequenceBehavior::onInitialize(AiActor* actor) {
+void SequenceBehavior::onInitialize(AiAgent* actor) {
        Behavior::onInitialize(actor);
        position = 0;
        end = children.size();
        tree->start(children.get(0),actor);
 }
-void SequenceBehavior::observe(AiActor* actor) {
+void SequenceBehavior::observe(AiAgent* actor) {
        Behavior* child = children.get(position);
        if (actor->getBehaviorStatus(child) == FAILURE) {
                tree->stop(this,actor);
index 9898c1c..fee4950 100644 (file)
@@ -24,9 +24,9 @@ public:
        virtual ~SequenceBehavior();
 protected:
        BehaviorTree* tree;
-       virtual void onInitialize(AiActor* actor);
-       virtual int update(AiActor* actor) { return RUNNING; }
-       virtual void observe(AiActor* actor);
+       virtual void onInitialize(AiAgent* actor);
+       virtual int update(AiAgent* actor) { return RUNNING; }
+       virtual void observe(AiAgent* actor);
        virtual bool canObserve() { return true; }
        int position;
        int end;
index dfbdf5b..f2f710f 100644 (file)
@@ -30,7 +30,7 @@ namespace test {
 
 class BehaviorTest : public ::testing::Test {
 public:
-       Reference<MockAiActor*> actor;
+       Reference<MockAiAgent*> actor;
        BehaviorTest() {
                // Perform creation setup here.
        }
@@ -40,7 +40,7 @@ public:
        }
 
        void SetUp() {
-               actor = new MockAiActor();
+               actor = new MockAiAgent();
        }
 
        void TearDown() {
index c192854..842ae08 100644 (file)
@@ -19,12 +19,12 @@ namespace bt {
 
 class MockBehavior: public Behavior {
 public:
-       MOCK_METHOD1(tick, int(AiActor* a));
-       MOCK_METHOD1(update,int(AiActor* a));
-       MOCK_METHOD1(onInitialize,void(AiActor* a));
+       MOCK_METHOD1(tick, int(AiAgent* a));
+       MOCK_METHOD1(update,int(AiAgent* a));
+       MOCK_METHOD1(onInitialize,void(AiAgent* a));
        MOCK_METHOD0(canObserve,bool());
-       MOCK_METHOD2(onTerminate, void(AiActor* a,int s));
-       MOCK_METHOD1(observe, void(AiActor* a));
+       MOCK_METHOD2(onTerminate, void(AiAgent* a,int s));
+       MOCK_METHOD1(observe, void(AiAgent* a));
 };
 
 }
index 1aeddae..5240d46 100644 (file)
@@ -35,12 +35,12 @@ public:
                        delete b;
                }
        }
-       MOCK_METHOD1(tick, int(AiActor* a));
-       MOCK_METHOD1(update,int(AiActor* a));
-       MOCK_METHOD1(onInitialize,void(AiActor* a));
+       MOCK_METHOD1(tick, int(AiAgent* a));
+       MOCK_METHOD1(update,int(AiAgent* a));
+       MOCK_METHOD1(onInitialize,void(AiAgent* a));
        MOCK_METHOD0(canObserve,bool());
-       MOCK_METHOD2(onTerminate, void(AiActor* a,int s));
-       MOCK_METHOD1(observe, void(AiActor* a));
+       MOCK_METHOD2(onTerminate, void(AiAgent* a,int s));
+       MOCK_METHOD1(observe, void(AiAgent* a));
     MockBehavior& operator[](uint32 index)
     {
         return *static_cast<MockBehavior*>(children.get(index));