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