mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 01:37:00 +00:00
[7730] Some optimizantion and code style.
Signed-off-by: AlexDereka <dereka.alex@gmail.com>
This commit is contained in:
parent
a4373c887d
commit
8144f30199
69 changed files with 536 additions and 536 deletions
|
|
@ -59,7 +59,7 @@ Pet::~Pet()
|
|||
{
|
||||
if(m_uint32Values) // only for fully created Object
|
||||
{
|
||||
for (PetSpellMap::iterator i = m_spells.begin(); i != m_spells.end(); ++i)
|
||||
for (PetSpellMap::const_iterator i = m_spells.begin(); i != m_spells.end(); ++i)
|
||||
delete i->second;
|
||||
ObjectAccessor::Instance().RemoveObject(this);
|
||||
}
|
||||
|
|
@ -435,14 +435,14 @@ void Pet::SavePetToDB(PetSaveMode mode)
|
|||
<< curmana << ", "
|
||||
<< GetPower(POWER_HAPPINESS) << ", '";
|
||||
|
||||
for(uint32 i = 0; i < 10; i++)
|
||||
for(uint32 i = 0; i < 10; ++i)
|
||||
ss << uint32(m_charmInfo->GetActionBarEntry(i)->Type) << " " << uint32(m_charmInfo->GetActionBarEntry(i)->SpellOrAction) << " ";
|
||||
ss << "', '";
|
||||
|
||||
//save spells the pet can teach to it's Master
|
||||
{
|
||||
int i = 0;
|
||||
for(TeachSpellMap::iterator itr = m_teachspells.begin(); i < 4 && itr != m_teachspells.end(); ++i, ++itr)
|
||||
for(TeachSpellMap::const_iterator itr = m_teachspells.begin(); i < 4 && itr != m_teachspells.end(); ++i, ++itr)
|
||||
ss << itr->first << " " << itr->second << " ";
|
||||
for(; i < 4; ++i)
|
||||
ss << uint32(0) << " " << uint32(0) << " ";
|
||||
|
|
@ -629,7 +629,7 @@ bool Pet::CanTakeMoreActiveSpells(uint32 spellid)
|
|||
|
||||
chainstartstore[0] = spellmgr.GetFirstSpellInChain(spellid);
|
||||
|
||||
for (PetSpellMap::iterator itr = m_spells.begin(); itr != m_spells.end(); ++itr)
|
||||
for (PetSpellMap::const_iterator itr = m_spells.begin(); itr != m_spells.end(); ++itr)
|
||||
{
|
||||
if(IsPassiveSpell(itr->first))
|
||||
continue;
|
||||
|
|
@ -932,7 +932,7 @@ bool Pet::InitStatsForLevel(uint32 petlevel)
|
|||
SetModifierValue(UNIT_MOD_ARMOR, BASE_VALUE, float(pInfo->armor));
|
||||
//SetModifierValue(UNIT_MOD_ATTACK_POWER, BASE_VALUE, float(cinfo->attackpower));
|
||||
|
||||
for( int i = STAT_STRENGTH; i < MAX_STATS; i++)
|
||||
for( int i = STAT_STRENGTH; i < MAX_STATS; ++i)
|
||||
{
|
||||
SetCreateStat(Stats(i), float(pInfo->stats[i]));
|
||||
}
|
||||
|
|
@ -1124,7 +1124,7 @@ void Pet::_SaveSpells()
|
|||
void Pet::_LoadAuras(uint32 timediff)
|
||||
{
|
||||
m_Auras.clear();
|
||||
for (int i = 0; i < TOTAL_AURAS; i++)
|
||||
for (int i = 0; i < TOTAL_AURAS; ++i)
|
||||
m_modAuras[i].clear();
|
||||
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT caster_guid,spell,effect_index,stackcount,amount,maxduration,remaintime,remaincharges FROM pet_aura WHERE guid = '%u'",m_charmInfo->GetPetNumber());
|
||||
|
|
@ -1178,7 +1178,7 @@ void Pet::_LoadAuras(uint32 timediff)
|
|||
if (caster_guid != GetGUID() && IsSingleTargetSpell(spellproto))
|
||||
continue;
|
||||
|
||||
for(uint32 i=0; i<stackcount; i++)
|
||||
for(uint32 i=0; i<stackcount; ++i)
|
||||
{
|
||||
Aura* aura = CreateAura(spellproto, effindex, NULL, this, NULL);
|
||||
|
||||
|
|
@ -1220,7 +1220,7 @@ void Pet::_SaveAuras()
|
|||
{
|
||||
// skip all auras from spell that apply at cast SPELL_AURA_MOD_SHAPESHIFT or pet area auras.
|
||||
uint8 i;
|
||||
for (i = 0; i < 3; i++)
|
||||
for (i = 0; i < 3; ++i)
|
||||
if (spellInfo->EffectApplyAuraName[i] == SPELL_AURA_MOD_STEALTH ||
|
||||
spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AREA_AURA_OWNER ||
|
||||
spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AREA_AURA_PET )
|
||||
|
|
@ -1321,7 +1321,7 @@ bool Pet::addSpell(uint32 spell_id, uint16 active, PetSpellState state, PetSpell
|
|||
}
|
||||
else if(uint32 chainstart = spellmgr.GetFirstSpellInChain(spell_id))
|
||||
{
|
||||
for (PetSpellMap::iterator itr2 = m_spells.begin(); itr2 != m_spells.end(); ++itr2)
|
||||
for (PetSpellMap::const_iterator itr2 = m_spells.begin(); itr2 != m_spells.end(); ++itr2)
|
||||
{
|
||||
if(itr2->second->state == PETSPELL_REMOVED) continue;
|
||||
|
||||
|
|
@ -1466,7 +1466,7 @@ void Pet::InitPetCreateSpells()
|
|||
{
|
||||
m_charmInfo->InitPetActionBar();
|
||||
|
||||
for (PetSpellMap::iterator i = m_spells.begin(); i != m_spells.end(); ++i)
|
||||
for (PetSpellMap::const_iterator i = m_spells.begin(); i != m_spells.end(); ++i)
|
||||
delete i->second;
|
||||
m_spells.clear();
|
||||
|
||||
|
|
@ -1474,7 +1474,7 @@ void Pet::InitPetCreateSpells()
|
|||
PetCreateSpellEntry const* CreateSpells = objmgr.GetPetCreateSpellEntry(GetEntry());
|
||||
if(CreateSpells)
|
||||
{
|
||||
for(uint8 i = 0; i < 4; i++)
|
||||
for(uint8 i = 0; i < 4; ++i)
|
||||
{
|
||||
if(!CreateSpells->spellid[i])
|
||||
break;
|
||||
|
|
@ -1567,7 +1567,7 @@ bool Pet::resetTalents(bool no_cost)
|
|||
}
|
||||
}
|
||||
|
||||
for (unsigned int i = 0; i < sTalentStore.GetNumRows(); i++)
|
||||
for (unsigned int i = 0; i < sTalentStore.GetNumRows(); ++i)
|
||||
{
|
||||
TalentEntry const *talentInfo = sTalentStore.LookupEntry(i);
|
||||
|
||||
|
|
@ -1584,7 +1584,7 @@ bool Pet::resetTalents(bool no_cost)
|
|||
|
||||
for (int j = 0; j < MAX_TALENT_RANK; j++)
|
||||
{
|
||||
for(PetSpellMap::iterator itr = m_spells.begin(); itr != m_spells.end();)
|
||||
for(PetSpellMap::const_iterator itr = m_spells.begin(); itr != m_spells.end();)
|
||||
{
|
||||
if(itr->second->state == PETSPELL_REMOVED)
|
||||
{
|
||||
|
|
@ -1671,7 +1671,7 @@ void Pet::ToggleAutocast(uint32 spellid, bool apply)
|
|||
|
||||
if(apply)
|
||||
{
|
||||
for (i = 0; i < m_autospells.size() && m_autospells[i] != spellid; i++)
|
||||
for (i = 0; i < m_autospells.size() && m_autospells[i] != spellid; ++i)
|
||||
; // just search
|
||||
|
||||
if (i == m_autospells.size())
|
||||
|
|
@ -1684,7 +1684,7 @@ void Pet::ToggleAutocast(uint32 spellid, bool apply)
|
|||
else
|
||||
{
|
||||
AutoSpellList::iterator itr2 = m_autospells.begin();
|
||||
for (i = 0; i < m_autospells.size() && m_autospells[i] != spellid; i++, itr2++)
|
||||
for (i = 0; i < m_autospells.size() && m_autospells[i] != spellid; ++i, itr2++)
|
||||
; // just search
|
||||
|
||||
if (i < m_autospells.size())
|
||||
|
|
@ -1752,7 +1752,7 @@ void Pet::CastPetAuras(bool current)
|
|||
if(getPetType() != HUNTER_PET && (getPetType() != SUMMON_PET || owner->getClass() != CLASS_WARLOCK))
|
||||
return;
|
||||
|
||||
for(PetAuraSet::iterator itr = owner->m_petAuras.begin(); itr != owner->m_petAuras.end();)
|
||||
for(PetAuraSet::const_iterator itr = owner->m_petAuras.begin(); itr != owner->m_petAuras.end();)
|
||||
{
|
||||
PetAura const* pa = *itr;
|
||||
++itr;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue