mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-18 08:28:32 +01:00
[svn] * Avoid access to bag item prototype for getting bag size, use related item update field instead as more fast source.
* Better check client inventory pos data received in some client packets to skip invalid cases. * Removed some unnecessary database queries. * Make guid lookup for adding ignore async. * Added two parameter versions of the AsyncQuery function * Make queries for adding friends async. - Hunuza * Replace some PQuery() calls with more simple Query() - Hunuza * Mark spell as executed instead of deleteable to solve crash. *** Source mangos. **Its a big commit. so test with care... or without care.... whatever floats your boat. --HG-- branch : trunk
This commit is contained in:
@@ -237,9 +237,11 @@ Unit::~Unit()
|
||||
// set current spells as deletable
|
||||
for (uint32 i = 0; i < CURRENT_MAX_SPELL; i++)
|
||||
{
|
||||
// spell may be safely deleted now
|
||||
if (m_currentSpells[i]) m_currentSpells[i]->SetDeletable(true);
|
||||
m_currentSpells[i] = NULL;
|
||||
if (m_currentSpells[i])
|
||||
{
|
||||
m_currentSpells[i]->SetReferencedFromCurrent(false);
|
||||
m_currentSpells[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
RemoveAllGameObjects();
|
||||
@@ -3163,7 +3165,7 @@ void Unit::_UpdateSpells( uint32 time )
|
||||
{
|
||||
if (m_currentSpells[i] && m_currentSpells[i]->getState() == SPELL_STATE_FINISHED)
|
||||
{
|
||||
m_currentSpells[i]->SetDeletable(true); // spell may be safely deleted now
|
||||
m_currentSpells[i]->SetReferencedFromCurrent(false);
|
||||
m_currentSpells[i] = NULL; // remove pointer
|
||||
}
|
||||
}
|
||||
@@ -3276,7 +3278,6 @@ void Unit::SetCurrentCastedSpell( Spell * pSpell )
|
||||
|
||||
uint32 CSpellType = pSpell->GetCurrentContainer();
|
||||
|
||||
pSpell->SetDeletable(false); // spell will not be deleted until gone from current pointers
|
||||
if (pSpell == m_currentSpells[CSpellType]) return; // avoid breaking self
|
||||
|
||||
// break same type spell if it is not delayed
|
||||
@@ -3333,10 +3334,11 @@ void Unit::SetCurrentCastedSpell( Spell * pSpell )
|
||||
|
||||
// current spell (if it is still here) may be safely deleted now
|
||||
if (m_currentSpells[CSpellType])
|
||||
m_currentSpells[CSpellType]->SetDeletable(true);
|
||||
m_currentSpells[CSpellType]->SetReferencedFromCurrent(false);
|
||||
|
||||
// set new current spell
|
||||
m_currentSpells[CSpellType] = pSpell;
|
||||
pSpell->SetReferencedFromCurrent(true);
|
||||
}
|
||||
|
||||
void Unit::InterruptSpell(uint32 spellType, bool withDelayed)
|
||||
@@ -3354,7 +3356,7 @@ void Unit::InterruptSpell(uint32 spellType, bool withDelayed)
|
||||
|
||||
if (m_currentSpells[spellType]->getState() != SPELL_STATE_FINISHED)
|
||||
m_currentSpells[spellType]->cancel();
|
||||
m_currentSpells[spellType]->SetDeletable(true);
|
||||
m_currentSpells[spellType]->SetReferencedFromCurrent(false);
|
||||
m_currentSpells[spellType] = NULL;
|
||||
}
|
||||
}
|
||||
@@ -3390,7 +3392,7 @@ void Unit::InterruptNonMeleeSpells(bool withDelayed, uint32 spell_id)
|
||||
if ( (m_currentSpells[CURRENT_GENERIC_SPELL]->getState() != SPELL_STATE_FINISHED) &&
|
||||
(withDelayed || m_currentSpells[CURRENT_GENERIC_SPELL]->getState() != SPELL_STATE_DELAYED) )
|
||||
m_currentSpells[CURRENT_GENERIC_SPELL]->cancel();
|
||||
m_currentSpells[CURRENT_GENERIC_SPELL]->SetDeletable(true);
|
||||
m_currentSpells[CURRENT_GENERIC_SPELL]->SetReferencedFromCurrent(false);
|
||||
m_currentSpells[CURRENT_GENERIC_SPELL] = NULL;
|
||||
}
|
||||
|
||||
@@ -3404,7 +3406,7 @@ void Unit::InterruptNonMeleeSpells(bool withDelayed, uint32 spell_id)
|
||||
if ( (m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->getState() != SPELL_STATE_FINISHED) &&
|
||||
(withDelayed || m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->getState() != SPELL_STATE_DELAYED) )
|
||||
m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->cancel();
|
||||
m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->SetDeletable(true);
|
||||
m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->SetReferencedFromCurrent(false);
|
||||
m_currentSpells[CURRENT_AUTOREPEAT_SPELL] = NULL;
|
||||
}
|
||||
|
||||
@@ -3413,7 +3415,7 @@ void Unit::InterruptNonMeleeSpells(bool withDelayed, uint32 spell_id)
|
||||
{
|
||||
if (m_currentSpells[CURRENT_CHANNELED_SPELL]->getState() != SPELL_STATE_FINISHED)
|
||||
m_currentSpells[CURRENT_CHANNELED_SPELL]->cancel();
|
||||
m_currentSpells[CURRENT_CHANNELED_SPELL]->SetDeletable(true);
|
||||
m_currentSpells[CURRENT_CHANNELED_SPELL]->SetReferencedFromCurrent(false);
|
||||
m_currentSpells[CURRENT_CHANNELED_SPELL] = NULL;
|
||||
}
|
||||
}
|
||||
@@ -9860,7 +9862,7 @@ void Unit::CleanupsBeforeDelete()
|
||||
if(m_uint32Values) // only for fully created object
|
||||
{
|
||||
InterruptNonMeleeSpells(true);
|
||||
m_Events.KillAllEvents();
|
||||
m_Events.KillAllEvents(false); // non-delatable (currently casted spells) will not deleted ans will deleated at call in Map::RemoveAllObjectsInRemoveList
|
||||
CombatStop();
|
||||
ClearComboPointHolders();
|
||||
DeleteThreatList();
|
||||
|
||||
Reference in New Issue
Block a user