From e21b2c9baa506a265fddd50f65a69d2bb297cc96 Mon Sep 17 00:00:00 2001 From: megamage Date: Thu, 19 Feb 2009 18:44:20 -0600 Subject: *Implemented gameobjects and creatures grouping (pools of them) *Groups (called pools) can be also member of any game event Author: Neo2003 --HG-- branch : trunk --- src/game/GameObject.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'src/game/GameObject.cpp') 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) -- cgit v1.2.3