aboutsummaryrefslogtreecommitdiff
path: root/src/game/Unit.cpp
diff options
context:
space:
mode:
authormegamage <none@none>2009-04-12 17:41:46 -0500
committermegamage <none@none>2009-04-12 17:41:46 -0500
commitc1c5a707ffc8849f4c826a00b60a2ea1b1840e24 (patch)
tree75acbe872ba707e41b42e2daf578aedbdc0bb515 /src/game/Unit.cpp
parentce8b6ca35491ca80508ebdbc1a57e920cadf9838 (diff)
[7657] Implement function for access to gameobject owned by unit and created by some spell. Author: VladimirMangos
--HG-- branch : trunk
Diffstat (limited to 'src/game/Unit.cpp')
-rw-r--r--src/game/Unit.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index f41637b6c75..01712ef5b49 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -3300,7 +3300,7 @@ void Unit::_UpdateSpells( uint32 time )
if(!m_gameObj.empty())
{
- std::list<GameObject*>::iterator ite1, dnext1;
+ GameObjectList::iterator ite1, dnext1;
for (ite1 = m_gameObj.begin(); ite1 != m_gameObj.end(); ite1 = dnext1)
{
dnext1 = ite1;
@@ -4375,6 +4375,15 @@ DynamicObject * Unit::GetDynObject(uint32 spellId)
return NULL;
}
+GameObject* Unit::GetGameObject(uint32 spellId) const
+{
+ for (GameObjectList::const_iterator i = m_gameObj.begin(); i != m_gameObj.end();)
+ if ((*i)->GetSpellId() == spellId)
+ return *i;
+
+ return NULL;
+}
+
void Unit::AddGameObject(GameObject* gameObj)
{
assert(gameObj && gameObj->GetOwnerGUID()==0);
@@ -4425,7 +4434,7 @@ void Unit::RemoveGameObject(uint32 spellid, bool del)
{
if(m_gameObj.empty())
return;
- std::list<GameObject*>::iterator i, next;
+ GameObjectList::iterator i, next;
for (i = m_gameObj.begin(); i != m_gameObj.end(); i = next)
{
next = i;
@@ -4448,7 +4457,7 @@ void Unit::RemoveGameObject(uint32 spellid, bool del)
void Unit::RemoveAllGameObjects()
{
// remove references to unit
- for(std::list<GameObject*>::iterator i = m_gameObj.begin(); i != m_gameObj.end();)
+ for(GameObjectList::iterator i = m_gameObj.begin(); i != m_gameObj.end();)
{
(*i)->SetOwnerGUID(0);
(*i)->SetRespawnTime(0);