aboutsummaryrefslogtreecommitdiff
path: root/src/game/GameObject.cpp
diff options
context:
space:
mode:
authormegamage <none@none>2009-02-19 18:44:20 -0600
committermegamage <none@none>2009-02-19 18:44:20 -0600
commite21b2c9baa506a265fddd50f65a69d2bb297cc96 (patch)
treeb8fab793711403664be8872ca9e80a9342cc6ab4 /src/game/GameObject.cpp
parent5076e99df193b311c3055ebc3316401dc52a7f15 (diff)
*Implemented gameobjects and creatures grouping (pools of them)
*Groups (called pools) can be also member of any game event Author: Neo2003 --HG-- branch : trunk
Diffstat (limited to 'src/game/GameObject.cpp')
-rw-r--r--src/game/GameObject.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/game/GameObject.cpp b/src/game/GameObject.cpp
index 8c51259e9f0..dc04388ef59 100644
--- a/src/game/GameObject.cpp
+++ b/src/game/GameObject.cpp
@@ -22,6 +22,7 @@
#include "QuestDef.h"
#include "GameObject.h"
#include "ObjectMgr.h"
+#include "PoolHandler.h"
#include "SpellMgr.h"
#include "Spell.h"
#include "UpdateMask.h"
@@ -66,7 +67,7 @@ GameObject::~GameObject()
{
if(m_uint32Values) // field array can be not exist if GameOBject not loaded
{
- // crash possible at access to deleted GO in Unit::m_gameobj
+ // Possible crash at access to deleted GO in Unit::m_gameobj
uint64 owner_guid = GetOwnerGUID();
if(owner_guid)
{
@@ -281,7 +282,11 @@ void GameObject::Update(uint32 /*p_time*/)
return;
}
// respawn timer
- GetMap()->Add(this);
+ uint16 poolid = poolhandler.IsPartOfAPool(GetGUIDLow(), TYPEID_GAMEOBJECT);
+ if (poolid)
+ poolhandler.UpdatePool(poolid, GetGUIDLow(), TYPEID_GAMEOBJECT);
+ else
+ GetMap()->Add(this);
break;
}
}
@@ -484,7 +489,11 @@ void GameObject::Delete()
SetGoState(1);
SetUInt32Value(GAMEOBJECT_FLAGS, GetGOInfo()->flags);
- AddObjectToRemoveList();
+ uint16 poolid = poolhandler.IsPartOfAPool(GetGUIDLow(), TYPEID_GAMEOBJECT);
+ if (poolid)
+ poolhandler.UpdatePool(poolid, GetGUIDLow(), TYPEID_GAMEOBJECT);
+ else
+ AddObjectToRemoveList();
}
void GameObject::getFishLoot(Loot *fishloot, Player* loot_owner)