Merge commit 'origin/master' into 310

Conflicts:
	src/game/CharacterHandler.cpp
	src/game/Player.cpp
This commit is contained in:
tomrus88 2009-04-29 11:51:15 +04:00
commit d4323e0071
88 changed files with 681 additions and 685 deletions

View file

@ -90,7 +90,7 @@ Unit::Unit()
m_form = FORM_NONE;
m_deathState = ALIVE;
for (uint32 i = 0; i < CURRENT_MAX_SPELL; i++)
for (uint32 i = 0; i < CURRENT_MAX_SPELL; ++i)
m_currentSpells[i] = NULL;
m_addDmgOnce = 0;
@ -160,7 +160,7 @@ Unit::Unit()
Unit::~Unit()
{
// set current spells as deletable
for (uint32 i = 0; i < CURRENT_MAX_SPELL; i++)
for (uint32 i = 0; i < CURRENT_MAX_SPELL; ++i)
{
if (m_currentSpells[i])
{
@ -333,7 +333,7 @@ bool Unit::canReachWithAttack(Unit *pVictim) const
void Unit::RemoveSpellsCausingAura(AuraType auraType)
{
if (auraType >= TOTAL_AURAS) return;
AuraList::iterator iter, next;
AuraList::const_iterator iter, next;
for (iter = m_modAuras[auraType].begin(); iter != m_modAuras[auraType].end(); iter = next)
{
next = iter;
@ -758,7 +758,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
// TODO: Store auras by interrupt flag to speed this up.
AuraMap& vAuras = pVictim->GetAuras();
for (AuraMap::iterator i = vAuras.begin(), next; i != vAuras.end(); i = next)
for (AuraMap::const_iterator i = vAuras.begin(), next; i != vAuras.end(); i = next)
{
const SpellEntry *se = i->second->GetSpellProto();
next = i; ++next;
@ -785,7 +785,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
{
if( damagetype != DOT )
{
for (uint32 i = CURRENT_FIRST_NON_MELEE_SPELL; i < CURRENT_MAX_SPELL; i++)
for (uint32 i = CURRENT_FIRST_NON_MELEE_SPELL; i < CURRENT_MAX_SPELL; ++i)
{
// skip channeled spell (processed differently below)
if (i == CURRENT_CHANNELED_SPELL)
@ -852,7 +852,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
void Unit::CastStop(uint32 except_spellid)
{
for (uint32 i = CURRENT_FIRST_NON_MELEE_SPELL; i < CURRENT_MAX_SPELL; i++)
for (uint32 i = CURRENT_FIRST_NON_MELEE_SPELL; i < CURRENT_MAX_SPELL; ++i)
if (m_currentSpells[i] && m_currentSpells[i]->m_spellInfo->Id!=except_spellid)
InterruptSpell(i,false);
}
@ -1484,7 +1484,7 @@ void Unit::DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss)
{
if(GetTypeId() == TYPEID_PLAYER && pVictim->isAlive())
{
for(int i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; i++)
for(int i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; ++i)
((Player*)this)->CastItemCombatSpell(((Player*)this)->GetItemByPos(INVENTORY_SLOT_BAG_0,i), pVictim, damageInfo->attackType);
}
@ -1589,7 +1589,7 @@ void Unit::CalcAbsorbResist(Unit *pVictim,SpellSchoolMask schoolMask, DamageEffe
uint32 faq[4] = {24,6,4,6};
uint8 m = 0;
float Binom = 0.0f;
for (uint8 i = 0; i < 4; i++)
for (uint8 i = 0; i < 4; ++i)
{
Binom += 2400 *( powf(tmpvalue2, i) * powf( (1-tmpvalue2), (4-i)))/faq[i];
if (ran > Binom )
@ -2619,7 +2619,7 @@ float Unit::MeleeMissChanceCalc(const Unit *pVictim, WeaponAttackType attType) c
if (haveOffhandWeapon() && attType != RANGED_ATTACK)
{
bool isNormal = false;
for (uint32 i = CURRENT_FIRST_NON_MELEE_SPELL; i < CURRENT_MAX_SPELL; i++)
for (uint32 i = CURRENT_FIRST_NON_MELEE_SPELL; i < CURRENT_MAX_SPELL; ++i)
{
if( m_currentSpells[i] && (GetSpellSchoolMask(m_currentSpells[i]->m_spellInfo) & SPELL_SCHOOL_MASK_NORMAL) )
{
@ -2875,7 +2875,7 @@ void Unit::_UpdateSpells( uint32 time )
_UpdateAutoRepeatSpell();
// remove finished spells from current pointers
for (uint32 i = 0; i < CURRENT_MAX_SPELL; i++)
for (uint32 i = 0; i < CURRENT_MAX_SPELL; ++i)
{
if (m_currentSpells[i] && m_currentSpells[i]->getState() == SPELL_STATE_FINISHED)
{
@ -3120,7 +3120,7 @@ void Unit::InterruptNonMeleeSpells(bool withDelayed, uint32 spell_id)
Spell* Unit::FindCurrentSpellBySpellId(uint32 spell_id) const
{
for (uint32 i = 0; i < CURRENT_MAX_SPELL; i++)
for (uint32 i = 0; i < CURRENT_MAX_SPELL; ++i)
if(m_currentSpells[i] && m_currentSpells[i]->m_spellInfo->Id==spell_id)
return m_currentSpells[i];
return NULL;
@ -3421,7 +3421,7 @@ bool Unit::AddAura(Aura *Aur)
bool restart = false;
AuraList& scAuras = caster->GetSingleCastAuras();
for(AuraList::iterator itr = scAuras.begin(); itr != scAuras.end(); ++itr)
for(AuraList::const_iterator itr = scAuras.begin(); itr != scAuras.end(); ++itr)
{
if( (*itr)->GetTarget() != Aur->GetTarget() &&
IsSingleTargetSpells((*itr)->GetSpellProto(),aurSpellInfo) )
@ -3464,7 +3464,7 @@ void Unit::RemoveRankAurasDueToSpell(uint32 spellId)
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId);
if(!spellInfo)
return;
AuraMap::iterator i,next;
AuraMap::const_iterator i,next;
for (i = m_Auras.begin(); i != m_Auras.end(); i = next)
{
next = i;
@ -3923,7 +3923,7 @@ void Unit::RemoveAllAurasOnDeath()
void Unit::DelayAura(uint32 spellId, uint32 effindex, int32 delaytime)
{
AuraMap::iterator iter = m_Auras.find(spellEffectPair(spellId, effindex));
AuraMap::const_iterator iter = m_Auras.find(spellEffectPair(spellId, effindex));
if (iter != m_Auras.end())
{
if (iter->second->GetAuraDuration() < delaytime)
@ -3937,7 +3937,7 @@ void Unit::DelayAura(uint32 spellId, uint32 effindex, int32 delaytime)
void Unit::_RemoveAllAuraMods()
{
for (AuraMap::iterator i = m_Auras.begin(); i != m_Auras.end(); ++i)
for (AuraMap::const_iterator i = m_Auras.begin(); i != m_Auras.end(); ++i)
{
(*i).second->ApplyModifier(false);
}
@ -3945,7 +3945,7 @@ void Unit::_RemoveAllAuraMods()
void Unit::_ApplyAllAuraMods()
{
for (AuraMap::iterator i = m_Auras.begin(); i != m_Auras.end(); ++i)
for (AuraMap::const_iterator i = m_Auras.begin(); i != m_Auras.end(); ++i)
{
(*i).second->ApplyModifier(true);
}
@ -3953,7 +3953,7 @@ void Unit::_ApplyAllAuraMods()
Aura* Unit::GetAura(uint32 spellId, uint32 effindex)
{
AuraMap::iterator iter = m_Auras.find(spellEffectPair(spellId, effindex));
AuraMap::const_iterator iter = m_Auras.find(spellEffectPair(spellId, effindex));
if (iter != m_Auras.end())
return iter->second;
return NULL;
@ -4777,7 +4777,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu
// Remove any stun effect on target
AuraMap& Auras = pVictim->GetAuras();
for(AuraMap::iterator iter = Auras.begin(); iter != Auras.end();)
for(AuraMap::const_iterator iter = Auras.begin(); iter != Auras.end();)
{
SpellEntry const *spell = iter->second->GetSpellProto();
if( spell->Mechanic == MECHANIC_STUN ||
@ -5540,7 +5540,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu
case 54939:
{
// Lookup base amount mana restore
for (int i=0; i<3;i++)
for (int i=0; i<3;++i)
if (procSpell->Effect[i] == SPELL_EFFECT_ENERGIZE)
{
int32 mana = procSpell->EffectBasePoints[i];
@ -7268,7 +7268,7 @@ bool Unit::isAttackingPlayer() const
if(charmed && charmed->isAttackingPlayer())
return true;
for (int8 i = 0; i < MAX_TOTEM; i++)
for (int8 i = 0; i < MAX_TOTEM; ++i)
{
if(m_TotemSlot[i])
{
@ -7285,7 +7285,7 @@ void Unit::RemoveAllAttackers()
{
while (!m_attackers.empty())
{
AttackerSet::iterator iter = m_attackers.begin();
AttackerSet::const_iterator iter = m_attackers.begin();
if(!(*iter)->AttackStop())
{
sLog.outError("WORLD: Unit has an attacker that isn't attacking it!");
@ -8459,7 +8459,7 @@ void Unit::MeleeDamageBonus(Unit *pVictim, uint32 *pdamage,WeaponAttackType attT
bool normalized = false;
if(spellProto)
{
for (uint8 i = 0; i<3;i++)
for (uint8 i = 0; i<3;++i)
{
if (spellProto->Effect[i] == SPELL_EFFECT_NORMALIZED_WEAPON_DMG)
{
@ -10223,7 +10223,7 @@ CharmInfo::CharmInfo(Unit* unit)
void CharmInfo::InitPetActionBar()
{
// the first 3 SpellOrActions are attack, follow and stay
for(uint32 i = 0; i < 3; i++)
for(uint32 i = 0; i < 3; ++i)
{
PetActionBar[i].Type = ACT_COMMAND;
PetActionBar[i].SpellOrAction = COMMAND_ATTACK - i;
@ -10231,7 +10231,7 @@ void CharmInfo::InitPetActionBar()
PetActionBar[i + 7].Type = ACT_REACTION;
PetActionBar[i + 7].SpellOrAction = COMMAND_ATTACK - i;
}
for(uint32 i=0; i < 4; i++)
for(uint32 i=0; i < 4; ++i)
{
PetActionBar[i + 3].Type = ACT_DISABLED;
PetActionBar[i + 3].SpellOrAction = 0;
@ -10313,7 +10313,7 @@ void CharmInfo::InitCharmCreateSpells()
bool CharmInfo::AddSpellToAB(uint32 oldid, uint32 newid, ActiveStates newstate)
{
for(uint8 i = 0; i < 10; i++)
for(uint8 i = 0; i < 10; ++i)
{
if((PetActionBar[i].Type == ACT_DISABLED || PetActionBar[i].Type == ACT_ENABLED || PetActionBar[i].Type == ACT_PASSIVE) && PetActionBar[i].SpellOrAction == oldid)
{
@ -10380,7 +10380,7 @@ typedef std::list< uint32> RemoveSpellList;
// for example SPELL_AURA_MECHANIC_IMMUNITY - need check for mechanic
bool InitTriggerAuraData()
{
for (int i=0;i<TOTAL_AURAS;i++)
for (int i=0;i<TOTAL_AURAS;++i)
{
isTriggerAura[i]=false;
isNonTriggerAura[i] = false;
@ -10544,7 +10544,7 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag
return;
// Handle effects proceed this time
for(ProcTriggeredList::iterator i = procTriggered.begin(); i != procTriggered.end(); ++i)
for(ProcTriggeredList::const_iterator i = procTriggered.begin(); i != procTriggered.end(); ++i)
{
// Some auras can be deleted in function called in this loop (except first, ofc)
// Until storing auars in std::multimap to hard check deleting by another way
@ -10565,7 +10565,7 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag
{
// sLog.outDebug("Spell aura %u (id:%u effect:%u) has been deleted before call spell proc event handler", i->triggeredByAura->GetModifier()->m_auraname, i->triggeredByAura_SpellPair.first, i->triggeredByAura_SpellPair.second);
// sLog.outDebug("It can be deleted one from early proccesed auras:");
// for(ProcTriggeredList::iterator i2 = procTriggered.begin(); i != i2; ++i2)
// for(ProcTriggeredList::const_iterator i2 = procTriggered.begin(); i != i2; ++i2)
// sLog.outDebug(" Spell aura %u (id:%u effect:%u)", i->triggeredByAura->GetModifier()->m_auraname,i2->triggeredByAura_SpellPair.first,i2->triggeredByAura_SpellPair.second);
// sLog.outDebug(" <end of list>");
continue;
@ -10700,7 +10700,7 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag
removedSpells.sort();
removedSpells.unique();
// Remove auras from removedAuras
for(RemoveSpellList::const_iterator i = removedSpells.begin(); i != removedSpells.end();i++)
for(RemoveSpellList::const_iterator i = removedSpells.begin(); i != removedSpells.end();++i)
RemoveAurasDueToSpell(*i);
}
}
@ -11061,7 +11061,7 @@ Unit* Unit::SelectNearbyTarget() const
bool Unit::hasNegativeAuraWithInterruptFlag(uint32 flag)
{
for (AuraMap::iterator iter = m_Auras.begin(); iter != m_Auras.end(); ++iter)
for (AuraMap::const_iterator iter = m_Auras.begin(); iter != m_Auras.end(); ++iter)
{
if (!iter->second->IsPositive() && iter->second->GetSpellProto()->AuraInterruptFlags & flag)
return true;
@ -11108,7 +11108,7 @@ uint32 Unit::GetCastingTimeForBonus( SpellEntry const *spellProto, DamageEffectT
bool DirectDamage = false;
bool AreaEffect = false;
for ( uint32 i=0; i<3;i++)
for ( uint32 i=0; i<3;++i)
{
switch ( spellProto->Effect[i] )
{