[11590] Cleanups for barGoLink

* Rename barGoLink -> BarGoLink as expected by mangos code style
* Add uint32/uint6 constructor versions for BarGoLink,
  and remove lot casts required before for BarGoLink use
This commit is contained in:
VladimirMangos 2011-06-03 11:46:48 +04:00
parent 6b8f9fe03d
commit c870ef324d
26 changed files with 430 additions and 410 deletions

View file

@ -996,7 +996,7 @@ void SpellMgr::LoadSpellTargetPositions()
QueryResult *result = WorldDatabase.Query("SELECT id, target_map, target_position_x, target_position_y, target_position_z, target_orientation FROM spell_target_position");
if (!result)
{
barGoLink bar( 1 );
BarGoLink bar(1);
bar.step();
@ -1005,7 +1005,7 @@ void SpellMgr::LoadSpellTargetPositions()
return;
}
barGoLink bar((int)result->GetRowCount());
BarGoLink bar(result->GetRowCount());
do
{
@ -1274,18 +1274,18 @@ void SpellMgr::LoadSpellProcEvents()
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
QueryResult *result = WorldDatabase.Query("SELECT entry, SchoolMask, SpellFamilyName, SpellFamilyMaskA0, SpellFamilyMaskA1, SpellFamilyMaskA2, SpellFamilyMaskB0, SpellFamilyMaskB1, SpellFamilyMaskB2, SpellFamilyMaskC0, SpellFamilyMaskC1, SpellFamilyMaskC2, procFlags, procEx, ppmRate, CustomChance, Cooldown FROM spell_proc_event");
if( !result )
if (!result)
{
barGoLink bar( 1 );
BarGoLink bar(1);
bar.step();
sLog.outString();
sLog.outString( ">> No spell proc event conditions loaded");
sLog.outString(">> No spell proc event conditions loaded");
return;
}
SpellRankHelper<SpellProcEventEntry, DoSpellProcEvent, SpellProcEventMap> rankHelper(*this, mSpellProcEventMap);
barGoLink bar( (int)result->GetRowCount() );
BarGoLink bar(result->GetRowCount());
do
{
Field *fields = result->Fetch();
@ -1339,19 +1339,19 @@ void SpellMgr::LoadSpellProcItemEnchant()
// 0 1
QueryResult *result = WorldDatabase.Query("SELECT entry, ppmRate FROM spell_proc_item_enchant");
if( !result )
if (!result)
{
barGoLink bar( 1 );
BarGoLink bar(1);
bar.step();
sLog.outString();
sLog.outString( ">> Loaded %u proc item enchant definitions", count );
sLog.outString(">> Loaded %u proc item enchant definitions", count);
return;
}
barGoLink bar( (int)result->GetRowCount() );
BarGoLink bar(result->GetRowCount());
do
{
@ -1409,16 +1409,16 @@ void SpellMgr::LoadSpellBonuses()
uint32 count = 0;
// 0 1 2 3
QueryResult *result = WorldDatabase.Query("SELECT entry, direct_bonus, dot_bonus, ap_bonus, ap_dot_bonus FROM spell_bonus_data");
if( !result )
if (!result)
{
barGoLink bar( 1 );
BarGoLink bar(1);
bar.step();
sLog.outString();
sLog.outString( ">> Loaded %u spell bonus data", count);
sLog.outString(">> Loaded %u spell bonus data", count);
return;
}
barGoLink bar( (int)result->GetRowCount() );
BarGoLink bar(result->GetRowCount());
do
{
Field *fields = result->Fetch();
@ -1628,19 +1628,19 @@ void SpellMgr::LoadSpellElixirs()
// 0 1
QueryResult *result = WorldDatabase.Query("SELECT entry, mask FROM spell_elixir");
if( !result )
if (!result)
{
barGoLink bar( 1 );
BarGoLink bar(1);
bar.step();
sLog.outString();
sLog.outString( ">> Loaded %u spell elixir definitions", count );
sLog.outString(">> Loaded %u spell elixir definitions", count);
return;
}
barGoLink bar( (int)result->GetRowCount() );
BarGoLink bar(result->GetRowCount());
do
{
@ -1730,18 +1730,18 @@ void SpellMgr::LoadSpellThreats()
// 0 1 2 3
QueryResult *result = WorldDatabase.Query("SELECT entry, Threat, multiplier, ap_bonus FROM spell_threat");
if( !result )
if (!result)
{
barGoLink bar( 1 );
BarGoLink bar(1);
bar.step();
sLog.outString();
sLog.outString( ">> No spell threat entries loaded.");
sLog.outString(">> No spell threat entries loaded.");
return;
}
SpellRankHelper<SpellThreatEntry, DoSpellThreat, SpellThreatMap> rankHelper(*this, mSpellThreatMap);
barGoLink bar( (int)result->GetRowCount() );
BarGoLink bar(result->GetRowCount());
do
{
@ -2716,11 +2716,11 @@ void SpellMgr::LoadSpellChains()
QueryResult *result = WorldDatabase.Query("SELECT spell_id, prev_spell, first_spell, rank, req_spell FROM spell_chain");
if (!result)
{
barGoLink bar( 1 );
BarGoLink bar(1);
bar.step();
sLog.outString();
sLog.outString( ">> Loaded 0 spell chain records" );
sLog.outString(">> Loaded 0 spell chain records");
sLog.outErrorDb("`spell_chains` table is empty!");
return;
}
@ -2729,7 +2729,7 @@ void SpellMgr::LoadSpellChains()
uint32 new_count = 0;
uint32 req_count = 0;
barGoLink bar( (int)result->GetRowCount() );
BarGoLink bar(result->GetRowCount());
do
{
bar.step();
@ -2973,23 +2973,23 @@ void SpellMgr::LoadSpellLearnSkills()
// search auto-learned skills and add its to map also for use in unlearn spells/talents
uint32 dbc_count = 0;
barGoLink bar( sSpellStore.GetNumRows() );
for(uint32 spell = 0; spell < sSpellStore.GetNumRows(); ++spell)
BarGoLink bar(sSpellStore.GetNumRows());
for (uint32 spell = 0; spell < sSpellStore.GetNumRows(); ++spell)
{
bar.step();
SpellEntry const* entry = sSpellStore.LookupEntry(spell);
if(!entry)
if (!entry)
continue;
for(int i = 0; i < MAX_EFFECT_INDEX; ++i)
for (int i = 0; i < MAX_EFFECT_INDEX; ++i)
{
if(entry->Effect[i] == SPELL_EFFECT_SKILL)
if (entry->Effect[i] == SPELL_EFFECT_SKILL)
{
SpellLearnSkillNode dbc_node;
dbc_node.skill = entry->EffectMiscValue[i];
dbc_node.step = entry->CalculateSimpleValue(SpellEffectIndex(i));
if ( dbc_node.skill != SKILL_RIDING )
if (dbc_node.skill != SKILL_RIDING)
dbc_node.value = 1;
else
dbc_node.value = dbc_node.step * 75;
@ -3003,7 +3003,7 @@ void SpellMgr::LoadSpellLearnSkills()
}
sLog.outString();
sLog.outString( ">> Loaded %u Spell Learn Skills from DBC", dbc_count );
sLog.outString(">> Loaded %u Spell Learn Skills from DBC", dbc_count);
}
void SpellMgr::LoadSpellLearnSpells()
@ -3014,18 +3014,18 @@ void SpellMgr::LoadSpellLearnSpells()
QueryResult *result = WorldDatabase.Query("SELECT entry, SpellID, Active FROM spell_learn_spell");
if (!result)
{
barGoLink bar( 1 );
BarGoLink bar(1);
bar.step();
sLog.outString();
sLog.outString( ">> Loaded 0 spell learn spells" );
sLog.outString(">> Loaded 0 spell learn spells");
sLog.outErrorDb("`spell_learn_spell` table is empty!");
return;
}
uint32 count = 0;
barGoLink bar( (int)result->GetRowCount() );
BarGoLink bar(result->GetRowCount());
do
{
bar.step();
@ -3059,7 +3059,7 @@ void SpellMgr::LoadSpellLearnSpells()
mSpellLearnSpells.insert(SpellLearnSpellMap::value_type(spell_id,node));
++count;
} while( result->NextRow() );
} while (result->NextRow());
delete result;
@ -3126,7 +3126,7 @@ void SpellMgr::LoadSpellScriptTarget()
if (!result)
{
barGoLink bar(1);
BarGoLink bar(1);
bar.step();
@ -3135,7 +3135,7 @@ void SpellMgr::LoadSpellScriptTarget()
return;
}
barGoLink bar((int)result->GetRowCount());
BarGoLink bar(result->GetRowCount());
do
{
@ -3267,19 +3267,19 @@ void SpellMgr::LoadSpellPetAuras()
// 0 1 2 3
QueryResult *result = WorldDatabase.Query("SELECT spell, effectId, pet, aura FROM spell_pet_auras");
if( !result )
if (!result)
{
barGoLink bar( 1 );
BarGoLink bar(1);
bar.step();
sLog.outString();
sLog.outString( ">> Loaded %u spell pet auras", count );
sLog.outString(">> Loaded %u spell pet auras", count);
return;
}
barGoLink bar( (int)result->GetRowCount() );
BarGoLink bar(result->GetRowCount());
do
{
@ -3612,18 +3612,18 @@ void SpellMgr::LoadSpellAreas()
// 0 1 2 3 4 5 6 7 8
QueryResult *result = WorldDatabase.Query("SELECT spell, area, quest_start, quest_start_active, quest_end, aura_spell, racemask, gender, autocast FROM spell_area");
if( !result )
if (!result)
{
barGoLink bar( 1 );
BarGoLink bar(1);
bar.step();
sLog.outString();
sLog.outString( ">> Loaded %u spell area requirements", count );
sLog.outString(">> Loaded %u spell area requirements", count);
return;
}
barGoLink bar( (int)result->GetRowCount() );
BarGoLink bar(result->GetRowCount());
do
{
@ -3643,7 +3643,7 @@ void SpellMgr::LoadSpellAreas()
spellArea.gender = Gender(fields[7].GetUInt8());
spellArea.autocast = fields[8].GetBool();
if(!sSpellStore.LookupEntry(spell))
if (!sSpellStore.LookupEntry(spell))
{
sLog.outErrorDb("Spell %u listed in `spell_area` does not exist", spell);
continue;
@ -3652,7 +3652,7 @@ void SpellMgr::LoadSpellAreas()
{
bool ok = true;
SpellAreaMapBounds sa_bounds = GetSpellAreaMapBounds(spellArea.spellId);
for(SpellAreaMap::const_iterator itr = sa_bounds.first; itr != sa_bounds.second; ++itr)
for (SpellAreaMap::const_iterator itr = sa_bounds.first; itr != sa_bounds.second; ++itr)
{
if (spellArea.spellId != itr->second.spellId)
continue;
@ -3672,7 +3672,7 @@ void SpellMgr::LoadSpellAreas()
break;
}
if(!ok)
if (!ok)
{
sLog.outErrorDb("Spell %u listed in `spell_area` already listed with similar requirements.", spell);
continue;
@ -3680,43 +3680,43 @@ void SpellMgr::LoadSpellAreas()
}
if(spellArea.areaId && !GetAreaEntryByAreaID(spellArea.areaId))
if (spellArea.areaId && !GetAreaEntryByAreaID(spellArea.areaId))
{
sLog.outErrorDb("Spell %u listed in `spell_area` have wrong area (%u) requirement", spell,spellArea.areaId);
continue;
}
if(spellArea.questStart && !sObjectMgr.GetQuestTemplate(spellArea.questStart))
if (spellArea.questStart && !sObjectMgr.GetQuestTemplate(spellArea.questStart))
{
sLog.outErrorDb("Spell %u listed in `spell_area` have wrong start quest (%u) requirement", spell,spellArea.questStart);
continue;
}
if(spellArea.questEnd)
if (spellArea.questEnd)
{
if(!sObjectMgr.GetQuestTemplate(spellArea.questEnd))
if (!sObjectMgr.GetQuestTemplate(spellArea.questEnd))
{
sLog.outErrorDb("Spell %u listed in `spell_area` have wrong end quest (%u) requirement", spell,spellArea.questEnd);
continue;
}
if(spellArea.questEnd==spellArea.questStart && !spellArea.questStartCanActive)
if (spellArea.questEnd==spellArea.questStart && !spellArea.questStartCanActive)
{
sLog.outErrorDb("Spell %u listed in `spell_area` have quest (%u) requirement for start and end in same time", spell,spellArea.questEnd);
continue;
}
}
if(spellArea.auraSpell)
if (spellArea.auraSpell)
{
SpellEntry const* spellInfo = sSpellStore.LookupEntry(abs(spellArea.auraSpell));
if(!spellInfo)
if (!spellInfo)
{
sLog.outErrorDb("Spell %u listed in `spell_area` have wrong aura spell (%u) requirement", spell,abs(spellArea.auraSpell));
continue;
}
switch(spellInfo->EffectApplyAuraName[EFFECT_INDEX_0])
switch (spellInfo->EffectApplyAuraName[EFFECT_INDEX_0])
{
case SPELL_AURA_DUMMY:
case SPELL_AURA_PHASE:
@ -3727,7 +3727,7 @@ void SpellMgr::LoadSpellAreas()
continue;
}
if(uint32(abs(spellArea.auraSpell))==spellArea.spellId)
if (uint32(abs(spellArea.auraSpell))==spellArea.spellId)
{
sLog.outErrorDb("Spell %u listed in `spell_area` have aura spell (%u) requirement for itself", spell, abs(spellArea.auraSpell));
continue;
@ -3738,7 +3738,7 @@ void SpellMgr::LoadSpellAreas()
{
bool chain = false;
SpellAreaForAuraMapBounds saBound = GetSpellAreaForAuraMapBounds(spellArea.spellId);
for(SpellAreaForAuraMap::const_iterator itr = saBound.first; itr != saBound.second; ++itr)
for (SpellAreaForAuraMap::const_iterator itr = saBound.first; itr != saBound.second; ++itr)
{
if (itr->second->autocast && itr->second->auraSpell > 0)
{
@ -3754,7 +3754,7 @@ void SpellMgr::LoadSpellAreas()
}
SpellAreaMapBounds saBound2 = GetSpellAreaMapBounds(spellArea.auraSpell);
for(SpellAreaMap::const_iterator itr2 = saBound2.first; itr2 != saBound2.second; ++itr2)
for (SpellAreaMap::const_iterator itr2 = saBound2.first; itr2 != saBound2.second; ++itr2)
{
if (itr2->second.autocast && itr2->second.auraSpell > 0)
{
@ -3763,7 +3763,7 @@ void SpellMgr::LoadSpellAreas()
}
}
if(chain)
if (chain)
{
sLog.outErrorDb("Spell %u listed in `spell_area` have aura spell (%u) requirement that itself autocast from aura", spell,spellArea.auraSpell);
continue;
@ -3771,13 +3771,13 @@ void SpellMgr::LoadSpellAreas()
}
}
if(spellArea.raceMask && (spellArea.raceMask & RACEMASK_ALL_PLAYABLE)==0)
if (spellArea.raceMask && (spellArea.raceMask & RACEMASK_ALL_PLAYABLE)==0)
{
sLog.outErrorDb("Spell %u listed in `spell_area` have wrong race mask (%u) requirement", spell,spellArea.raceMask);
continue;
}
if(spellArea.gender!=GENDER_NONE && spellArea.gender!=GENDER_FEMALE && spellArea.gender!=GENDER_MALE)
if (spellArea.gender!=GENDER_NONE && spellArea.gender!=GENDER_FEMALE && spellArea.gender!=GENDER_MALE)
{
sLog.outErrorDb("Spell %u listed in `spell_area` have wrong gender (%u) requirement", spell,spellArea.gender);
continue;
@ -3786,33 +3786,33 @@ void SpellMgr::LoadSpellAreas()
SpellArea const* sa = &mSpellAreaMap.insert(SpellAreaMap::value_type(spell,spellArea))->second;
// for search by current zone/subzone at zone/subzone change
if(spellArea.areaId)
if (spellArea.areaId)
mSpellAreaForAreaMap.insert(SpellAreaForAreaMap::value_type(spellArea.areaId,sa));
// for search at quest start/reward
if(spellArea.questStart)
if (spellArea.questStart)
{
if(spellArea.questStartCanActive)
if (spellArea.questStartCanActive)
mSpellAreaForActiveQuestMap.insert(SpellAreaForQuestMap::value_type(spellArea.questStart,sa));
else
mSpellAreaForQuestMap.insert(SpellAreaForQuestMap::value_type(spellArea.questStart,sa));
}
// for search at quest start/reward
if(spellArea.questEnd)
if (spellArea.questEnd)
mSpellAreaForQuestEndMap.insert(SpellAreaForQuestMap::value_type(spellArea.questEnd,sa));
// for search at aura apply
if(spellArea.auraSpell)
if (spellArea.auraSpell)
mSpellAreaForAuraMap.insert(SpellAreaForAuraMap::value_type(abs(spellArea.auraSpell),sa));
++count;
} while( result->NextRow() );
} while (result->NextRow());
delete result;
sLog.outString();
sLog.outString( ">> Loaded %u spell area requirements", count );
sLog.outString(">> Loaded %u spell area requirements", count);
}
SpellCastResult SpellMgr::GetSpellAllowedInLocationError(SpellEntry const *spellInfo, uint32 map_id, uint32 zone_id, uint32 area_id, Player const* player)
@ -3949,7 +3949,7 @@ void SpellMgr::LoadSkillLineAbilityMap()
{
mSkillLineAbilityMap.clear();
barGoLink bar( (int)sSkillLineAbilityStore.GetNumRows() );
BarGoLink bar(sSkillLineAbilityStore.GetNumRows());
uint32 count = 0;
for (uint32 i = 0; i < sSkillLineAbilityStore.GetNumRows(); ++i)
@ -3971,7 +3971,7 @@ void SpellMgr::LoadSkillRaceClassInfoMap()
{
mSkillRaceClassInfoMap.clear();
barGoLink bar( (int)sSkillRaceClassInfoStore.GetNumRows() );
BarGoLink bar(sSkillRaceClassInfoStore.GetNumRows());
uint32 count = 0;
for (uint32 i = 0; i < sSkillRaceClassInfoStore.GetNumRows(); ++i)
@ -4002,9 +4002,9 @@ void SpellMgr::CheckUsedSpells(char const* table)
// 0 1 2 3 4 5 6 7 8 9 10 11
QueryResult *result = WorldDatabase.PQuery("SELECT spellid,SpellFamilyName,SpellFamilyMaskA,SpellFamilyMaskB,SpellIcon,SpellVisual,SpellCategory,EffectType,EffectAura,EffectIdx,Name,Code FROM %s",table);
if( !result )
if (!result)
{
barGoLink bar( 1 );
BarGoLink bar(1);
bar.step();
@ -4013,7 +4013,7 @@ void SpellMgr::CheckUsedSpells(char const* table)
return;
}
barGoLink bar( (int)result->GetRowCount() );
BarGoLink bar(result->GetRowCount());
do
{