[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:
KingPin
2008-11-05 20:10:19 -06:00
parent 404f72c7a2
commit 8d331f2b10
27 changed files with 394 additions and 280 deletions

View File

@@ -287,7 +287,8 @@ Spell::Spell( Unit* Caster, SpellEntry const *info, bool triggered, uint64 origi
m_triggeringContainer = triggeringContainer;
m_magnetPair.first = false;
m_magnetPair.second = NULL;
m_deletable = true;
m_referencedFromCurrentSpell = false;
m_executedCurrently = false;
m_delayAtDamageCount = 0;
m_applyMultiplierMask = 0;
@@ -2201,6 +2202,8 @@ void Spell::cancel()
void Spell::cast(bool skipCheck)
{
SetExecutedCurrently(true);
uint8 castResult = 0;
// update pointers base at GUIDs to prevent access to non-existed already object
@@ -2210,6 +2213,7 @@ void Spell::cast(bool skipCheck)
if(!m_targets.getUnitTarget() && m_targets.getUnitTargetGUID() && m_targets.getUnitTargetGUID() != m_caster->GetGUID())
{
cancel();
SetExecutedCurrently(false);
return;
}
@@ -2221,6 +2225,7 @@ void Spell::cast(bool skipCheck)
{
SendCastResult(castResult);
finish(false);
SetExecutedCurrently(false);
return;
}
@@ -2232,6 +2237,7 @@ void Spell::cast(bool skipCheck)
{
SendCastResult(castResult);
finish(false);
SetExecutedCurrently(false);
return;
}
}
@@ -2277,7 +2283,10 @@ void Spell::cast(bool skipCheck)
TakeReagents(); // we must remove reagents before HandleEffects to allow place crafted item in same slot
if(m_spellState == SPELL_STATE_FINISHED) // stop cast if spell marked as finish somewhere in Take*/FillTargetMap
{
SetExecutedCurrently(false);
return;
}
SendCastResult(castResult);
SendSpellGo(); // we must send smsg_spell_go packet before m_castItem delete in TakeCastItem()...
@@ -2309,6 +2318,8 @@ void Spell::cast(bool skipCheck)
// Immediate spell, no big deal
handle_immediate();
}
SetExecutedCurrently(false);
}
void Spell::handle_immediate()
@@ -5126,3 +5137,8 @@ void SpellEvent::Abort(uint64 /*e_time*/)
if (m_Spell->getState() != SPELL_STATE_FINISHED)
m_Spell->cancel();
}
bool SpellEvent::IsDeletable() const
{
return m_Spell->IsDeletable();
}