[7657] Implement function for access to gameobject owned by unit and created by some spell. Author: VladimirMangos
--HG-- branch : trunk
This commit is contained in:
1 parent
ce8b6ca354
commit
c1c5a707ff
2 files changed
+20
-6
No files matched your search
+12
-3
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user