*Remove some redundant code.
--HG-- branch : trunk
This commit is contained in:
+17
-32
@@ -3201,50 +3201,38 @@ void Unit::_UpdateSpells( uint32 time )
|
|||||||
// TODO: Find a better way to prevent crash when multiple auras are removed.
|
// TODO: Find a better way to prevent crash when multiple auras are removed.
|
||||||
m_removedAuras = 0;
|
m_removedAuras = 0;
|
||||||
for (AuraMap::iterator i = m_Auras.begin(); i != m_Auras.end(); ++i)
|
for (AuraMap::iterator i = m_Auras.begin(); i != m_Auras.end(); ++i)
|
||||||
if ((*i).second)
|
i->second->SetUpdated(false);
|
||||||
(*i).second->SetUpdated(false);
|
|
||||||
|
|
||||||
for (AuraMap::iterator i = m_Auras.begin(), next; i != m_Auras.end(); i = next)
|
for(AuraMap::iterator i = m_Auras.begin(); i != m_Auras.end();)
|
||||||
{
|
|
||||||
next = i;
|
|
||||||
++next;
|
|
||||||
if ((*i).second)
|
|
||||||
{
|
{
|
||||||
|
Aura *aur = i->second;
|
||||||
|
|
||||||
// prevent double update
|
// prevent double update
|
||||||
if ((*i).second->IsUpdated())
|
if (aur->IsUpdated())
|
||||||
continue;
|
continue;
|
||||||
(*i).second->SetUpdated(true);
|
aur->SetUpdated(true);
|
||||||
(*i).second->SetInUse(true);
|
|
||||||
(*i).second->Update( time );
|
aur->SetInUse(true);
|
||||||
(*i).second->SetInUse(false);
|
aur->Update( time );
|
||||||
|
aur->SetInUse(false);
|
||||||
|
|
||||||
// several auras can be deleted due to update
|
// several auras can be deleted due to update
|
||||||
if (m_removedAuras)
|
if(m_removedAuras)
|
||||||
{
|
{
|
||||||
if (m_Auras.empty()) break;
|
|
||||||
next = m_Auras.begin();
|
|
||||||
m_removedAuras = 0;
|
m_removedAuras = 0;
|
||||||
|
i = m_Auras.begin();
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
|
++i;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (AuraMap::iterator i = m_Auras.begin(); i != m_Auras.end();)
|
for(AuraMap::iterator i = m_Auras.begin(); i != m_Auras.end();)
|
||||||
{
|
|
||||||
if ((*i).second)
|
|
||||||
{
|
|
||||||
if ( !(*i).second->GetAuraDuration() && !((*i).second->IsPermanent() || ((*i).second->IsPassive())) )
|
|
||||||
{
|
{
|
||||||
|
if(!i->second->GetAuraDuration() && !(i->second->IsPermanent() || (i->second->IsPassive())))
|
||||||
RemoveAura(i, AURA_REMOVE_BY_EXPIRE);
|
RemoveAura(i, AURA_REMOVE_BY_EXPIRE);
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
++i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!m_gameObj.empty())
|
if(!m_gameObj.empty())
|
||||||
{
|
{
|
||||||
@@ -4151,9 +4139,6 @@ void Unit::RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode)
|
|||||||
statue->UnSummon();
|
statue->UnSummon();
|
||||||
|
|
||||||
// only way correctly remove all auras from list
|
// only way correctly remove all auras from list
|
||||||
if( m_Auras.empty() )
|
|
||||||
i = m_Auras.end();
|
|
||||||
else
|
|
||||||
i = m_Auras.begin();
|
i = m_Auras.begin();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user