Instructions Jenkins Doxygen

[Fixed] ai will drop their follow object when it disappears - mantis 70/2370/4
authorIvojedi <ivojedi@swgemu.com>
Mon, 25 Aug 2014 17:47:12 +0000 (10:47 -0700)
committerIvojedi <ivojedi@swgemu.com>
Mon, 25 Aug 2014 19:27:34 +0000 (12:27 -0700)
5052
[Fixed] pets will drop their follow object when stored

Change-Id: I9a6bb26b50981b0d6587770cb00825957f754591

MMOCoreORB/src/server/zone/objects/creature/AiAgent.idl
MMOCoreORB/src/server/zone/objects/creature/AiAgentImplementation.cpp
MMOCoreORB/src/server/zone/objects/creature/events/InvisibleDelayEvent.h
MMOCoreORB/src/server/zone/objects/intangible/tasks/StorePetTask.h

index 10d91df..81c445c 100644 (file)
@@ -506,9 +506,11 @@ class AiAgent extends CreatureObject {
        public native boolean isAggressiveTo(CreatureObject object);
        
        public void setOblivious() {
-               followState = OBLIVIOUS;
-               setTargetObject(null);
-               //activateMovementEvent();
+               synchronized (targetMutex) {
+                       followState = OBLIVIOUS;
+                       setTargetObject(null);
+                       //activateMovementEvent();
+               }
        }
        
        public void setWatchObject(SceneObject obj) {
index 93edc86..69d0d4b 100644 (file)
@@ -969,6 +969,24 @@ void AiAgentImplementation::notifyDissapear(QuadTreeEntry* entry) {
        if (scno == _this.get())
                return;
 
+       if (scno == followObject) {
+               class SetObliviousTask : public Task {
+                       ManagedReference<AiAgent*> ai;
+
+               public:
+                       SetObliviousTask(AiAgent* mob) : ai(mob) {}
+
+                       void run() {
+                               Locker locker(ai);
+                               ai->setOblivious();
+                               ai->storeFollowObject();
+                       }
+               };
+
+               SetObliviousTask* task = new SetObliviousTask(_this.get().get());
+               task->execute();
+       }
+
        if (scno->isPlayerCreature()) {
                int32 newValue = (int32) numberOfPlayersInRange.decrement();
 
index 2e70512..e011f49 100644 (file)
@@ -88,7 +88,7 @@ public:
                                        for (int i = 0; i < closeObjects->size(); ++i) {
                                                SceneObject* scno = cast<SceneObject*>( closeObjects->get(i).get());
 
-                                               if (scno != player && scno->isPlayerCreature())
+                                               if (scno != player)
                                                                scno->notifyDissapear(player);
 
                                        }
@@ -106,7 +106,7 @@ public:
                                        for (int i = 0; i < closeObjects->size(); ++i) {
                                                SceneObject* scno = cast<SceneObject*>( closeObjects->get(i).get());
 
-                                               if (scno != player && scno->isPlayerCreature())
+                                               if (scno != player)
                                                                scno->notifyInsert(player);
 
                                        }
index a81eee7..20d2b87 100644 (file)
@@ -32,8 +32,8 @@ public:
 \r
                pet->setPosture(CreaturePosture::UPRIGHT, true);\r
                pet->clearCombatState(true);\r
-               pet->setTargetObject(NULL);\r
-               pet->setFollowObject(NULL);\r
+               pet->setOblivious();\r
+               pet->storeFollowObject();\r
                pet->destroyObjectFromWorld(true);\r
 \r
                pet->setCreatureLink(NULL);\r