Apply style fix pt4

This commit is contained in:
Antz 2020-01-14 10:26:15 +00:00
parent d93dbd95fe
commit 4727d8846f
87 changed files with 710 additions and 0 deletions

View file

@ -820,7 +820,9 @@ void WorldSession::HandleRequestPvPOptionsEnabledOpcode(WorldPacket& recv_data)
WorldPacket data(SMSG_PVP_OPTIONS_ENABLED, 1);
for (int i = 0; i < 5; ++i)
{
data.WriteBit(true);
}
SendPacket(&data);
}

View file

@ -1434,7 +1434,9 @@ void ChatHandler::ShowAchievementListHelper(AchievementEntry const* achEntry, Lo
criteriaMask[((*itr)->showOrder - 1) / 32] |= (1 << (((*itr)->showOrder - 1) % 32));
for (int i = 0; i < 4; ++i)
{
ss << criteriaMask[i] << ":";
}
}
else
ss << "0:0:0:0:";
@ -3861,7 +3863,9 @@ bool ChatHandler::HandleWpShowCommand(char* args)
PSendSysMessage(" Emote: %u", behaviour->emote);
PSendSysMessage(" Spell: %u", behaviour->spell);
for (int i = 0; i < MAX_WAYPOINT_TEXT; ++i)
{
PSendSysMessage(" TextId%i: %i \'%s\'", i + 1, behaviour->textid[i], (behaviour->textid[i] ? GetMangosString(behaviour->textid[i]) : ""));
}
}
return true;

View file

@ -1402,7 +1402,9 @@ bool ChatHandler::HandleAchievementCommand(char* args)
{
SendSysMessage(LANG_COMMAND_ACHIEVEMENT_CRITERIA);
for (AchievementCriteriaEntryList::const_iterator itr = criteriaList->begin(); itr != criteriaList->end(); ++itr)
{
ShowAchievementCriteriaListHelper(*itr, achEntry, loc, target);
}
}
return true;
@ -1482,7 +1484,9 @@ bool ChatHandler::HandleAchievementRemoveCommand(char* args)
if (AchievementCriteriaEntryList const* criteriaList = sAchievementMgr.GetAchievementCriteriaByAchievement(achEntry->ID))
for (AchievementCriteriaEntryList::const_iterator itr = criteriaList->begin(); itr != criteriaList->end(); ++itr)
{
mgr.SetCriteriaProgress(*itr, achEntry, 0, AchievementMgr::PROGRESS_SET);
}
LocaleConstant loc = GetSessionDbcLocale();
CompletedAchievementData const* completed = target ? target->GetAchievementMgr().GetCompleteData(achId) : NULL;

View file

@ -338,7 +338,9 @@ void ArenaTeam::DelMember(ObjectGuid guid)
player->GetSession()->SendArenaTeamCommandResult(ERR_ARENA_TEAM_QUIT_S, GetName(), "", 0);
// delete all info regarding this team
for (int i = 0; i < ARENA_TEAM_END; ++i)
{
player->SetArenaTeamInfoField(GetSlot(), ArenaTeamInfoType(i), 0);
}
}
CharacterDatabase.PExecute("DELETE FROM arena_team_member WHERE arenateamid = '%u' AND guid = '%u'", GetId(), guid.GetCounter());

View file

@ -1838,7 +1838,9 @@ void Creature::LoadEquipment(uint32 equip_entry, bool force)
m_equipmentId = equip_entry;
for (uint8 i = 0; i < MAX_VIRTUAL_ITEM_SLOT; ++i)
{
SetVirtualItem(VirtualItemSlot(i), einfo->equipentry[i]);
}
}
bool Creature::HasQuest(uint32 quest_id) const

View file

@ -96,7 +96,9 @@ void CreatureEventAIMgr::CheckUnusedAITexts()
}
for (std::set<int32>::const_iterator itr = idx_set.begin(); itr != idx_set.end(); ++itr)
{
sLog.outErrorEventAI("Entry %i in table `creature_ai_texts` but not used in EventAI scripts.", *itr);
}
}
/// Helper function to check if a target-type is suitable for the event-type
@ -229,7 +231,9 @@ void CreatureEventAIMgr::CheckUnusedAISummons()
std::set<int32> idx_set;
// check not used strings this is negative range
for (CreatureEventAI_Summon_Map::const_iterator itr = m_CreatureEventAI_Summon_Map.begin(); itr != m_CreatureEventAI_Summon_Map.end(); ++itr)
{
idx_set.insert(itr->first);
}
for (CreatureEventAI_Event_Map::const_iterator itr = m_CreatureEventAI_Event_Map.begin(); itr != m_CreatureEventAI_Event_Map.end(); ++itr)
{
@ -255,7 +259,9 @@ void CreatureEventAIMgr::CheckUnusedAISummons()
}
for (std::set<int32>::const_iterator itr = idx_set.begin(); itr != idx_set.end(); ++itr)
{
sLog.outErrorEventAI("Entry %i in table `creature_ai_summons` but not used in EventAI scripts.", *itr);
}
}
// -------------------

View file

@ -108,7 +108,9 @@ Guild::Guild()
m_GuildEventLogNextGuid = 0;
m_GuildBankEventLogNextGuid_Money = 0;
for (uint8 i = 0; i < GUILD_BANK_MAX_TABS; ++i)
{
m_GuildBankEventLogNextGuid_Item[i] = 0;
}
}
Guild::~Guild()
@ -245,7 +247,9 @@ bool Guild::AddMember(ObjectGuid plGuid, uint32 plRank)
newmember.LogoutTime = time(NULL);
newmember.BankResetTimeMoney = 0; // this will force update at first query
for (int i = 0; i < GUILD_BANK_MAX_TABS; ++i)
{
newmember.BankResetTimeTab[i] = 0;
}
members[lowguid] = newmember;
std::string dbPnote = newmember.Pnote;
@ -333,7 +337,9 @@ bool Guild::LoadGuildFromDB(QueryResult* guildDataResult)
m_TabListMap.resize(purchasedTabs);
for (uint8 i = 0; i < purchasedTabs; ++i)
{
m_TabListMap[i] = new GuildBankTab;
}
return true;
}
@ -1115,7 +1121,9 @@ void Guild::QueryRanks(WorldSession* session)
data.WriteBits(m_Ranks.size(), 18);
for (uint8 i = 0; i < m_Ranks.size(); ++i)
{
data.WriteBits(m_Ranks[i].Name.length(), 7);
}
for (uint8 i = 0; i < m_Ranks.size(); ++i)
{
@ -1183,7 +1191,9 @@ void Guild::DisplayGuildEventLog(WorldSession* session)
// count, max count == 100
data.WriteBits(m_GuildEventLog.size(), 23);
for (GuildEventLog::iterator itr = m_GuildEventLog.begin(); itr != m_GuildEventLog.end(); ++itr)
{
itr->WriteData(data, buffer);
}
if (!buffer.empty())
{
data.FlushBits();
@ -1378,7 +1388,9 @@ void Guild::DisplayGuildBankContentUpdate(uint8 TabId, GuildItemPosCountVec cons
data.WriteBits(0, 22); // Tell client that there's no tab info in this packet
for (GuildItemPosCountVec::const_iterator itr = slots.begin(); itr != slots.end(); ++itr)
{
AppendDisplayGuildBankSlot(data, buffer, tab, itr->Slot);
}
data << uint64(GetGuildBankMoney());
if (!buffer.empty())
@ -1774,7 +1786,9 @@ void Guild::SetBankRightsAndSlots(uint32 rankId, uint8 TabId, uint32 right, uint
for (MemberList::iterator itr = members.begin(); itr != members.end(); ++itr)
if (itr->second.RankId == rankId)
for (int i = 0; i < GUILD_BANK_MAX_TABS; ++i)
{
itr->second.BankResetTimeTab[i] = 0;
}
CharacterDatabase.PExecute("DELETE FROM guild_bank_right WHERE guildid='%u' AND TabId='%u' AND rid='%u'", m_Id, uint32(TabId), rankId);
CharacterDatabase.PExecute("INSERT INTO guild_bank_right (guildid,TabId,rid,gbright,SlotPerDay) VALUES "
@ -1960,7 +1974,9 @@ void Guild::DisplayGuildBankLogs(WorldSession* session, uint8 TabId)
// Here we display money logs
data.WriteBits(m_GuildBankEventLog_Money.size(), 23);
for (GuildBankEventLog::iterator itr = m_GuildBankEventLog_Money.begin(); itr != m_GuildBankEventLog_Money.end(); ++itr)
{
itr->WriteData(data, buffer);
}
}
else
{
@ -1968,7 +1984,9 @@ void Guild::DisplayGuildBankLogs(WorldSession* session, uint8 TabId)
// number of log entries
data.WriteBits(m_GuildBankEventLog_Item[TabId].size(), 23);
for (GuildBankEventLog::iterator itr = m_GuildBankEventLog_Item[TabId].begin(); itr != m_GuildBankEventLog_Item[TabId].end(); ++itr)
{
itr->WriteData(data, buffer);
}
}
if (!buffer.empty())
{

View file

@ -924,7 +924,9 @@ void Item::SetItemRandomProperties(int32 randomPropId)
SetState(ITEM_CHANGED);
}
for (uint32 i = PROP_ENCHANTMENT_SLOT_1; i < PROP_ENCHANTMENT_SLOT_4; ++i)
{
SetEnchantment(EnchantmentSlot(i), item_rand->enchant_id[i - PROP_ENCHANTMENT_SLOT_1], 0, 0);
}
}
}
else
@ -941,7 +943,9 @@ void Item::SetItemRandomProperties(int32 randomPropId)
}
for (uint32 i = PROP_ENCHANTMENT_SLOT_0; i < PROP_ENCHANTMENT_SLOT_4; ++i)
{
SetEnchantment(EnchantmentSlot(i), item_rand->enchant_id[i - PROP_ENCHANTMENT_SLOT_0], 0, 0);
}
}
}
}
@ -1268,7 +1272,9 @@ void Item::ClearEnchantment(EnchantmentSlot slot)
}
for (uint8 x = 0; x < 3; ++x)
{
SetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot * MAX_ENCHANTMENT_OFFSET + x, 0);
}
SetState(ITEM_CHANGED);
}
@ -1277,7 +1283,9 @@ void Item::SendUpdateSockets()
WorldPacket data(SMSG_SOCKET_GEMS, 8 + 4 + 4 + 4 + 4);
data << GetObjectGuid();
for (uint32 i = SOCK_ENCHANTMENT_SLOT; i <= BONUS_ENCHANTMENT_SLOT; ++i)
{
data << uint32(GetEnchantmentId(EnchantmentSlot(i)));
}
GetOwner()->SendDirectMessage(&data);
}

View file

@ -245,7 +245,9 @@ void LootStore::ReportUnusedIds(LootIdSet const& ids_set) const
if (!ids_set.empty())
{
for (LootIdSet::const_iterator itr = ids_set.begin(); itr != ids_set.end(); ++itr)
{
sLog.outErrorDb("Table '%s' entry %d isn't %s and not referenced from loot, and then useless.", GetName(), *itr, GetEntryName());
}
sLog.outString();
}
}

View file

@ -277,7 +277,9 @@ struct Loot
void clear()
{
for (QuestItemMap::const_iterator itr = m_playerCurrencies.begin(); itr != m_playerCurrencies.end(); ++itr)
{
delete itr->second;
}
m_playerCurrencies.clear();
for (QuestItemMap::const_iterator itr = m_playerQuestItems.begin(); itr != m_playerQuestItems.end(); ++itr)

View file

@ -125,7 +125,9 @@ ObjectAccessor::SaveAllPlayers()
HashMapHolder<Player>::ReadGuard g(HashMapHolder<Player>::GetLock());
HashMapHolder<Player>::MapType& m = sObjectAccessor.GetPlayers();
for (HashMapHolder<Player>::MapType::iterator itr = m.begin(); itr != m.end(); ++itr)
{
itr->second->SaveToDB();
}
}
void ObjectAccessor::KickPlayer(ObjectGuid guid)

View file

@ -199,7 +199,9 @@ ObjectMgr::~ObjectMgr()
{ delete itr->second; }
for (ArenaTeamMap::iterator itr = mArenaTeamMap.begin(); itr != mArenaTeamMap.end(); ++itr)
{
delete itr->second;
}
for (CacheVendorItemMap::iterator itr = m_mCacheVendorTemplateItemMap.begin(); itr != m_mCacheVendorTemplateItemMap.end(); ++itr)
{ itr->second.Clear(); }

View file

@ -320,7 +320,9 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c
Field* fields2 = result->Fetch();
for (int i = 0; i < MAX_DECLINED_NAME_CASES; ++i)
{
m_declinedname->name[i] = fields2[i].GetCppString();
}
delete result;
}
@ -900,7 +902,9 @@ void Pet::InitStatsForLevel(uint32 petlevel)
}
for (int i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i)
{
SetModifierValue(UnitMods(UNIT_MOD_RESISTANCE_START + i), BASE_VALUE, float(createResistance[i]));
}
float health, mana, armor, minDmg;
@ -937,7 +941,9 @@ void Pet::InitStatsForLevel(uint32 petlevel)
if (PetLevelInfo const* pInfo = sObjectMgr.GetPetLevelInfo(1, petlevel))
{
for (int i = STAT_STRENGTH; i < MAX_STATS;++i)
{
SetCreateStat(Stats(i), float(pInfo->stats[i]));
}
health = pInfo->health;
mana = 0;
@ -955,7 +961,9 @@ void Pet::InitStatsForLevel(uint32 petlevel)
sLog.outErrorDb("HUNTER PET levelstats missing in DB! 'Weakifying' pet");
for (int i = STAT_STRENGTH; i < MAX_STATS;++i)
{
SetCreateStat(Stats(i), 1.0f);
}
health = 1;
mana = 0;
@ -1010,7 +1018,9 @@ void Pet::InitStatsForLevel(uint32 petlevel)
if (PetLevelInfo const* pInfo = sObjectMgr.GetPetLevelInfo(cInfo->Entry, petlevel))
{
for (int i = STAT_STRENGTH; i < MAX_STATS;++i)
{
SetCreateStat(Stats(i), float(pInfo->stats[i]));
}
health = pInfo->health;
mana = pInfo->mana;
@ -1045,7 +1055,9 @@ void Pet::InitStatsForLevel(uint32 petlevel)
sLog.outErrorDb("SUMMON_PET levelstats missing in DB! 'Weakifying' pet and giving it mana to make it obvious");
for (int i = STAT_STRENGTH; i < MAX_STATS;++i)
{
SetCreateStat(Stats(i), 1.0f);
}
health = 1;
mana = 1;

View file

@ -149,7 +149,9 @@ void PlayerTaxi::InitTaxiNodesForLevel(uint32 race, uint32 chrClass, uint32 leve
case CLASS_DEATH_KNIGHT:
{
for (int i = 0; i < TaxiMaskSize; ++i)
{
m_taximask[i] |= sOldContinentsNodesMask[i];
}
break;
}
}
@ -568,7 +570,9 @@ Player::Player(WorldSession* session): Unit(), m_mover(this), m_camera(this), m_
m_activeSpec = 0;
m_specsCount = 1;
for (int i = 0; i < MAX_TALENT_SPEC_COUNT; ++i)
{
m_talentsPrimaryTree[i] = 0;
}
for (int i = 0; i < BASEMOD_END; ++i)
{
@ -577,7 +581,9 @@ Player::Player(WorldSession* session): Unit(), m_mover(this), m_camera(this), m_
}
for (int i = 0; i < MAX_COMBAT_RATING; ++i)
{
m_baseRatingValue[i] = 0;
}
m_baseSpellPower = 0;
m_baseHealthRegen = 0;
@ -641,7 +647,9 @@ Player::~Player()
// clean up player-instance binds, may unload some instance saves
for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
for (BoundInstancesMap::iterator itr = m_boundInstances[i].begin(); itr != m_boundInstances[i].end(); ++itr)
{
itr->second.state->RemovePlayer(this);
}
delete m_declinedname;
delete m_runes;
@ -793,7 +801,9 @@ bool Player::Create(uint32 guidlow, const std::string& name, uint8 race, uint8 c
// original action bar
for (PlayerCreateInfoActions::const_iterator action_itr = info->action.begin(); action_itr != info->action.end(); ++action_itr)
{
addActionButton(0, action_itr->button, action_itr->action, action_itr->type);
}
// original items
uint32 raceClassGender = GetUInt32Value(UNIT_FIELD_BYTES_0) & 0x00FFFFFF;
@ -2375,7 +2385,9 @@ void Player::RegenerateHealth(uint32 diff)
AuraList const& mModHealthRegenPct = GetAurasByType(SPELL_AURA_MOD_HEALTH_REGEN_PERCENT);
for (AuraList::const_iterator i = mModHealthRegenPct.begin(); i != mModHealthRegenPct.end(); ++i)
{
addvalue *= (100.0f + (*i)->GetModifier()->m_amount) / 100.0f;
}
addvalue += GetTotalAuraModifier(SPELL_AURA_MOD_REGEN) * 2.0f / 5.0f;
}
@ -2732,14 +2744,18 @@ void Player::GiveXP(uint32 xp, Unit* victim)
// handle SPELL_AURA_MOD_KILL_XP_PCT auras
Unit::AuraList const& ModXPPctAuras = GetAurasByType(SPELL_AURA_MOD_KILL_XP_PCT);
for (Unit::AuraList::const_iterator i = ModXPPctAuras.begin(); i != ModXPPctAuras.end(); ++i)
{
xp = uint32(xp * (1.0f + (*i)->GetModifier()->m_amount / 100.0f));
}
}
else
{
// handle SPELL_AURA_MOD_QUEST_XP_PCT auras
Unit::AuraList const& ModXPPctAuras = GetAurasByType(SPELL_AURA_MOD_QUEST_XP_PCT);
for (Unit::AuraList::const_iterator i = ModXPPctAuras.begin(); i != ModXPPctAuras.end(); ++i)
{
xp = uint32(xp * (1.0f + (*i)->GetModifier()->m_amount / 100.0f));
}
}
// XP resting bonus for kill
@ -2792,7 +2808,9 @@ void Player::GiveLevel(uint32 level)
data << uint32(0);
// end for
for (int i = STAT_STRENGTH; i < MAX_STATS; ++i) // Stats loop (0-4)
{
data << uint32(int32(info.stats[i]) - GetCreateStat(Stats(i)));
}
GetSession()->SendPacket(&data);
@ -2809,7 +2827,9 @@ void Player::GiveLevel(uint32 level)
// save base values (bonuses already included in stored stats
for (int i = STAT_STRENGTH; i < MAX_STATS; ++i)
{
SetCreateStat(Stats(i), info.stats[i]);
}
SetCreateHealth(basehp);
SetCreateMana(basemana);
@ -2919,10 +2939,14 @@ void Player::InitStatsForLevel(bool reapplyMods)
// save base values (bonuses already included in stored stats
for (int i = STAT_STRENGTH; i < MAX_STATS; ++i)
{
SetCreateStat(Stats(i), info.stats[i]);
}
for (int i = STAT_STRENGTH; i < MAX_STATS; ++i)
{
SetStat(Stats(i), info.stats[i]);
}
SetCreateHealth(basehp);
@ -2935,7 +2959,9 @@ void Player::InitStatsForLevel(bool reapplyMods)
// reset rating fields values
for (uint16 index = PLAYER_FIELD_COMBAT_RATING_1; index < PLAYER_FIELD_COMBAT_RATING_1 + MAX_COMBAT_RATING; ++index)
{
SetUInt32Value(index, 0);
}
SetUInt32Value(PLAYER_FIELD_MOD_HEALING_DONE_POS, 0);
SetFloatValue(PLAYER_FIELD_MOD_HEALING_PCT, 1.0f);
@ -2978,7 +3004,9 @@ void Player::InitStatsForLevel(bool reapplyMods)
// Init spell schools (will be recalculated in UpdateAllStats() at loading and in _ApplyAllStatBonuses() at reset
for (uint8 i = 0; i < MAX_SPELL_SCHOOL; ++i)
{
SetFloatValue(PLAYER_SPELL_CRIT_PERCENTAGE1 + i, 0.0f);
}
SetFloatValue(PLAYER_PARRY_PERCENTAGE, 0.0f);
SetFloatValue(PLAYER_BLOCK_PERCENTAGE, 0.0f);
@ -3008,13 +3036,17 @@ void Player::InitStatsForLevel(bool reapplyMods)
}
// Reset no reagent cost field
for (int i = 0; i < 3; ++i)
{
SetUInt32Value(PLAYER_NO_REAGENT_COST_1 + i, 0);
}
// Init data for form but skip reapply item mods for form
InitDataForForm(reapplyMods);
// save new stats
for (int i = POWER_MANA; i < MAX_POWERS; ++i)
{
SetMaxPower(Powers(i), GetCreateMaxPowers(Powers(i)));
}
SetMaxHealth(basehp); // stamina bonus will applied later
@ -3783,7 +3815,9 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool learn_low_rank, bo
SpellLearnSpellMapBounds spell_bounds = sSpellMgr.GetSpellLearnSpellMapBounds(spell_id);
for (SpellLearnSpellMap::const_iterator itr2 = spell_bounds.first; itr2 != spell_bounds.second; ++itr2)
{
removeSpell(itr2->second.spell, disabled);
}
// activate lesser rank in spellbook/action bar, and cast it if need
bool prev_activate = false;
@ -3923,7 +3957,9 @@ void Player::RemoveAllSpellCooldown()
data.WriteGuidBytes<7, 2, 4, 5, 1, 3>(guid);
for (SpellCooldowns::const_iterator itr = m_spellCooldowns.begin(); itr != m_spellCooldowns.end(); ++itr)
{
data << uint32(itr->first);
}
data.WriteGuidBytes<0, 6>(guid);
@ -4111,11 +4147,15 @@ bool Player::resetTalents(bool no_cost, bool all_specs)
{
if (std::vector<uint32> const* specSpells = GetTalentTreeMasterySpells(GetTalentTabPages(getClass())[i]))
for (size_t i = 0; i < specSpells->size(); ++i)
{
removeSpell(specSpells->at(i), true);
}
if (std::vector<uint32> const* specSpells = GetTalentTreePrimarySpells(GetTalentTabPages(getClass())[i]))
for (size_t i = 0; i < specSpells->size(); ++i)
{
removeSpell(specSpells->at(i), true);
}
}
for (uint8 spec = 0; spec < MAX_TALENT_SPEC_COUNT; ++spec)
@ -4298,7 +4338,9 @@ void Player::InitVisibleBits()
// PLAYER_QUEST_LOG_x also visible bit on official (but only on party/raid)...
for (uint16 i = PLAYER_QUEST_LOG_1_1; i < PLAYER_QUEST_LOG_25_2; i += MAX_QUEST_OFFSET)
{
updateVisualBits.SetBit(i);
}
// Players visible items are not inventory stuff
for (uint16 i = 0; i < EQUIPMENT_SLOT_END; ++i)
@ -5119,14 +5161,18 @@ uint32 Player::DurabilityRepairAll(bool cost, float discountMod, bool guildBank)
uint32 TotalCost = 0;
// equipped, backpack, bags itself
for (int i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_ITEM_END; ++i)
{
TotalCost += DurabilityRepair(((INVENTORY_SLOT_BAG_0 << 8) | i), cost, discountMod, guildBank);
}
// bank, buyback and keys not repaired
// items in inventory bags
for (int j = INVENTORY_SLOT_BAG_START; j < INVENTORY_SLOT_BAG_END; ++j)
for (int i = 0; i < MAX_BAG_SIZE; ++i)
{
TotalCost += DurabilityRepair(((j << 8) | i), cost, discountMod, guildBank);
}
return TotalCost;
}
@ -5742,7 +5788,9 @@ void Player::UpdateRating(CombatRating cr)
void Player::UpdateAllRatings()
{
for (int cr = 0; cr < MAX_COMBAT_RATING; ++cr)
{
UpdateRating(CombatRating(cr));
}
}
void Player::SetRegularAttackTime()
@ -7484,7 +7532,9 @@ void Player::DuelComplete(DuelCompleteType type)
}
for (size_t i = 0; i < auras2remove.size(); ++i)
{
duel->opponent->RemoveAurasDueToSpell(auras2remove[i]);
}
auras2remove.clear();
SpellAuraHolderMap const& auras = GetSpellAuraHolderMap();
@ -7494,7 +7544,9 @@ void Player::DuelComplete(DuelCompleteType type)
auras2remove.push_back(i->second->GetId());
}
for (size_t i = 0; i < auras2remove.size(); ++i)
{
RemoveAurasDueToSpell(auras2remove[i]);
}
// cleanup combo points
if (GetComboTargetGuid() == duel->opponent->GetObjectGuid())
@ -7808,15 +7860,21 @@ void Player::_ApplyWeaponDependentAuraMods(Item* item, WeaponAttackType attackTy
{
AuraList const& auraCritList = GetAurasByType(SPELL_AURA_MOD_CRIT_PERCENT);
for (AuraList::const_iterator itr = auraCritList.begin(); itr != auraCritList.end(); ++itr)
{
_ApplyWeaponDependentAuraCritMod(item, attackType, *itr, apply);
}
AuraList const& auraDamageFlatList = GetAurasByType(SPELL_AURA_MOD_DAMAGE_DONE);
for (AuraList::const_iterator itr = auraDamageFlatList.begin(); itr != auraDamageFlatList.end(); ++itr)
{
_ApplyWeaponDependentAuraDamageMod(item, attackType, *itr, apply);
}
AuraList const& auraDamagePCTList = GetAurasByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE);
for (AuraList::const_iterator itr = auraDamagePCTList.begin(); itr != auraDamagePCTList.end(); ++itr)
{
_ApplyWeaponDependentAuraDamageMod(item, attackType, *itr, apply);
}
}
void Player::_ApplyWeaponDependentAuraCritMod(Item* item, WeaponAttackType attackType, Aura* aura, bool apply)
@ -11382,7 +11440,9 @@ Item* Player::StoreNewItem(ItemPosCountVec const& dest, uint32 item, bool update
{
uint32 count = 0;
for (ItemPosCountVec::const_iterator itr = dest.begin(); itr != dest.end(); ++itr)
{
count += itr->count;
}
Item* pItem = Item::CreateItem(item, count, this, randomPropertyId);
if (pItem)
@ -11868,7 +11928,9 @@ void Player::DestroyItem(uint8 bag, uint8 slot, bool update)
if (pItem->IsBag() && pItem->IsEquipped()) // this also prevent infinity loop if empty bag stored in bag==slot
{
for (int i = 0; i < MAX_BAG_SIZE; ++i)
{
DestroyItem(slot, i, update);
}
}
if (pItem->HasFlag(ITEM_FIELD_FLAGS, ITEM_DYNFLAG_WRAPPED))
@ -12920,7 +12982,9 @@ void Player::AddEnchantmentDuration(Item* item, EnchantmentSlot slot, uint32 dur
void Player::ApplyEnchantment(Item* item, bool apply)
{
for (uint32 slot = 0; slot < MAX_ENCHANTMENT_SLOT; ++slot)
{
ApplyEnchantment(item, EnchantmentSlot(slot), apply);
}
}
void Player::ApplyEnchantment(Item* item, EnchantmentSlot slot, bool apply, bool apply_dur, bool ignore_condition)
@ -14508,13 +14572,17 @@ void Player::AddQuest(Quest const* pQuest, Object* questGiver)
if (pQuest->HasSpecialFlag(QUEST_SPECIAL_FLAG_DELIVER))
{
for (int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
{
questStatusData.m_itemcount[i] = 0;
}
}
if (pQuest->HasSpecialFlag(QuestSpecialFlags(QUEST_SPECIAL_FLAG_KILL_OR_CAST | QUEST_SPECIAL_FLAG_SPEAKTO)))
{
for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
{
questStatusData.m_creatureOrGOcount[i] = 0;
}
}
if (pQuest->GetRepObjectiveFaction())
@ -14596,16 +14664,22 @@ void Player::AddQuest(Quest const* pQuest, Object* questGiver)
GetZoneAndAreaId(zone, area);
SpellAreaForAreaMapBounds saBounds = sSpellMgr.GetSpellAreaForAreaMapBounds(zone);
for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr)
{
itr->second->ApplyOrRemoveSpellIfCan(this, zone, area, true);
}
if (area != zone)
{
saBounds = sSpellMgr.GetSpellAreaForAreaMapBounds(area);
for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr)
{
itr->second->ApplyOrRemoveSpellIfCan(this, zone, area, true);
}
}
saBounds = sSpellMgr.GetSpellAreaForAreaMapBounds(0);
for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr)
{
itr->second->ApplyOrRemoveSpellIfCan(this, zone, area, true);
}
UpdateForQuestWorldObjects();
}
@ -14808,16 +14882,22 @@ void Player::RewardQuest(Quest const* pQuest, uint32 reward, Object* questGiver,
GetZoneAndAreaId(zone, area);
SpellAreaForAreaMapBounds saBounds = sSpellMgr.GetSpellAreaForAreaMapBounds(zone);
for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr)
{
itr->second->ApplyOrRemoveSpellIfCan(this, zone, area, false);
}
if (area != zone)
{
saBounds = sSpellMgr.GetSpellAreaForAreaMapBounds(area);
for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr)
{
itr->second->ApplyOrRemoveSpellIfCan(this, zone, area, false);
}
}
saBounds = sSpellMgr.GetSpellAreaForAreaMapBounds(0);
for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr)
{
itr->second->ApplyOrRemoveSpellIfCan(this, zone, area, false);
}
// resend quests status directly
SendQuestGiverStatusMultiple();
@ -15336,7 +15416,9 @@ void Player::GiveQuestSourceItemIfNeed(Quest const* pQuest)
{
uint32 count = 0;
for (ItemPosCountVec::const_iterator c_itr = dest.begin(); c_itr != dest.end(); ++c_itr)
{
count += c_itr->count;
}
Item* item = StoreNewItem(dest, pQuest->GetSrcItemId(), true);
SendNewItem(item, count, true, false);
@ -16253,7 +16335,9 @@ void Player::_LoadDeclinedNames(QueryResult* result)
Field* fields = result->Fetch();
for (int i = 0; i < MAX_DECLINED_NAME_CASES; ++i)
{
m_declinedname->name[i] = fields[i].GetCppString();
}
delete result;
}
@ -16320,7 +16404,9 @@ void Player::_LoadEquipmentSets(QueryResult* result)
eqSet.state = EQUIPMENT_SET_UNCHANGED;
for (uint32 i = 0; i < EQUIPMENT_SLOT_END; ++i)
{
eqSet.Items[i] = fields[5 + i].GetUInt32();
}
m_EquipmentSets[index] = eqSet;
@ -16545,7 +16631,9 @@ bool Player::LoadFromDB(ObjectGuid guid, SqlQueryHolder* holder)
// arena team not exist or not member, cleanup fields
for (int j = 0; j < ARENA_TEAM_END; ++j)
{
SetArenaTeamInfoField(arena_slot, ArenaTeamInfoType(j), 0);
}
}
SetUInt32Value(PLAYER_FIELD_LIFETIME_HONORBALE_KILLS, fields[40].GetUInt32());
@ -16871,7 +16959,9 @@ bool Player::LoadFromDB(ObjectGuid guid, SqlQueryHolder* holder)
{
m_taxi.ClearTaxiDestinations();
for (int i = 0; i < 2; ++i)
{
m_taxi.AddTaxiDestination(m_bgData.taxiPath[i]);
}
}
else if (!m_taxi.LoadTaxiDestinationsFromString(taxi_nodes, GetTeam()))
{
@ -17088,7 +17178,9 @@ bool Player::isAllowedToLoot(Creature* creature)
void Player::_LoadActions(QueryResult* result)
{
for (int i = 0; i < MAX_TALENT_SPEC_COUNT; ++i)
{
m_actionButtons[i].clear();
}
// QueryResult *result = CharacterDatabase.PQuery("SELECT spec, button,action,type FROM character_action WHERE guid = '%u' ORDER BY button",GetGUIDLow());
@ -17704,13 +17796,17 @@ void Player::_LoadQuestStatus(QueryResult* result)
// clear quest log tail
for (uint16 i = slot; i < MAX_QUEST_LOG_SIZE; ++i)
{
SetQuestSlot(i, 0);
}
}
void Player::_LoadDailyQuestStatus(QueryResult* result)
{
for (uint32 quest_daily_idx = 0; quest_daily_idx < PLAYER_MAX_DAILY_QUESTS; ++quest_daily_idx)
{
SetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1 + quest_daily_idx, 0);
}
// QueryResult *result = CharacterDatabase.PQuery("SELECT quest FROM character_queststatus_daily WHERE guid = '%u'", GetGUIDLow());
@ -17938,7 +18034,9 @@ void Player::_LoadGroup(QueryResult* result)
void Player::_LoadBoundInstances(QueryResult* result)
{
for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
{
m_boundInstances[i].clear();
}
Group* group = GetGroup();
@ -18399,7 +18497,9 @@ void Player::SaveToDB()
uberInsert.addUInt64(uint64(m_resetTalentsTime));
ss.str("");
for (int i = 0; i < MAX_TALENT_SPEC_COUNT; ++i)
{
ss << m_talentsPrimaryTree[i] << " ";
}
uberInsert.addString(ss);
uberInsert.addFloat(finiteAlways(m_movementInfo.GetTransportPos()->x));
@ -18440,7 +18540,9 @@ void Player::SaveToDB()
uberInsert.addUInt32(GetHealth());
for (uint32 i = 0; i < MAX_STORED_POWERS; ++i)
{
uberInsert.addUInt32(GetPowerByIndex(i));
}
uberInsert.addUInt32(uint32(m_specsCount));
uberInsert.addUInt32(uint32(m_activeSpec));
@ -18635,10 +18737,14 @@ void Player::_SaveAuras()
stmt.addUInt8(holder->GetAuraCharges());
for (uint32 i = 0; i < MAX_EFFECT_INDEX; ++i)
{
stmt.addInt32(damage[i]);
}
for (uint32 i = 0; i < MAX_EFFECT_INDEX; ++i)
{
stmt.addUInt32(periodicTime[i]);
}
stmt.addInt32(holder->GetAuraMaxDuration());
stmt.addInt32(holder->GetAuraDuration());
@ -18823,7 +18929,9 @@ void Player::_SaveMail()
stmt = CharacterDatabase.CreateStatement(deleteMailItems, "DELETE FROM mail_items WHERE item_guid = ?");
for (std::vector<uint32>::const_iterator itr2 = m->removedItems.begin(); itr2 != m->removedItems.end(); ++itr2)
{
stmt.PExecute(*itr2);
}
m->removedItems.clear();
}
@ -18835,7 +18943,9 @@ void Player::_SaveMail()
{
SqlStatement stmt = CharacterDatabase.CreateStatement(deleteItem, "DELETE FROM item_instance WHERE guid = ?");
for (MailItemInfoVec::const_iterator itr2 = m->items.begin(); itr2 != m->items.end(); ++itr2)
{
stmt.PExecute(itr2->item_guid);
}
}
SqlStatement stmt = CharacterDatabase.CreateStatement(deleteMain, "DELETE FROM mail WHERE id = ?");
@ -18886,9 +18996,13 @@ void Player::_SaveQuestStatus()
stmt.addUInt8(i->second.m_explored);
stmt.addUInt64(uint64(i->second.m_timer / IN_MILLISECONDS + sWorld.GetGameTime()));
for (int k = 0; k < QUEST_OBJECTIVES_COUNT; ++k)
{
stmt.addUInt32(i->second.m_creatureOrGOcount[k]);
}
for (int k = 0; k < QUEST_ITEM_OBJECTIVES_COUNT; ++k)
{
stmt.addUInt32(i->second.m_itemcount[k]);
}
stmt.Execute();
}
break;
@ -18902,9 +19016,13 @@ void Player::_SaveQuestStatus()
stmt.addUInt8(i->second.m_explored);
stmt.addUInt64(uint64(i->second.m_timer / IN_MILLISECONDS + sWorld.GetGameTime()));
for (int k = 0; k < QUEST_OBJECTIVES_COUNT; ++k)
{
stmt.addUInt32(i->second.m_creatureOrGOcount[k]);
}
for (int k = 0; k < QUEST_ITEM_OBJECTIVES_COUNT; ++k)
{
stmt.addUInt32(i->second.m_itemcount[k]);
}
stmt.addUInt32(GetGUIDLow());
stmt.addUInt32(i->first);
stmt.Execute();
@ -19130,7 +19248,9 @@ void Player::_SaveStats()
stmt.addUInt32(GetGUIDLow());
stmt.addUInt32(GetMaxHealth());
for (uint32 i = 0; i < MAX_STORED_POWERS; ++i)
{
stmt.addUInt32(GetMaxPowerByIndex(i));
}
for (int i = 0; i < MAX_STATS; ++i)
{ stmt.addFloat(GetStat(Stats(i))); }
// armor + school resistances
@ -21888,7 +22008,9 @@ void Player::SendAurasForTarget(Unit* target)
data << target->GetPackGUID();
for (Unit::VisibleAuraMap::const_iterator itr = visibleAuras.begin(); itr != visibleAuras.end(); ++itr)
{
itr->second->BuildUpdatePacket(data);
}
GetSession()->SendPacket(&data);
}
@ -21921,7 +22043,9 @@ void Player::SetMonthlyQuestStatus(uint32 quest_id)
void Player::ResetDailyQuestStatus()
{
for (uint32 quest_daily_idx = 0; quest_daily_idx < PLAYER_MAX_DAILY_QUESTS; ++quest_daily_idx)
{
SetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1 + quest_daily_idx, 0);
}
// DB data deleted in caller
m_DailyQuestChanged = false;
@ -22576,7 +22700,9 @@ void Player::UpdateZoneDependentAuras()
// Some spells applied at enter into zone (with subzones), aura removed in UpdateAreaDependentAuras that called always at zone->area update
SpellAreaForAreaMapBounds saBounds = sSpellMgr.GetSpellAreaForAreaMapBounds(m_zoneUpdateId);
for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr)
{
itr->second->ApplyOrRemoveSpellIfCan(this, m_zoneUpdateId, 0, true);
}
}
void Player::UpdateAreaDependentAuras()
@ -22597,7 +22723,9 @@ void Player::UpdateAreaDependentAuras()
// some auras applied at subzone enter
SpellAreaForAreaMapBounds saBounds = sSpellMgr.GetSpellAreaForAreaMapBounds(m_areaUpdateId);
for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr)
{
itr->second->ApplyOrRemoveSpellIfCan(this, m_zoneUpdateId, m_areaUpdateId, true);
}
}
struct UpdateZoneDependentPetsHelper
@ -23069,7 +23197,9 @@ void Player::ApplyGlyph(uint8 slot, bool apply)
void Player::ApplyGlyphs(bool apply)
{
for (uint8 i = 0; i < MAX_GLYPH_SLOT_INDEX; ++i)
{
ApplyGlyph(i, apply);
}
}
bool Player::isTotalImmune()
@ -23189,7 +23319,9 @@ void Player::UpdateRuneRegen(RuneType rune)
void Player::UpdateRuneRegen()
{
for (uint8 i = 0; i < NUM_RUNE_TYPES; ++i)
{
UpdateRuneRegen(RuneType(i));
}
}
uint8 Player::GetRuneCooldownFraction(uint8 index) const
@ -23326,7 +23458,9 @@ void Player::InitRunes()
}
for (uint32 i = 0; i < NUM_RUNE_TYPES; ++i)
{
SetFloatValue(PLAYER_RUNE_REGEN_1 + i, 0.1f);
}
}
bool Player::IsBaseRuneSlotsOnCooldown(RuneType runeType) const
@ -23961,11 +24095,15 @@ bool Player::LearnTalent(uint32 talentId, uint32 talentRank)
m_talentsPrimaryTree[m_activeSpec] = talentInfo->TalentTab;
if (std::vector<uint32> const* specSpells = GetTalentTreeMasterySpells(talentInfo->TalentTab))
for (size_t i = 0; i < specSpells->size(); ++i)
{
learnSpell(specSpells->at(i), false);
}
if (std::vector<uint32> const* specSpells = GetTalentTreePrimarySpells(talentInfo->TalentTab))
for (size_t i = 0; i < specSpells->size(); ++i)
{
learnSpell(specSpells->at(i), false);
}
// Update talent tree role-dependent mana regen
UpdateManaRegen();
@ -24261,7 +24399,9 @@ void Player::BuildPlayerTalentsInfoData(WorldPacket* data)
// GlyphProperties.dbc
for (uint8 i = 0; i < MAX_GLYPH_SLOT_INDEX; ++i)
{
*data << uint16(m_glyphs[specIdx][i].GetId());
}
}
}
}
@ -24494,7 +24634,9 @@ void Player::_SaveEquipmentSets()
stmt.addUInt32(eqset.IgnoreMask);
for (int i = 0; i < EQUIPMENT_SLOT_END; ++i)
{
stmt.addUInt32(eqset.Items[i]);
}
stmt.addUInt32(GetGUIDLow());
stmt.addUInt64(eqset.Guid);
@ -24517,7 +24659,9 @@ void Player::_SaveEquipmentSets()
stmt.addUInt32(eqset.IgnoreMask);
for (int i = 0; i < EQUIPMENT_SLOT_END; ++i)
{
stmt.addUInt32(eqset.Items[i]);
}
stmt.Execute();
@ -24610,11 +24754,15 @@ void Player::ActivateSpec(uint8 specNum)
{
if (std::vector<uint32> const* specSpells = GetTalentTreeMasterySpells(GetTalentTabPages(getClass())[i]))
for (size_t i = 0; i < specSpells->size(); ++i)
{
removeSpell(specSpells->at(i), true);
}
if (std::vector<uint32> const* specSpells = GetTalentTreePrimarySpells(GetTalentTabPages(getClass())[i]))
for (size_t i = 0; i < specSpells->size(); ++i)
{
removeSpell(specSpells->at(i), true);
}
}
ApplyGlyphs(false);
@ -24721,11 +24869,15 @@ void Player::ActivateSpec(uint8 specNum)
if (std::vector<uint32> const* specSpells = GetTalentTreeMasterySpells(m_talentsPrimaryTree[m_activeSpec]))
for (size_t i = 0; i < specSpells->size(); ++i)
{
learnSpell(specSpells->at(i), false);
}
if (std::vector<uint32> const* specSpells = GetTalentTreePrimarySpells(m_talentsPrimaryTree[m_activeSpec]))
for (size_t i = 0; i < specSpells->size(); ++i)
{
learnSpell(specSpells->at(i), false);
}
ApplyGlyphs(true);
@ -24769,7 +24921,9 @@ void Player::UpdateSpecCount(uint8 count)
if (itr->second.uState != ACTIONBUTTON_DELETED)
{
for (uint8 spec = curCount; spec < count; ++spec)
{
addActionButton(spec, itr->first, itr->second.GetAction(), itr->second.GetType());
}
}
}
}
@ -24781,7 +24935,9 @@ void Player::UpdateSpecCount(uint8 count)
{
// delete action buttons for removed spec
for (uint8 button = 0; button < MAX_ACTION_BUTTONS; ++button)
{
removeActionButton(spec, button);
}
}
}
@ -25485,7 +25641,9 @@ void Player::SendRatedBGStats()
WorldPacket data(SMSG_RATED_BG_STATS, 18 * 4);
for (int i = 0; i < 18; ++i)
{
data << uint32(0);
}
SendDirectMessage(&data);
}

View file

@ -708,7 +708,9 @@ struct EquipmentSet
EquipmentSet() : Guid(0), IgnoreMask(0), state(EQUIPMENT_SET_NEW)
{
for (int i = 0; i < EQUIPMENT_SLOT_END; ++i)
{
Items[i] = 0;
}
}
uint64 Guid;

View file

@ -302,7 +302,9 @@ uint32 GetSpellCastTimeForBonus(SpellEntry const* spellProto, DamageEffectType d
// -5% of total per any additional effect (multiplicative)
for (int i = 0; i < effects; ++i)
{
CastingTime *= 0.95f;
}
return CastingTime;
}
@ -4120,7 +4122,9 @@ void SpellMgr::LoadPetDefaultSpells()
int32 petSpellsId = -(int32)cInfo->PetSpellDataId;
PetDefaultSpellsEntry petDefSpells;
for (int j = 0; j < MAX_CREATURE_SPELL_DATA_SLOT; ++j)
{
petDefSpells.spellid[j] = spellDataEntry->spellId[j];
}
if (LoadPetDefaultSpells_helper(cInfo, petDefSpells))
{
@ -4161,7 +4165,9 @@ void SpellMgr::LoadPetDefaultSpells()
PetDefaultSpellsEntry petDefSpells;
if (CreatureTemplateSpells const* templateSpells = sCreatureTemplateSpellsStorage.LookupEntry<CreatureTemplateSpells>(cInfo->Entry))
for (int j = 0; j < MAX_CREATURE_SPELL_DATA_SLOT; ++j)
{
petDefSpells.spellid[j] = templateSpells->spells[j];
}
if (LoadPetDefaultSpells_helper(cInfo, petDefSpells))
{

View file

@ -107,7 +107,9 @@ void Player::ApplySpellPowerBonus(int32 amount, bool apply)
// For speed just update for client
ApplyModUInt32Value(PLAYER_FIELD_MOD_HEALING_DONE_POS, amount, apply);
for (int i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i)
{
ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + i, amount, apply);;
}
}
void Player::UpdateSpellDamageAndHealingBonus()
@ -118,7 +120,9 @@ void Player::UpdateSpellDamageAndHealingBonus()
SetStatInt32Value(PLAYER_FIELD_MOD_HEALING_DONE_POS, SpellBaseHealingBonusDone(SPELL_SCHOOL_MASK_ALL));
// Get damage bonus for all schools
for (int i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i)
{
SetStatInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + i, SpellBaseDamageBonusDone(SpellSchoolMask(1 << i)));
}
SetStatFloatValue(PLAYER_FIELD_OVERRIDE_SPELL_POWER_BY_AP_PCT, GetTotalAuraModifier(SPELL_AURA_OVERRIDE_SPELL_POWER_BY_AP_PCT));
}

View file

@ -4402,7 +4402,9 @@ int32 Unit::GetTotalAuraModifier(AuraType auratype) const
AuraList const& mTotalAuraList = GetAurasByType(auratype);
for (AuraList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
{
modifier += (*i)->GetModifier()->m_amount;
}
return modifier;
}
@ -4413,7 +4415,9 @@ float Unit::GetTotalAuraMultiplier(AuraType auratype) const
AuraList const& mTotalAuraList = GetAurasByType(auratype);
for (AuraList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i)
{
multiplier *= (100.0f + (*i)->GetModifier()->m_amount) / 100.0f;
}
return multiplier;
}
@ -8059,7 +8063,9 @@ uint32 Unit::SpellHealingBonusDone(Unit* pVictim, SpellEntry const* spellProto,
// Healing done percent
AuraList const& mHealingDonePct = GetAurasByType(SPELL_AURA_MOD_HEALING_DONE_PERCENT);
for (AuraList::const_iterator i = mHealingDonePct.begin(); i != mHealingDonePct.end(); ++i)
{
DoneTotalMod *= (100.0f + (*i)->GetModifier()->m_amount) / 100.0f;
}
AuraList const& mHealingFromHealthPct = GetAurasByType(SPELL_AURA_MOD_HEALING_DONE_FROM_PCT_HEALTH);
if (!mHealingFromHealthPct.empty())
@ -11348,28 +11354,38 @@ CharmInfo::CharmInfo(Unit* unit)
: m_unit(unit), m_CommandState(COMMAND_FOLLOW), m_reactState(REACT_PASSIVE), m_petnumber(0)
{
for (int i = 0; i < CREATURE_MAX_SPELLS; ++i)
{
m_charmspells[i].SetActionAndType(0, ACT_DISABLED);
}
}
void CharmInfo::InitPetActionBar()
{
// the first 3 SpellOrActions are attack, follow and stay
for (uint32 i = 0; i < ACTION_BAR_INDEX_PET_SPELL_START - ACTION_BAR_INDEX_START; ++i)
{
SetActionBar(ACTION_BAR_INDEX_START + i, COMMAND_ATTACK - i, ACT_COMMAND);
}
// middle 4 SpellOrActions are spells/special attacks/abilities
for (uint32 i = 0; i < ACTION_BAR_INDEX_PET_SPELL_END - ACTION_BAR_INDEX_PET_SPELL_START; ++i)
{
SetActionBar(ACTION_BAR_INDEX_PET_SPELL_START + i, 0, ACT_DISABLED);
}
// last 3 SpellOrActions are reactions
for (uint32 i = 0; i < ACTION_BAR_INDEX_END - ACTION_BAR_INDEX_PET_SPELL_END; ++i)
{
SetActionBar(ACTION_BAR_INDEX_PET_SPELL_END + i, COMMAND_ATTACK - i, ACT_REACTION);
}
}
void CharmInfo::InitEmptyActionBar()
{
for (uint32 x = ACTION_BAR_INDEX_START; x < ACTION_BAR_INDEX_END; ++x)
{
SetActionBar(x, 0, ACT_PASSIVE);
}
}
void CharmInfo::InitVehicleCreateSpells()
@ -11560,7 +11576,9 @@ void CharmInfo::LoadPetActionBar(const std::string& data)
void CharmInfo::BuildActionBar(WorldPacket* data)
{
for (uint32 i = 0; i < MAX_UNIT_ACTION_BAR_INDEX; ++i)
{
*data << uint32(PetActionBar[i].packedData);
}
}
void CharmInfo::SetSpellAutocast(uint32 spell_id, bool state)
@ -11810,7 +11828,9 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* pTarget, uint32 procFlag,
removedSpells.unique();
// Remove auras from removedAuras
for (RemoveSpellList::const_iterator i = removedSpells.begin(); i != removedSpells.end(); ++i)
{
RemoveAurasDueToSpell(*i);
}
}
}
@ -12134,7 +12154,9 @@ void Unit::ClearComboPointHolders()
void Unit::ClearAllReactives()
{
for (int i = 0; i < MAX_REACTIVE; ++i)
{
m_reactiveTimer[i] = 0;
}
if (HasAuraState(AURA_STATE_DEFENSE))
ModifyAuraState(AURA_STATE_DEFENSE, false);
@ -12218,7 +12240,9 @@ Unit* Unit::SelectRandomUnfriendlyTarget(Unit* except /*= NULL*/, float radius /
uint32 rIdx = urand(0, targets.size() - 1);
std::list<Unit*>::const_iterator tcIter = targets.begin();
for (uint32 i = 0; i < rIdx; ++i)
{
++tcIter;
}
return *tcIter;
}
@ -12259,7 +12283,9 @@ Unit* Unit::SelectRandomFriendlyTarget(Unit* except /*= NULL*/, float radius /*=
uint32 rIdx = urand(0, targets.size() - 1);
std::list<Unit*>::const_iterator tcIter = targets.begin();
for (uint32 i = 0; i < rIdx; ++i)
{
++tcIter;
}
return *tcIter;
}
@ -12722,12 +12748,16 @@ bool Unit::IsIgnoreUnitState(SpellEntry const* spell, IgnoreUnitState ignoreStat
void Unit::CleanupDeletedAuras()
{
for (SpellAuraHolderList::const_iterator iter = m_deletedHolders.begin(); iter != m_deletedHolders.end(); ++iter)
{
delete *iter;
}
m_deletedHolders.clear();
// really delete auras "deleted" while processing its ApplyModify code
for (AuraList::const_iterator itr = m_deletedAuras.begin(); itr != m_deletedAuras.end(); ++itr)
{
delete *itr;
}
m_deletedAuras.clear();
}

View file

@ -88,14 +88,18 @@ class UpdateMask
{
MANGOS_ASSERT(mask.mCount <= mCount);
for (uint32 i = 0; i < mBlocks; ++i)
{
mUpdateMask[i] &= mask.mUpdateMask[i];
}
}
void operator |= (const UpdateMask& mask)
{
MANGOS_ASSERT(mask.mCount <= mCount);
for (uint32 i = 0; i < mBlocks; ++i)
{
mUpdateMask[i] |= mask.mUpdateMask[i];
}
}
UpdateMask operator & (const UpdateMask& mask) const

View file

@ -527,7 +527,9 @@ uint8 VehicleInfo::GetTakenSeatsMask() const
uint8 takenSeatsMask = 0;
for (PassengerMap::const_iterator itr = m_passengers.begin(); itr != m_passengers.end(); ++itr)
{
takenSeatsMask |= 1 << itr->second->GetTransportSeat();
}
return takenSeatsMask;
}

View file

@ -39,7 +39,9 @@ OutdoorPvPHP::OutdoorPvPHP() : OutdoorPvP(),
m_towerWorldState[2] = WORLD_STATE_HP_BROKEN_HILL_NEUTRAL;
for (uint8 i = 0; i < MAX_HP_TOWERS; ++i)
{
m_towerOwner[i] = TEAM_NONE;
}
}
void OutdoorPvPHP::FillInitialWorldStates(WorldPacket& data, uint32& count)
@ -50,7 +52,9 @@ void OutdoorPvPHP::FillInitialWorldStates(WorldPacket& data, uint32& count)
FillInitialWorldState(data, count, WORLD_STATE_HP_TOWER_DISPLAY_H, WORLD_STATE_ADD);
for (uint8 i = 0; i < MAX_HP_TOWERS; ++i)
{
FillInitialWorldState(data, count, m_towerWorldState[i], WORLD_STATE_ADD);
}
}
void OutdoorPvPHP::SendRemoveWorldStates(Player* player)
@ -59,7 +63,9 @@ void OutdoorPvPHP::SendRemoveWorldStates(Player* player)
player->SendUpdateWorldState(WORLD_STATE_HP_TOWER_DISPLAY_H, WORLD_STATE_REMOVE);
for (uint8 i = 0; i < MAX_HP_TOWERS; ++i)
{
player->SendUpdateWorldState(m_towerWorldState[i], WORLD_STATE_REMOVE);
}
}
void OutdoorPvPHP::HandlePlayerEnterZone(Player* player, bool isMainZone)

View file

@ -51,7 +51,9 @@ void OutdoorPvPNA::FillInitialWorldStates(WorldPacket& data, uint32& count)
// map states
for (uint8 i = 0; i < MAX_NA_ROOSTS; ++i)
{
FillInitialWorldState(data, count, m_roostWorldState[i], WORLD_STATE_ADD);
}
}
FillInitialWorldState(data, count, m_zoneMapState, WORLD_STATE_ADD);
@ -65,7 +67,9 @@ void OutdoorPvPNA::SendRemoveWorldStates(Player* player)
player->SendUpdateWorldState(m_zoneMapState, WORLD_STATE_REMOVE);
for (uint8 i = 0; i < MAX_NA_ROOSTS; ++i)
{
player->SendUpdateWorldState(m_roostWorldState[i], WORLD_STATE_REMOVE);
}
}
void OutdoorPvPNA::HandlePlayerEnterZone(Player* player, bool isMainZone)
@ -299,7 +303,9 @@ void OutdoorPvPNA::UpdateWorldState(uint32 value)
void OutdoorPvPNA::UpdateWyvernsWorldState(uint32 value)
{
for (uint8 i = 0; i < MAX_NA_ROOSTS; ++i)
{
SendUpdateWorldState(m_roostWorldState[i], value);
}
}
// process the capture events

View file

@ -46,7 +46,9 @@ OutdoorPvPTF::OutdoorPvPTF() : OutdoorPvP(),
m_towerWorldState[4] = WORLD_STATE_TF_SOUTH_TOWER_NEUTRAL;
for (uint8 i = 0; i < MAX_TF_TOWERS; ++i)
{
m_towerOwner[i] = TEAM_NONE;
}
}
void OutdoorPvPTF::FillInitialWorldStates(WorldPacket& data, uint32& count)
@ -58,7 +60,9 @@ void OutdoorPvPTF::FillInitialWorldStates(WorldPacket& data, uint32& count)
FillInitialWorldState(data, count, WORLD_STATE_TF_TOWER_COUNT_A, m_towersAlliance);
for (uint8 i = 0; i < MAX_TF_TOWERS; ++i)
{
FillInitialWorldState(data, count, m_towerWorldState[i], WORLD_STATE_ADD);
}
}
else
UpdateTimerWorldState();
@ -69,7 +73,9 @@ void OutdoorPvPTF::SendRemoveWorldStates(Player* player)
player->SendUpdateWorldState(m_zoneWorldState, WORLD_STATE_REMOVE);
for (uint8 i = 0; i < MAX_TF_TOWERS; ++i)
{
player->SendUpdateWorldState(m_towerWorldState[i], WORLD_STATE_REMOVE);
}
}
void OutdoorPvPTF::HandlePlayerEnterZone(Player* player, bool isMainZone)
@ -258,7 +264,9 @@ void OutdoorPvPTF::LockZone(GameObject* go, uint32 towerId, Team team, uint32 ne
// remove tower states when zone has been captured and locked
for (uint8 i = 0; i < MAX_TF_TOWERS; ++i)
{
SendUpdateWorldState(m_towerWorldState[i], WORLD_STATE_REMOVE);
}
m_towerWorldState[towerId] = newWorldState;
}
@ -283,7 +291,9 @@ void OutdoorPvPTF::UnlockZone()
m_towerWorldState[3] = WORLD_STATE_TF_SOUTH_EAST_TOWER_NEUTRAL;
m_towerWorldState[4] = WORLD_STATE_TF_SOUTH_TOWER_NEUTRAL;
for (uint8 i = 0; i < MAX_TF_TOWERS; ++i)
{
SendUpdateWorldState(m_towerWorldState[i], WORLD_STATE_ADD);
}
// update tower count
m_towersAlliance = 0;

View file

@ -46,7 +46,9 @@ OutdoorPvPZM::OutdoorPvPZM() : OutdoorPvP(),
m_towerMapState[1] = WORLD_STATE_ZM_BEACON_WEST_NEUTRAL;
for (uint8 i = 0; i < MAX_ZM_TOWERS; ++i)
{
m_towerOwner[i] = TEAM_NONE;
}
// initially set graveyard owner to neither faction
sObjectMgr.SetGraveYardLinkTeam(GRAVEYARD_ID_TWIN_SPIRE, GRAVEYARD_ZONE_TWIN_SPIRE, TEAM_INVALID);

View file

@ -123,7 +123,9 @@ void LoadDB2Stores(const std::string& dataPath)
{
std::string str;
for (StoreProblemList1::iterator i = bad_db2_files.begin(); i != bad_db2_files.end(); ++i)
{
str += *i + "\n";
}
sLog.outError("Some required *.db2 files (%u from %d) not found or not compatible:\n%s",(uint32)bad_db2_files.size(), DB2FileCount, str.c_str());
exit(1);

View file

@ -496,9 +496,13 @@ void LoadDBCStores(const std::string& dataPath)
for (uint32 i = 0; i < MAX_CLASSES; ++i)
{
for (uint32 j = 0; j < MAX_POWERS; ++j)
{
sChrClassXPowerTypesStore[i][j] = INVALID_POWER_INDEX;
}
for (uint32 j = 0; j < MAX_STORED_POWERS; ++j)
{
sChrClassXPowerIndexStore[i][j] = INVALID_POWER;
}
}
for (uint32 i = 0; i < sChrPowerTypesStore.GetNumRows(); ++i)
{
@ -787,7 +791,9 @@ void LoadDBCStores(const std::string& dataPath)
// Set path length
sTaxiPathNodesByPath.resize(pathCount); // 0 and some other indexes not used
for (uint32 i = 1; i < sTaxiPathNodesByPath.size(); ++i)
{
sTaxiPathNodesByPath[i].resize(pathLength[i]);
}
// fill data (pointers to sTaxiPathNodeStore elements
for (uint32 i = 1; i < sTaxiPathNodeStore.GetNumRows(); ++i)
if (TaxiPathNodeEntry const* entry = sTaxiPathNodeStore.LookupEntry(i))
@ -887,7 +893,9 @@ void LoadDBCStores(const std::string& dataPath)
{
std::string str;
for (std::list<std::string>::iterator i = bad_dbc_files.begin(); i != bad_dbc_files.end(); ++i)
{
str += *i + "\n";
}
sLog.outError("\nSome required *.dbc files (%u from %d) not found or not compatible:\n%s", (uint32)bad_dbc_files.size(), DBCFilesCount, str.c_str());
Log::WaitBeforeContinueIfNeed();

View file

@ -45,7 +45,9 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES];
void InitializeOpcodes()
{
for (uint16 i = 0; i < NUM_MSG_TYPES; ++i)
{
DefineOpcode(i, "UNKNOWN", STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_NULL);
}
OPCODE(MSG_WOW_CONNECTION, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_EarlyProccess );
OPCODE(SMSG_AUTH_CHALLENGE, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );

View file

@ -790,13 +790,17 @@ void WorldSession::SendSetPhaseShift(std::set<uint32> const& phaseIds, std::set<
data << uint32(phaseIds.size() * 2); // Phase.dbc ids
for (std::set<uint32>::const_iterator itr = phaseIds.begin(); itr != phaseIds.end(); ++itr)
{
data << uint16(*itr);
}
data.WriteGuidBytes<3, 0>(guid);
data << uint32(terrainswaps.size() * 2); // Active terrain swaps
for (std::set<uint32>::const_iterator itr = terrainswaps.begin(); itr != terrainswaps.end(); ++itr)
{
data << uint16(*itr);
}
data.WriteGuidBytes<5>(guid);
SendPacket(&data);

View file

@ -279,7 +279,9 @@ int WorldSocket::open(void* a)
// Send startup packet.
WorldPacket packet (SMSG_AUTH_CHALLENGE, 37);
for (uint32 i = 0; i < 8; i++)
{
packet << uint32(0);
}
packet << m_Seed;
packet << uint8(1);

View file

@ -198,7 +198,9 @@ uint32 Warden::BuildChecksum(const uint8* data, uint32 length)
SHA1(data, length, hash.bytes.bytes);
uint32 checkSum = 0;
for (uint8 i = 0; i < 5; ++i)
{
checkSum = checkSum ^ hash.ints.ints[i];
}
return checkSum;
}

View file

@ -37,10 +37,14 @@ WardenCheckMgr::WardenCheckMgr() { }
WardenCheckMgr::~WardenCheckMgr()
{
for (uint16 i = 0; i < CheckStore.size(); ++i)
{
delete CheckStore[i];
}
for (CheckResultContainer::iterator itr = CheckResultStore.begin(); itr != CheckResultStore.end(); ++itr)
{
delete itr->second;
}
}
void WardenCheckMgr::LoadWardenChecks()

View file

@ -306,7 +306,9 @@ void WardenWin::RequestData()
std::stringstream stream;
stream << "Sent check id's: ";
for (std::list<uint16>::iterator itr = _currentChecks.begin(); itr != _currentChecks.end(); ++itr)
{
stream << *itr << " ";
}
sLog.outWarden("%s", stream.str().c_str());
}

View file

@ -267,7 +267,9 @@ bool AccountMgr::normalizeString(std::string& utf8str)
}
for (uint32 i = 0; i <= wstr_len; ++i)
{
wstr_buf[i] = wcharToUpperOnlyLatin(wstr_buf[i]);
}
return WStrToUtf8(wstr_buf, wstr_len, utf8str);
}

View file

@ -709,7 +709,9 @@ void AchievementMgr::CheckAllAchievementCriteria()
{
// suppress sending packets
for (uint32 i = 0; i < ACHIEVEMENT_CRITERIA_TYPE_TOTAL; ++i)
{
UpdateAchievementCriteria(AchievementCriteriaTypes(i));
}
}
static const uint32 achievIdByArenaSlot[MAX_ARENA_SLOT] = { 1057, 1107, 1108 };

View file

@ -680,7 +680,9 @@ void WorldSession::HandleAuctionListItems(WorldPacket& recv_data)
auctions.reserve(aucs.size());
for (AuctionHouseObject::AuctionEntryMap::const_iterator itr = aucs.begin(); itr != aucs.end(); ++itr)
{
auctions.push_back(itr->second);
}
AuctionSorter sorter(Sort, GetPlayer());
std::sort(auctions.begin(), auctions.end(), sorter);
@ -733,7 +735,9 @@ void WorldSession::HandleAuctionListPendingSales(WorldPacket& recv_data)
// pending list include all auction house entries for character
for (int i = 0; i < MAX_AUCTION_HOUSE_TYPE; ++i)
{
sAuctionMgr.GetAuctionsMap(AuctionHouseType(i))->BuildListPendingSales(data, _player, count);
}
data.put<uint32>(0, count);
SendPacket(&data);

View file

@ -35,9 +35,13 @@ ChannelMgr* channelMgr(Team team)
return &MaNGOS::Singleton<AllianceChannelMgr>::Instance(); // cross-faction
if (team == ALLIANCE)
{
return &MaNGOS::Singleton<AllianceChannelMgr>::Instance();
}
if (team == HORDE)
{
return &MaNGOS::Singleton<HordeChannelMgr>::Instance();
}
return NULL;
}
@ -45,7 +49,9 @@ ChannelMgr* channelMgr(Team team)
ChannelMgr::~ChannelMgr()
{
for (ChannelMap::iterator itr = channels.begin(); itr != channels.end(); ++itr)
{
delete itr->second;
}
channels.clear();
}
@ -86,7 +92,9 @@ Channel* ChannelMgr::GetChannel(const std::string& name, Player* p, bool pkt)
return NULL;
}
else
{
return i->second;
}
}
void ChannelMgr::LeftChannel(const std::string& name)
@ -98,7 +106,9 @@ void ChannelMgr::LeftChannel(const std::string& name)
ChannelMap::const_iterator i = channels.find(wname);
if (i == channels.end())
{
return;
}
Channel* channel = i->second;

View file

@ -985,13 +985,17 @@ void WorldSession::HandleTutorialFlagOpcode(WorldPacket& recv_data)
void WorldSession::HandleTutorialClearOpcode(WorldPacket & /*recv_data*/)
{
for (int i = 0; i < 8; ++i)
{
SetTutorialInt(i, 0xFFFFFFFF);
}
}
void WorldSession::HandleTutorialResetOpcode(WorldPacket & /*recv_data*/)
{
for (int i = 0; i < 8; ++i)
{
SetTutorialInt(i, 0x00000000);
}
}
void WorldSession::HandleSetWatchedFactionOpcode(WorldPacket& recv_data)
@ -1177,7 +1181,9 @@ void WorldSession::HandleSetPlayerDeclinedNamesOpcode(WorldPacket& recv_data)
}
for (int i = 0; i < MAX_DECLINED_NAME_CASES; ++i)
{
CharacterDatabase.escape_string(declinedname.name[i]);
}
CharacterDatabase.BeginTransaction();
CharacterDatabase.PExecute("DELETE FROM character_declinedname WHERE guid = '%u'", guid.GetCounter());

View file

@ -461,12 +461,16 @@ void CreatureLinkingHolder::DoCreatureLinkingEvent(CreatureLinkingEvent eventTyp
// Process Slaves (by entry)
HolderMapBounds bounds = m_holderMap.equal_range(pSource->GetEntry());
for (HolderMap::iterator itr = bounds.first; itr != bounds.second; ++itr)
{
ProcessSlaveGuidList(eventType, pSource, itr->second.linkingFlag & eventFlagFilter, itr->second.searchRange, itr->second.linkedGuids, pEnemy);
}
// Process Slaves (by guid)
bounds = m_holderGuidMap.equal_range(pSource->GetGUIDLow());
for (HolderMap::iterator itr = bounds.first; itr != bounds.second; ++itr)
{
ProcessSlaveGuidList(eventType, pSource, itr->second.linkingFlag & eventFlagFilter, itr->second.searchRange, itr->second.linkedGuids, pEnemy);
}
// Process Master
if (CreatureLinkingInfo const* pInfo = sCreatureLinkingMgr.GetLinkedTriggerInformation(pSource))

View file

@ -48,7 +48,9 @@ void LoadDisables()
{
// reload case
for (DisableMap::iterator itr = m_DisableMap.begin(); itr != m_DisableMap.end(); ++itr)
{
itr->second.clear();
}
m_DisableMap.clear();

View file

@ -630,7 +630,9 @@ void GameEventMgr::Initialize(MapPersistentState* state)
// other data is global and will be auto-apply
for (GameEventMgr::ActiveEvents::const_iterator event_itr = m_ActiveEvents.begin(); event_itr != m_ActiveEvents.end(); ++event_itr)
for (IdList::iterator pool_itr = mGameEventSpawnPoolIds[*event_itr].begin(); pool_itr != mGameEventSpawnPoolIds[*event_itr].end(); ++pool_itr)
{
sPoolMgr.InitSpawnPool(*state, *pool_itr);
}
}
// return the next event delay in ms
@ -796,7 +798,9 @@ void GameEventMgr::GameEventSpawn(int16 event_id)
}
for (IdList::iterator itr = mGameEventSpawnPoolIds[event_id].begin(); itr != mGameEventSpawnPoolIds[event_id].end(); ++itr)
{
sPoolMgr.SpawnPoolInMaps(*itr, true);
}
}
}

View file

@ -494,9 +494,13 @@ void PlayerMenu::SendQuestGiverQuestDetails(Quest const* pQuest, ObjectGuid guid
data << pQuest->GetRewChoiceItemsCount();
for (uint32 i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
{
data << pQuest->RewChoiceItemId[i];
}
for (uint32 i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
{
data << pQuest->RewChoiceItemCount[i];
}
for (uint32 i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
if (ItemPrototype const* IProto = ObjectMgr::GetItemPrototype(pQuest->RewChoiceItemId[i]))
data << IProto->DisplayInfoID;
@ -506,9 +510,13 @@ void PlayerMenu::SendQuestGiverQuestDetails(Quest const* pQuest, ObjectGuid guid
data << pQuest->GetRewItemsCount();
for (uint32 i = 0; i < QUEST_REWARDS_COUNT; ++i)
{
data << pQuest->RewItemId[i];
}
for (uint32 i = 0; i < QUEST_REWARDS_COUNT; ++i)
{
data << pQuest->RewItemCount[i];
}
for (uint32 i = 0; i < QUEST_REWARDS_COUNT; ++i)
if (ItemPrototype const* IProto = ObjectMgr::GetItemPrototype(pQuest->RewItemId[i]))
data << IProto->DisplayInfoID;
@ -534,7 +542,9 @@ void PlayerMenu::SendQuestGiverQuestDetails(Quest const* pQuest, ObjectGuid guid
data << pQuest->RewRepFaction[i];
for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // columnid in QuestFactionReward.dbc (if negative, from second row)
{
data << pQuest->RewRepValueId[i];
}
for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // reward reputation override. No bonus is expected given
data << int32(0);
@ -544,10 +554,14 @@ void PlayerMenu::SendQuestGiverQuestDetails(Quest const* pQuest, ObjectGuid guid
data << pQuest->GetRewSpellCast(); // casted spell
for (uint32 i = 0; i < QUEST_REWARD_CURRENCY_COUNT; ++i)
{
data << pQuest->RewCurrencyId[i];
}
for (uint32 i = 0; i < QUEST_REWARD_CURRENCY_COUNT; ++i)
{
data << pQuest->RewCurrencyCount[i];
}
data << pQuest->GetRewSkill();
data << pQuest->GetRewSkillValue();
@ -583,7 +597,9 @@ void PlayerMenu::SendQuestQueryResponse(Quest const* pQuest)
PortraitTurnInText = pQuest->GetPortraitTurnInText();
for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
{
ObjectiveText[i] = pQuest->ObjectiveText[i];
}
int loc_idx = GetMenuSession()->GetSessionDbLocaleIndex();
if (loc_idx >= 0)
@ -671,9 +687,13 @@ void PlayerMenu::SendQuestQueryResponse(Quest const* pQuest)
/*if (pQuest->HasQuestFlag(QUEST_FLAGS_HIDDEN_REWARDS))
{
for (iI = 0; iI < QUEST_REWARDS_COUNT; ++iI)
{
data << uint32(0) << uint32(0);
}
for (iI = 0; iI < QUEST_REWARD_CHOICES_COUNT; ++iI)
{
data << uint32(0) << uint32(0);
}
}
else*/
{
@ -693,7 +713,9 @@ void PlayerMenu::SendQuestQueryResponse(Quest const* pQuest)
data << uint32(pQuest->RewRepFaction[i]);
for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // columnid in QuestFactionReward.dbc (if negative, from second row)
{
data << int32(pQuest->RewRepValueId[i]);
}
for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // reward reputation override. No bonus is expected given
data << int32(0);
@ -735,7 +757,9 @@ void PlayerMenu::SendQuestQueryResponse(Quest const* pQuest)
data << uint32(pQuest->GetReqSpellLearned());
for (iI = 0; iI < QUEST_OBJECTIVES_COUNT; ++iI)
{
data << ObjectiveText[iI];
}
for(iI = 0; iI < QUEST_REWARD_CURRENCY_COUNT; ++iI)
{
@ -825,9 +849,13 @@ void PlayerMenu::SendQuestGiverOfferReward(Quest const* pQuest, ObjectGuid npcGU
data << uint32(pQuest->GetRewChoiceItemsCount());
for (uint32 i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
{
data << uint32(pQuest->RewChoiceItemId[i]);
}
for (uint32 i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
{
data << uint32(pQuest->RewChoiceItemCount[i]);
}
for (uint32 i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
if (ItemPrototype const* pItem = ObjectMgr::GetItemPrototype(pQuest->RewChoiceItemId[i]))
data << uint32(pItem->DisplayInfoID);
@ -836,9 +864,13 @@ void PlayerMenu::SendQuestGiverOfferReward(Quest const* pQuest, ObjectGuid npcGU
data << uint32(pQuest->GetRewItemsCount());
for (uint32 i = 0; i < QUEST_REWARDS_COUNT; ++i)
{
data << uint32(pQuest->RewItemId[i]);
}
for (uint32 i = 0; i < QUEST_REWARDS_COUNT; ++i)
{
data << uint32(pQuest->RewItemCount[i]);
}
for (uint32 i = 0; i < QUEST_REWARDS_COUNT; ++i)
if (ItemPrototype const* pItem = ObjectMgr::GetItemPrototype(pQuest->RewItemId[i]))
data << uint32(pItem->DisplayInfoID);
@ -865,7 +897,9 @@ void PlayerMenu::SendQuestGiverOfferReward(Quest const* pQuest, ObjectGuid npcGU
data << uint32(pQuest->RewRepFaction[i]);
for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // columnid in QuestFactionReward.dbc (if negative, from second row)
{
data << int32(pQuest->RewRepValueId[i]);
}
for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i) // reward reputation override. No diplomacy bonus is expected given, reward also does not display in chat window
data << int32(0);
@ -875,10 +909,14 @@ void PlayerMenu::SendQuestGiverOfferReward(Quest const* pQuest, ObjectGuid npcGU
data << uint32(pQuest->GetRewSpellCast()); // casted spell
for (uint32 i = 0; i < QUEST_REWARD_CURRENCY_COUNT; ++i)
{
data << uint32(pQuest->RewCurrencyId[i]);
}
for (uint32 i = 0; i < QUEST_REWARD_CURRENCY_COUNT; ++i)
{
data << uint32(pQuest->RewCurrencyCount[i]);
}
data << uint32(pQuest->GetRewSkill());
data << uint32(pQuest->GetRewSkillValue());

View file

@ -761,7 +761,9 @@ TerrainInfo::~TerrainInfo()
{
for (int k = 0; k < MAX_NUMBER_OF_GRIDS; ++k)
for (int i = 0; i < MAX_NUMBER_OF_GRIDS; ++i)
{
delete m_GridMaps[i][k];
}
VMAP::VMapFactory::createOrGetVMapManager()->unloadMap(m_mapId);
MMAP::MMapFactory::createOrGetMMapManager()->unloadMap(m_mapId);
@ -1329,7 +1331,9 @@ TerrainManager::TerrainManager()
TerrainManager::~TerrainManager()
{
for (TerrainDataMap::iterator it = i_TerrainMap.begin(); it != i_TerrainMap.end(); ++it)
{
delete it->second;
}
}
TerrainInfo* TerrainManager::LoadTerrain(const uint32 mapId)
@ -1375,13 +1379,17 @@ void TerrainManager::Update(const uint32 diff)
{
// global garbage collection for GridMap objects and VMaps
for (TerrainDataMap::iterator iter = i_TerrainMap.begin(); iter != i_TerrainMap.end(); ++iter)
{
iter->second->CleanUpGrids(diff);
}
}
void TerrainManager::UnloadAll()
{
for (TerrainDataMap::iterator it = i_TerrainMap.begin(); it != i_TerrainMap.end(); ++it)
{
delete it->second;
}
i_TerrainMap.clear();
}

View file

@ -1329,7 +1329,9 @@ namespace MaNGOS
~LocalizedPacketDo()
{
for (size_t i = 0; i < i_data_cache.size(); ++i)
{
delete i_data_cache[i];
}
}
void operator()(Player* p);
@ -1350,7 +1352,9 @@ namespace MaNGOS
{
for (size_t i = 0; i < i_data_cache.size(); ++i)
for (size_t j = 0; j < i_data_cache[i].size(); ++j)
{
delete i_data_cache[i][j];
}
}
void operator()(Player* p);

View file

@ -227,14 +227,18 @@ template<>
inline void MaNGOS::DynamicObjectUpdater::Visit(CreatureMapType& m)
{
for (CreatureMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
{
VisitHelper(itr->getSource());
}
}
template<>
inline void MaNGOS::DynamicObjectUpdater::Visit(PlayerMapType& m)
{
for (PlayerMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
{
VisitHelper(itr->getSource());
}
}
// SEARCHERS & LIST SEARCHERS & WORKERS
@ -736,7 +740,9 @@ void MaNGOS::LocalizedPacketListDo<Builder>::operator()(Player* p)
data_list = &i_data_cache[cache_idx];
for (size_t i = 0; i < data_list->size(); ++i)
{
p->SendDirectMessage((*data_list)[i]);
}
}
#endif // MANGOS_GRIDNOTIFIERSIMPL_H

View file

@ -120,7 +120,9 @@ Group::~Group()
// this may unload some dungeon persistent state
for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
for (BoundInstancesMap::iterator itr2 = m_boundInstances[i].begin(); itr2 != m_boundInstances[i].end(); ++itr2)
{
itr2->second.state->RemoveGroup(this);
}
// Sub group counters clean up
delete[] m_subGroupsCounts;
@ -226,7 +228,9 @@ bool Group::LoadGroupFromDB(Field* fields)
m_lootThreshold = ItemQualities(fields[4].GetUInt16());
for (int i = 0; i < TARGET_ICON_COUNT; ++i)
{
m_targetIcons[i] = ObjectGuid(fields[5 + i].GetUInt64());
}
return true;
}
@ -320,7 +324,9 @@ uint32 Group::RemoveInvite(Player* player)
void Group::RemoveAllInvites()
{
for (InvitesList::iterator itr = m_invitees.begin(); itr != m_invitees.end(); ++itr)
{
(*itr)->SetGroupInvite(NULL);
}
m_invitees.clear();
}
@ -1311,7 +1317,9 @@ bool Group::_addMember(ObjectGuid guid, const char* name, bool isAssistant, uint
if (!isRaidGroup()) // reset targetIcons for non-raid-groups
{
for (int i = 0; i < TARGET_ICON_COUNT; ++i)
{
m_targetIcons[i].Clear();
}
}
if (!isBGGroup())

View file

@ -437,7 +437,9 @@ class Group
memset((void*)m_subGroupsCounts, 0, MAX_RAID_SUBGROUPS * sizeof(uint8));
for (member_citerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr)
{
++m_subGroupsCounts[itr->group];
}
}
member_citerator _getMemberCSlot(ObjectGuid guid) const

View file

@ -857,7 +857,9 @@ void WorldSession::HandleGuildRankOpcode(WorldPacket& recvPacket)
DEBUG_LOG("WORLD: Changed RankName to %s , Rights to 0x%.4X", rankname.c_str(), rights);
for (int i = 0; i < GUILD_BANK_MAX_TABS; ++i)
{
guild->SetBankRightsAndSlots(rankId, uint8(i), uint16(BankRights[i] & 0xFF), uint16(BankSlotPerDay[i]), true);
}
guild->SetBankMoneyPerDay(rankId, MoneyPerDay);
guild->SetRankName(rankId, rankname);

View file

@ -40,7 +40,9 @@ GuildMgr::GuildMgr()
GuildMgr::~GuildMgr()
{
for (GuildMap::iterator itr = m_GuildMap.begin(); itr != m_GuildMap.end(); ++itr)
{
delete itr->second;
}
}
void GuildMgr::AddGuild(Guild* guild)

View file

@ -698,7 +698,9 @@ void WorldSession::SendListInventory(ObjectGuid vendorguid)
data.WriteGuidMask<3, 6, 5, 2, 7>(vendorguid);
for (uint32 i = 0; i < bitFlags.size(); ++i)
{
data.WriteBit(bitFlags[i]);
}
data.WriteGuidMask<4>(vendorguid);
data.FlushBits();
@ -1064,7 +1066,9 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data)
}
for (int i = 0; i < MAX_GEM_SOCKETS; ++i)
{
recv_data >> gemGuids[i];
}
// cheat -> tried to socket same gem multiple times
for (int i = 0; i < MAX_GEM_SOCKETS; ++i)
@ -1102,7 +1106,9 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data)
Item* Gems[MAX_GEM_SOCKETS];
for (int i = 0; i < MAX_GEM_SOCKETS; ++i)
{
Gems[i] = gemGuids[i] ? _player->GetItemByGuid(gemGuids[i]) : NULL;
}
GemPropertiesEntry const* GemProps[MAX_GEM_SOCKETS];
for (int i = 0; i < MAX_GEM_SOCKETS; ++i) // get geminfo from dbc storage
@ -1252,7 +1258,9 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data)
// remove ALL enchants
for (uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT + MAX_GEM_SOCKETS; ++enchant_slot)
{
_player->ApplyEnchantment(itemTarget, EnchantmentSlot(enchant_slot), false);
}
for (int i = 0; i < MAX_GEM_SOCKETS; ++i)
{
@ -1266,7 +1274,9 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data)
}
for (uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT + MAX_GEM_SOCKETS; ++enchant_slot)
{
_player->ApplyEnchantment(itemTarget, EnchantmentSlot(enchant_slot), true);
}
bool SocketBonusToBeActivated = itemTarget->GemsFitSockets();// current socketbonus state
if (SocketBonusActivated != SocketBonusToBeActivated) // if there was a change...
@ -1443,16 +1453,24 @@ void WorldSession::SendItemSparseDb2Reply(uint32 entry)
buff << uint32(proto->ContainerSlots);
for (uint32 x = 0; x < MAX_ITEM_PROTO_STATS; ++x)
{
buff << uint32(proto->ItemStat[x].ItemStatType);
}
for (uint32 x = 0; x < MAX_ITEM_PROTO_STATS; ++x)
{
buff << int32(proto->ItemStat[x].ItemStatValue);
}
for (uint32 x = 0; x < MAX_ITEM_PROTO_STATS; ++x)
{
buff << int32(proto->ItemStat[x].ItemStatType2);
}
for (uint32 x = 0; x < MAX_ITEM_PROTO_STATS; ++x)
{
buff << int32(proto->ItemStat[x].ItemStatValue2);
}
buff << uint32(proto->ScalingStatDistribution);
buff << uint32(proto->DamageType);
@ -1460,22 +1478,34 @@ void WorldSession::SendItemSparseDb2Reply(uint32 entry)
buff << float(proto->RangedModRange);
for (uint32 x = 0; x < MAX_ITEM_PROTO_SPELLS; ++x)
{
buff << int32(proto->Spells[x].SpellId);
}
for (uint32 x = 0; x < MAX_ITEM_PROTO_SPELLS; ++x)
{
buff << uint32(proto->Spells[x].SpellTrigger);
}
for (uint32 x = 0; x < MAX_ITEM_PROTO_SPELLS; ++x)
{
buff << int32(proto->Spells[x].SpellCharges);
}
for (uint32 x = 0; x < MAX_ITEM_PROTO_SPELLS; ++x)
{
buff << int32(proto->Spells[x].SpellCooldown);
}
for (uint32 x = 0; x < MAX_ITEM_PROTO_SPELLS; ++x)
{
buff << uint32(proto->Spells[x].SpellCategory);
}
for (uint32 x = 0; x < MAX_ITEM_PROTO_SPELLS; ++x)
{
buff << int32(proto->Spells[x].SpellCategoryCooldown);
}
buff << uint32(proto->Bonding);
@ -1510,10 +1540,14 @@ void WorldSession::SendItemSparseDb2Reply(uint32 entry)
buff << uint32(proto->TotemCategory);
for (uint32 x = 0; x < MAX_ITEM_PROTO_SOCKETS; ++x)
{
buff << uint32(proto->Socket[x].Color);
}
for (uint32 x = 0; x < MAX_ITEM_PROTO_SOCKETS; ++x)
{
buff << uint32(proto->Socket[x].Content);
}
buff << uint32(proto->socketBonus);
buff << uint32(proto->GemProperties);

View file

@ -227,7 +227,9 @@ void WorldSession::SendLfgJoinResult(LfgJoinResult result, LFGState state, party
{
uint32 packetSize = 0;
for (partyForbidden::const_iterator it = lockedDungeons.begin(); it != lockedDungeons.end(); ++it)
{
packetSize += 12 + uint32(it->second.size()) * 8;
}
WorldPacket data(SMSG_LFG_JOIN_RESULT, packetSize);
data << uint32(result);
@ -274,13 +276,17 @@ void WorldSession::SendLfgUpdate(bool isGroup, LfgUpdateType updateType, uint32
{
data << uint8(0);
for (uint32 i = 0; i < 3; ++i)
{
data << uint8(0);
}
}
uint8 count = 1;
data << uint8(count);
for (uint32 i = 0; i < count; ++i)
{
data << uint32(id);
}
data << "";
}
SendPacket(&data);
@ -334,12 +340,16 @@ void WorldSession::SendLfgUpdate(bool isGroup, LFGPlayerStatus status)
if (isGroup)
{
for (uint32 i = 0; i < 3; ++i)
{
data << uint8(0);
}
}
data << uint8(dungeonSize);
for (std::set<uint32>::iterator it = status.dungeonList.begin(); it != status.dungeonList.end(); ++it)
{
data << uint32(*it);
}
data << status.comment;
}
@ -380,7 +390,9 @@ void WorldSession::SendLfgRoleCheckUpdate(LFGRoleCheck const& roleCheck)
data << uint8(dungeons.size());
if (!dungeons.empty())
for (std::set<uint32>::iterator it = dungeons.begin(); it != dungeons.end(); ++it)
{
data << uint32(sLFGMgr.GetDungeonEntry(*it));
}
data << uint8(roleCheck.currentRoles.size());
if (!roleCheck.currentRoles.empty())

View file

@ -822,7 +822,9 @@ void LFGMgr::AddToQueue(ObjectGuid guid)
// put info into wait time maps for starters
for (roleMap::iterator it = information->currentRoles.begin(); it != information->currentRoles.end(); ++it)
{
AddToWaitMap(it->second, information->dungeonList);
}
// just in case someone's already been in the queue.
queueSet::iterator qItr = m_queueSet.find(guid);
@ -918,7 +920,9 @@ void LFGMgr::FindQueueMatches()
{
// Fetch information on all the queued players/groups
for (queueSet::iterator itr = m_queueSet.begin(); itr != m_queueSet.end(); ++itr)
{
FindSpecificQueueMatches(*itr);
}
}
void LFGMgr::FindSpecificQueueMatches(ObjectGuid guid)
@ -1031,7 +1035,9 @@ void LFGMgr::MergeGroups(ObjectGuid guidOne, ObjectGuid guidTwo, std::set<uint32
// move players / roles into a single roleMap
for (roleMap::iterator it = bufferGroup->currentRoles.begin(); it != bufferGroup->currentRoles.end(); ++it)
{
mainGroup->currentRoles[it->first] = it->second;
}
// update the role count / needed role info
UpdateNeededRoles(guidOne, mainGroup);

View file

@ -343,7 +343,9 @@ void MailDraft::SendMailTo(MailReceiver const& receiver, MailSender const& sende
if (!m_items.empty())
{
for (MailItemMap::iterator mailItemIter = m_items.begin(); mailItemIter != m_items.end(); ++mailItemIter)
{
pReceiver->AddMItem(mailItemIter->second);
}
}
}
else if (!m_items.empty())

View file

@ -141,7 +141,9 @@ void WorldSession::HandleSendMail(WorldPacket& recv_data)
ObjectGuid itemGuids[MAX_MAIL_ITEMS];
for (uint8 i = 0; i < items_count; ++i)
{
recv_data.ReadGuidMask<2, 6, 3, 7, 1, 0, 4, 5>(itemGuids[i]);
}
recv_data.ReadGuidMask<3, 4>(mailboxGuid);

View file

@ -1759,7 +1759,9 @@ void DungeonMap::UnloadAll(bool pForce)
void DungeonMap::SendResetWarnings(uint32 timeLeft) const
{
for (MapRefManager::const_iterator itr = m_mapRefManager.begin(); itr != m_mapRefManager.end(); ++itr)
{
itr->getSource()->SendInstanceResetWarning(GetId(), itr->getSource()->GetDifficulty(IsRaid()), timeLeft);
}
}
void DungeonMap::SetResetSchedule(bool on)

View file

@ -47,10 +47,14 @@ MapManager::MapManager()
MapManager::~MapManager()
{
for (MapMapType::iterator iter = i_maps.begin(); iter != i_maps.end(); ++iter)
{
delete iter->second;
}
for (TransportSet::iterator i = m_Transports.begin(); i != m_Transports.end(); ++i)
{
delete *i;
}
DeleteStateMachine();
}
@ -89,7 +93,9 @@ void MapManager::UpdateGridState(grid_state_t state, Map& map, NGridType& ngrid,
void MapManager::InitializeVisibilityDistanceInfo()
{
for (MapMapType::iterator iter = i_maps.begin(); iter != i_maps.end(); ++iter)
{
(*iter).second->InitVisibilityDistance();
}
}
/// @param id - MapId of the to be created map. @param obj WorldObject for which the map is to be created. Must be player for Instancable maps.
@ -186,7 +192,9 @@ void MapManager::Update(uint32 diff)
}
for (MapMapType::iterator iter = i_maps.begin(); iter != i_maps.end(); ++iter)
{
iter->second->Update((uint32)i_timer.GetCurrent());
}
for (TransportSet::iterator iter = m_Transports.begin(); iter != m_Transports.end(); ++iter)
{
@ -217,7 +225,9 @@ void MapManager::Update(uint32 diff)
void MapManager::RemoveAllObjectsInRemoveList()
{
for (MapMapType::iterator iter = i_maps.begin(); iter != i_maps.end(); ++iter)
{
iter->second->RemoveAllObjectsInRemoveList();
}
}
bool MapManager::ExistMapAndVMap(uint32 mapid, float x, float y)
@ -240,7 +250,9 @@ bool MapManager::IsValidMAP(uint32 mapid)
void MapManager::UnloadAll()
{
for (MapMapType::iterator iter = i_maps.begin(); iter != i_maps.end(); ++iter)
{
iter->second->UnloadAll(true);
}
while (!i_maps.empty())
{

View file

@ -176,7 +176,9 @@ inline void MapManager::DoForAllMapsWithMapId(uint32 mapId, Do& _do)
MapMapType::const_iterator start = i_maps.lower_bound(MapID(mapId, 0));
MapMapType::const_iterator end = i_maps.lower_bound(MapID(mapId + 1, 0));
for (MapMapType::const_iterator itr = start; itr != end; ++itr)
{
_do(itr->second);
}
}
#define sMapMgr MapManager::Instance()

View file

@ -644,9 +644,13 @@ MapPersistentStateManager::~MapPersistentStateManager()
// so we must be prepared for both cases
lock_instLists = true;
for (PersistentStateMap::iterator itr = m_instanceSaveByInstanceId.begin(); itr != m_instanceSaveByInstanceId.end(); ++itr)
{
delete itr->second;
}
for (PersistentStateMap::iterator itr = m_instanceSaveByMapId.begin(); itr != m_instanceSaveByMapId.end(); ++itr)
{
delete itr->second;
}
}
/*
@ -960,7 +964,9 @@ void MapPersistentStateManager::_ResetOrWarnAll(uint32 mapid, Difficulty difficu
unbindList.push_back((DungeonPersistentState *)itr->second);
for (auto i : unbindList)
{
i->UnbindThisState();
}
// reset maps, teleport player automaticaly to their homebinds and unload maps
MapPersistantStateResetWorker worker;

View file

@ -135,7 +135,9 @@ void MassMailMgr::GetStatistic(uint32& tasks, uint32& mails, uint32& needTime) c
uint32 mailsCount = 0;
for (MassMailList::const_iterator mailItr = m_massMails.begin(); mailItr != m_massMails.end(); ++mailItr)
{
mailsCount += mailItr->m_receivers.size();
}
mails = mailsCount;

View file

@ -1689,7 +1689,9 @@ void WorldSession::HandleRequestHotfix(WorldPacket& recv_data)
guids.resize(count);
for (uint32 i = 0; i < count; ++i)
{
recv_data.ReadGuidMask<0, 4, 7, 2, 5, 3, 6, 1>(guids[i]);
}
uint32 entry = 0;
for (uint32 i = 0; i < count; ++i)

View file

@ -57,7 +57,9 @@ namespace MMAP
~MMapData()
{
for (NavMeshQuerySet::iterator i = navMeshQueries.begin(); i != navMeshQueries.end(); ++i)
{
dtFreeNavMeshQuery(i->second);
}
if (navMesh)
dtFreeNavMesh(navMesh);

View file

@ -278,7 +278,9 @@ ObjectGridUnloader::Visit(GridRefManager<T> &m)
{
// remove all cross-reference before deleting
for (typename GridRefManager<T>::iterator iter = m.begin(); iter != m.end(); ++iter)
{
iter->getSource()->CleanupsBeforeDelete();
}
while (!m.isEmpty())
{

View file

@ -398,7 +398,9 @@ void WorldSession::SendPetNameQuery(ObjectGuid petguid, uint32 petnumber)
{
data << uint8(1);
for (int i = 0; i < MAX_DECLINED_NAME_CASES; ++i)
{
data << ((Pet*)pet)->GetDeclinedNames()->name[i];
}
}
else
data << uint8(0);
@ -586,7 +588,9 @@ void WorldSession::HandlePetRename(WorldPacket& recv_data)
if (isdeclined)
{
for (int i = 0; i < MAX_DECLINED_NAME_CASES; ++i)
{
CharacterDatabase.escape_string(declinedname.name[i]);
}
CharacterDatabase.PExecute("DELETE FROM character_pet_declinedname WHERE owner = '%u' AND id = '%u'", _player->GetGUIDLow(), pet->GetCharmInfo()->GetPetNumber());
CharacterDatabase.PExecute("INSERT INTO character_pet_declinedname (id, owner, genitive, dative, accusative, instrumental, prepositional) VALUES ('%u','%u','%s','%s','%s','%s','%s')",
pet->GetCharmInfo()->GetPetNumber(), _player->GetGUIDLow(), declinedname.name[0].c_str(), declinedname.name[1].c_str(), declinedname.name[2].c_str(), declinedname.name[3].c_str(), declinedname.name[4].c_str());
@ -773,7 +777,9 @@ void WorldSession::SendPetNameInvalid(uint32 error, const std::string& name, Dec
{
data << uint8(1);
for (uint32 i = 0; i < MAX_DECLINED_NAME_CASES; ++i)
{
data << declinedName->name[i];
}
}
else
data << uint8(0);

View file

@ -73,7 +73,9 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket& recv_data)
recv_data.read_skip<uint32>(); // 0
for (int i = 0; i < 10; ++i)
{
recv_data.read_skip<std::string>();
}
recv_data.read_skip<uint32>(); // client index
recv_data.read_skip<uint32>(); // 0

View file

@ -158,7 +158,9 @@ bool PoolGroup<T>::CheckPool() const
{
float chance = 0;
for (uint32 i = 0; i < ExplicitlyChanced.size(); ++i)
{
chance += ExplicitlyChanced[i].chance;
}
if (chance != 100 && chance != 0)
{
return false;
@ -172,10 +174,14 @@ template <class T>
void PoolGroup<T>::CheckEventLinkAndReport(int16 event_id, std::map<uint32, int16> const& creature2event, std::map<uint32, int16> const& go2event) const
{
for (uint32 i = 0; i < EqualChanced.size(); ++i)
{
EqualChanced[i].template CheckEventLinkAndReport<T>(poolId, event_id, creature2event, go2event);
}
for (uint32 i = 0; i < ExplicitlyChanced.size(); ++i)
{
ExplicitlyChanced[i].template CheckEventLinkAndReport<T>(poolId, event_id, creature2event, go2event);
}
}
template <class T>
@ -1013,7 +1019,9 @@ void PoolManager::LoadFromDB()
std::ostringstream ss;
ss << "The pool(s) ";
for (std::set<uint16>::const_iterator itr = checkedPools.begin(); itr != checkedPools.end(); ++itr)
{
ss << *itr << " ";
}
ss << "create(s) a circular reference, which can cause the server to freeze.\nRemoving the last link between mother pool "
<< poolItr->first << " and child pool " << poolItr->second;
sLog.outErrorDb("%s", ss.str().c_str());

View file

@ -60,7 +60,9 @@ void WorldSession::SendNameQueryOpcode(Player* p)
{
data << uint8(1); // is declined
for (int i = 0; i < MAX_DECLINED_NAME_CASES; ++i)
{
data << names->name[i];
}
}
else
data << uint8(0); // is not declined
@ -128,7 +130,9 @@ void WorldSession::SendNameQueryOpcodeFromDBCallBack(QueryResult* result, uint32
{
data << uint8(1); // is declined
for (int i = 5; i < MAX_DECLINED_NAME_CASES + 5; ++i)
{
data << fields[i].GetCppString();
}
}
else
data << uint8(0); // is not declined
@ -193,7 +197,9 @@ void WorldSession::HandleCreatureQueryOpcode(WorldPacket& recv_data)
data << uint32(ci->KillCredit[1]); // new in 3.1, kill credit
for (int i = 0; i < MAX_CREATURE_MODEL; ++i)
{
data << uint32(ci->ModelId[i]);
}
data << float(ci->HealthMultiplier); // health modifier
data << float(ci->PowerMultiplier); // power modifier

View file

@ -78,65 +78,103 @@ Quest::Quest(Field* questRecord)
PortraitTurnInText = questRecord[43].GetCppString();
for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
{
ObjectiveText[i] = questRecord[44 + i].GetCppString();
}
for (int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
{
ReqItemId[i] = questRecord[48 + i].GetUInt32();
}
for (int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
{
ReqItemCount[i] = questRecord[54 + i].GetUInt32();
}
for (int i = 0; i < QUEST_SOURCE_ITEM_IDS_COUNT; ++i)
{
ReqSourceId[i] = questRecord[60 + i].GetUInt32();
}
for (int i = 0; i < QUEST_SOURCE_ITEM_IDS_COUNT; ++i)
{
ReqSourceCount[i] = questRecord[64 + i].GetUInt32();
}
for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
{
ReqCreatureOrGOId[i] = questRecord[68 + i].GetInt32();
}
for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
{
ReqCreatureOrGOCount[i] = questRecord[72 + i].GetUInt32();
}
for (int i = 0; i < QUEST_REQUIRED_CURRENCY_COUNT; ++i)
{
ReqCurrencyId[i] = questRecord[76 + i].GetUInt32();
}
for (int i = 0; i < QUEST_REQUIRED_CURRENCY_COUNT; ++i)
{
ReqCurrencyCount[i] = questRecord[80 + i].GetUInt32();
}
for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
{
ReqSpell[i] = questRecord[84 + i].GetUInt32();
}
ReqSpellLearned = questRecord[88].GetUInt32();
for (int i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
{
RewChoiceItemId[i] = questRecord[89 + i].GetUInt32();
}
for (int i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
{
RewChoiceItemCount[i] = questRecord[95 + i].GetUInt32();
}
for (int i = 0; i < QUEST_REWARDS_COUNT; ++i)
{
RewItemId[i] = questRecord[101 + i].GetUInt32();
}
for (int i = 0; i < QUEST_REWARDS_COUNT; ++i)
{
RewItemCount[i] = questRecord[105 + i].GetUInt32();
}
for (int i = 0; i < QUEST_REWARD_CURRENCY_COUNT; ++i)
{
RewCurrencyId[i] = questRecord[109 + i].GetUInt32();
}
for (int i = 0; i < QUEST_REWARD_CURRENCY_COUNT; ++i)
{
RewCurrencyCount[i] = questRecord[113 + i].GetUInt32();
}
RewSkill = questRecord[117].GetUInt32();
RewSkillValue = questRecord[118].GetUInt32();
for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i)
{
RewRepFaction[i] = questRecord[119 + i].GetUInt32();
}
for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i)
{
RewRepValueId[i] = questRecord[124 + i].GetInt32();
}
for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i)
{
RewRepValue[i] = questRecord[129 + i].GetInt32();
}
RewHonorAddition = questRecord[134].GetUInt32();
RewHonorMultiplier = questRecord[135].GetFloat();
@ -152,19 +190,27 @@ Quest::Quest(Field* questRecord)
PointOpt = questRecord[145].GetUInt32();
for (int i = 0; i < QUEST_EMOTE_COUNT; ++i)
{
DetailsEmote[i] = questRecord[146 + i].GetUInt32();
}
for (int i = 0; i < QUEST_EMOTE_COUNT; ++i)
{
DetailsEmoteDelay[i] = questRecord[150 + i].GetUInt32();
}
IncompleteEmote = questRecord[154].GetUInt32();
CompleteEmote = questRecord[155].GetUInt32();
for (int i = 0; i < QUEST_EMOTE_COUNT; ++i)
{
OfferRewardEmote[i] = questRecord[156 + i].GetInt32();
}
for (int i = 0; i < QUEST_EMOTE_COUNT; ++i)
{
OfferRewardEmoteDelay[i] = questRecord[160 + i].GetInt32();
}
SoundAcceptId = questRecord[164].GetUInt32();
SoundTurnInId = questRecord[165].GetUInt32();

View file

@ -59,7 +59,9 @@ ScriptMgr::ScriptMgr() : m_scheduledScripts(0)
ScriptChainMap emptyMap;
for (int t = DBS_START; t < DBS_END; ++t)
{
m_dbScripts[t] = emptyMap;
}
}
ScriptMgr::~ScriptMgr()
@ -2259,7 +2261,9 @@ void ScriptMgr::LoadScriptBinding()
{
#ifdef ENABLE_SD3
for (int i = 0; i < SCRIPTED_MAX_TYPE; ++i)
{
m_scriptBind[i].clear();
}
QueryResult* result = WorldDatabase.PQuery("SELECT type, bind, ScriptName, data FROM script_binding");
uint32 count = 0;

View file

@ -132,7 +132,9 @@ void LoadSkillDiscoveryTable()
}
for (SkillLineAbilityMap::const_iterator _spell_idx = bounds.first; _spell_idx != bounds.second; ++_spell_idx)
{
SkillDiscoveryStore[-int32(_spell_idx->second->skillId)].push_back(SkillDiscoveryEntry(spellId, reqSkillValue, chance));
}
}
else
{

View file

@ -424,7 +424,9 @@ Spell::Spell(Unit* caster, SpellEntry const* info, bool triggered, ObjectGuid or
UpdateOriginalCasterPointer();
for (int i = 0; i < MAX_EFFECT_INDEX; ++i)
{
m_currentBasePoints[i] = m_spellInfo->CalculateSimpleValue(SpellEffectIndex(i));
}
m_spellState = SPELL_STATE_CREATED;
@ -785,7 +787,9 @@ void Spell::FillTargetMap()
}
for (UnitList::const_iterator iunit = tmpUnitLists[effToIndex[i]].begin(); iunit != tmpUnitLists[effToIndex[i]].end(); ++iunit)
{
AddUnitTarget((*iunit), SpellEffectIndex(i));
}
}
}
@ -3127,7 +3131,9 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList&
}
// Add resulting GOs as GOTargets
for (std::list<GameObject*>::iterator iter = tempTargetGOList.begin(); iter != tempTargetGOList.end(); ++iter)
{
AddGOTarget(*iter, effIndex);
}
}
}
@ -3612,7 +3618,9 @@ void Spell::cast(bool skipCheck)
// fill initial spell damage from caster for delayed casted spells
for (TargetList::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
{
HandleDelayedSpellLaunch(&(*ihit));
}
// Okay, maps created, now prepare flags
m_immediateHandled = false;
@ -3680,10 +3688,14 @@ void Spell::handle_immediate()
}
for (TargetList::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
{
DoAllEffectOnTarget(&(*ihit));
}
for (GOTargetList::iterator ihit = m_UniqueGOTargetInfo.begin(); ihit != m_UniqueGOTargetInfo.end(); ++ihit)
{
DoAllEffectOnTarget(&(*ihit));
}
// spell is finished, perform some last features of the spell here
_handle_finish_phase();
@ -3776,7 +3788,9 @@ void Spell::_handle_immediate_phase()
// process items
for (ItemTargetList::iterator ihit = m_UniqueItemInfo.begin(); ihit != m_UniqueItemInfo.end(); ++ihit)
{
DoAllEffectOnTarget(&(*ihit));
}
// process ground
for (int j = 0; j < MAX_EFFECT_INDEX; ++j)
@ -4237,14 +4251,18 @@ void Spell::SendSpellStart()
data << uint8(m_runesState);
data << uint8(caster->GetRunesState());
for (uint8 i = 0; i < MAX_RUNES; ++i)
{
data << uint8(caster->GetRuneCooldownFraction(i));
}
}
else
{
data << uint8(0);
data << uint8(0);
for (uint8 i = 0; i < MAX_RUNES; ++i)
{
data << uint8(0);
}
}
}
@ -4335,14 +4353,18 @@ void Spell::SendSpellGo()
data << uint8(m_runesState);
data << uint8(caster->GetRunesState());
for (uint8 i = 0; i < MAX_RUNES; ++i)
{
data << uint8(255 - ((caster->GetRuneCooldown(i) / REGEN_TIME_FULL) * 51));
}
}
else
{
data << uint8(0);
data << uint8(0);
for (uint8 i = 0; i < MAX_RUNES; ++i)
{
data << uint8(0);
}
}
}
@ -5264,7 +5286,9 @@ void Spell::CastTriggerSpells()
void Spell::CastPreCastSpells(Unit* target)
{
for (SpellInfoList::const_iterator si = m_preCastSpells.begin(); si != m_preCastSpells.end(); ++si)
{
m_caster->CastSpell(target, (*si), true, m_CastItem);
}
}
Unit* Spell::GetPrefilledUnitTargetOrUnitTarget(SpellEffectIndex effIndex) const

View file

@ -1309,7 +1309,9 @@ void Aura::TriggerSpell()
Cell::VisitWorldObjects(GetTarget(), checker, 100.0f);
for (std::list<Player*>::iterator itr = targets.begin(); itr != targets.end(); ++itr)
{
(*itr)->CastSpell((*itr), debuffSpellId, true, NULL, NULL, casterGUID);
}
return;
}
@ -1608,9 +1610,13 @@ void Aura::TriggerSpell()
{
// cast 24 spells 34269-34289, 34314-34316
for (uint32 spell_id = 34269; spell_id != 34290; ++spell_id)
{
triggerTarget->CastSpell(triggerTarget, spell_id, true, NULL, this, casterGUID);
}
for (uint32 spell_id = 34314; spell_id != 34317; ++spell_id)
{
triggerTarget->CastSpell(triggerTarget, spell_id, true, NULL, this, casterGUID);
}
return;
}
// // Gravity Lapse
@ -3612,7 +3618,9 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
target->GetZoneAndAreaId(zone, area);
for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr)
{
itr->second->ApplyOrRemoveSpellIfCan((Player*)target, zone, area, false);
}
}
}
@ -7189,7 +7197,9 @@ void Aura::HandleNoReagentUseAura(bool /*Apply*/, bool Real)
ClassFamilyMask mask;
Unit::AuraList const& noReagent = target->GetAurasByType(SPELL_AURA_NO_REAGENT_USE);
for (Unit::AuraList::const_iterator i = noReagent.begin(); i != noReagent.end(); ++i)
{
mask |= (*i)->GetAuraSpellClassMask();
}
target->SetUInt64Value(PLAYER_NO_REAGENT_COST_1 + 0, mask.Flags);
target->SetUInt32Value(PLAYER_NO_REAGENT_COST_1 + 2, mask.Flags2);
@ -9606,7 +9616,9 @@ void Aura::HandlePhase(bool apply, bool Real)
target->GetZoneAndAreaId(zone, area);
for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr)
{
itr->second->ApplyOrRemoveSpellIfCan((Player*)target, zone, area, false);
}
}
}
}

View file

@ -1560,7 +1560,9 @@ void Spell::EffectDummy(SpellEffectEntry const* effect)
std::random_shuffle(spellPool.begin(), spellPool.end());
for (uint8 i = 0; i < (m_caster->GetMap()->IsRegularDifficulty() ? 2 : 4); ++i)
{
m_caster->CastSpell(m_caster, spellPool[i], true);
}
return;
}
@ -3010,7 +3012,9 @@ void Spell::EffectDummy(SpellEffectEntry const* effect)
uint32 random = urand(3, 5);
for (uint32 i = 0; i < random; ++i)
{
m_caster->CastSpell(m_caster, 55528, true);
}
return;
}
@ -3141,7 +3145,9 @@ void Spell::EffectDummy(SpellEffectEntry const* effect)
}
for (uint8 i = 0; i < 5; ++i)
{
m_caster->CastSpell(unitTarget, effect->CalculateSimpleValue(), true);
}
return;
}
case 63030: // Boil Ominously
@ -4133,7 +4139,9 @@ void Spell::EffectDummy(SpellEffectEntry const* effect)
// Righteous Defense (step 2) (in old version 31980 dummy effect)
// Clear targets for eff 1
for (TargetList::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
{
ihit->effectMask &= ~(1 << 1);
}
// not empty (checked), copy
Unit::AttackerSet attackers = friendTarget->getAttackers();
@ -9033,7 +9041,9 @@ void Spell::EffectScriptEffect(SpellEffectEntry const* effect)
// Summon 4 clones of the same player
for (uint8 i = 0; i < 4; ++i)
{
unitTarget->CastSpell(unitTarget, 45891, true, NULL, NULL, m_caster->GetObjectGuid());
}
return;
}
case 45918: // Soul Sever
@ -9128,13 +9138,19 @@ void Spell::EffectScriptEffect(SpellEffectEntry const* effect)
// Quest - Jormungar Explosion Summon Object
for (int i = 0; i < 2; ++i)
{
m_caster->CastSpell(m_caster, 47309, true);
}
for (int i = 0; i < 2; ++i)
{
m_caster->CastSpell(m_caster, 47924, true);
}
for (int i = 0; i < 2; ++i)
{
m_caster->CastSpell(m_caster, 47925, true);
}
return;
}
@ -9687,13 +9703,19 @@ void Spell::EffectScriptEffect(SpellEffectEntry const* effect)
// Quest - Mammoth Explosion Summon Object
for (int i = 0; i < 2; ++i)
{
m_caster->CastSpell(m_caster, 54623, true);
}
for (int i = 0; i < 2; ++i)
{
m_caster->CastSpell(m_caster, 54627, true);
}
for (int i = 0; i < 2; ++i)
{
m_caster->CastSpell(m_caster, 54628, true);
}
// Summon Main Mammoth Meat
m_caster->CastSpell(m_caster, 57444, true);
@ -9901,7 +9923,9 @@ void Spell::EffectScriptEffect(SpellEffectEntry const* effect)
uint32 stackAmount = urand(1, GetSpellStore()->LookupEntry(62239)->GetStackAmount());
for (uint8 i = 0; i < stackAmount; ++i)
{
unitTarget->CastSpell(unitTarget, 62239, true);
}
}
return;
}
@ -10005,7 +10029,9 @@ void Spell::EffectScriptEffect(SpellEffectEntry const* effect)
uint32 spellId = effect->CalculateSimpleValue();
for (uint32 i = 0; i < 10; ++i)
{
m_caster->CastSpell(m_caster, spellId, true);
}
return;
}
@ -10060,7 +10086,9 @@ void Spell::EffectScriptEffect(SpellEffectEntry const* effect)
}
for (uint8 i = 0; i < 15; ++i)
{
unitTarget->CastSpell(unitTarget, 65347, true);
}
return;
}
case 63119: // Block!
@ -10107,7 +10135,9 @@ void Spell::EffectScriptEffect(SpellEffectEntry const* effect)
}
for (uint8 i = 0; i < 5; ++i)
{
unitTarget->CastSpell(unitTarget, effect->CalculateSimpleValue(), true);
}
return;
}
case 63667: // Napalm Shell
@ -10373,7 +10403,9 @@ void Spell::EffectScriptEffect(SpellEffectEntry const* effect)
}
for (uint8 i = 0; i < 11; ++i)
{
unitTarget->CastSpell(unitTarget, effect->CalculateSimpleValue(), true);
}
return;
}
@ -10638,7 +10670,9 @@ void Spell::EffectScriptEffect(SpellEffectEntry const* effect)
// Cast summon spells 72701, 72702, 72703, 72704
for (uint32 triggeredSpell = effect->CalculateSimpleValue(); triggeredSpell < m_spellInfo->Id; ++triggeredSpell)
{
unitTarget->CastSpell(unitTarget, triggeredSpell, true);
}
return;
}

View file

@ -781,7 +781,9 @@ void WorldSession::HandleGetMirrorimageData(WorldPacket& recv_data)
data << ObjectGuid();
for (int i = 0; i < 11; ++i)
{
data << (uint32)0;
}
}
SendPacket(&data);

View file

@ -148,7 +148,9 @@ void WorldSession::SendUpdateTrade(bool trader_state /*= true*/)
data.WriteGuidBytes<1>(creatorGuid);
data << uint32(item->GetEnchantmentId(PERM_ENCHANTMENT_SLOT));
for (uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT + MAX_GEM_SOCKETS; ++enchant_slot)
{
data << uint32(item->GetEnchantmentId(EnchantmentSlot(enchant_slot)));
}
data << uint32(item->GetUInt32Value(ITEM_FIELD_MAXDURABILITY));
data.WriteGuidBytes<6, 2, 7, 4>(creatorGuid);
data << uint32(item->GetEnchantmentId(REFORGE_ENCHANTMENT_SLOT)); // reforge Id

View file

@ -115,7 +115,9 @@ void MapManager::LoadTransports()
m_Transports.insert(t);
for (std::set<uint32>::const_iterator i = mapsUsed.begin(); i != mapsUsed.end(); ++i)
{
m_TransportsByMap[*i].insert(t);
}
// If we someday decide to use the grid to track transports, here:
t->SetMap(sMapMgr.CreateMap(mapid, t));

View file

@ -2604,7 +2604,9 @@ SpellAuraProcResult Unit::HandleDummyAuraProc(Unit* pVictim, uint32 damage, Aura
// Attack Twice
for (uint32 i = 0; i < 2; ++i)
{
CastCustomSpell(pVictim, triggered_spell_id, &basepoints[0], NULL, NULL, true, castItem, triggeredByAura);
}
return SPELL_AURA_PROC_OK;
}

View file

@ -124,7 +124,9 @@ bool UpdateData::BuildPacket(WorldPacket* packet)
buf << uint32(m_outOfRangeGUIDs.size());
for (GuidSet::const_iterator i = m_outOfRangeGUIDs.begin(); i != m_outOfRangeGUIDs.end(); ++i)
{
buf << i->WriteAsPacked();
}
}
buf.append(m_data);

View file

@ -56,7 +56,9 @@ WaypointBehavior::WaypointBehavior(const WaypointBehavior& b)
model1 = b.model1;
model2 = b.model2;
for (int i = 0; i < MAX_WAYPOINT_TEXT; ++i)
{
textid[i] = b.textid[i];
}
}
void WaypointManager::Load()
@ -401,7 +403,9 @@ void WaypointManager::Load()
if (!movementScriptSet.empty())
{
for (std::set<uint32>::const_iterator itr = movementScriptSet.begin(); itr != movementScriptSet.end(); ++itr)
{
sLog.outErrorDb("Table `dbscripts_on_creature_movement` contain unused script, id %u.", *itr);
}
}
}
@ -423,7 +427,9 @@ void WaypointManager::Unload()
void WaypointManager::_clearPath(WaypointPath& path)
{
for (WaypointPath::const_iterator itr = path.begin(); itr != path.end(); ++itr)
{
delete itr->second.behavior;
}
path.clear();
}

View file

@ -462,7 +462,9 @@ WeatherSystem::~WeatherSystem()
{
///- Empty the WeatherMap
for (WeatherMap::const_iterator itr = m_weathers.begin(); itr != m_weathers.end(); ++itr)
{
delete itr->second;
}
m_weathers.clear();
}

View file

@ -161,13 +161,19 @@ World::~World()
///- Empty the kicked session set
for (auto const session : m_sessions)
{
delete session.second;
}
for (auto const cliCommand : m_cliCommandQueue)
{
delete cliCommand;
}
for (auto const session : m_sessionAddQueue)
{
delete session;
}
VMAP::VMapFactory::clear();
MMAP::MMapFactory::clear();
@ -1692,7 +1698,9 @@ void World::showFooter()
std::string sModules;
for (std::set<std::string>::const_iterator it = modules_.begin(); it != modules_.end(); ++it)
{
sModules = sModules + " \n" + *it;
}
sLog.outString("\n"
"_______________________________________________________\n"

View file

@ -365,7 +365,9 @@ char* DB2FileLoader::AutoProduceStringsArrayHolders(const char* format, char* da
// dbc strings expected to have at least empty string
for(size_t i = 0; i < stringHoldersPoolSize / sizeof(char*); ++i)
{
((char const**)stringHoldersPool)[i] = nullStr;
}
uint32 offset=0;

View file

@ -307,7 +307,9 @@ char* DBCFileLoader::AutoProduceStringsArrayHolders(const char* format, char* da
// dbc strings expected to have at least empty string
for(size_t i = 0; i < stringHoldersPoolSize / sizeof(char*); ++i)
{
((char const**)stringHoldersPool)[i] = nullStr;
}
uint32 offset=0;

View file

@ -34,7 +34,9 @@ QueryResultMysql::QueryResultMysql(MYSQL_RES* result, MYSQL_FIELD* fields, uint6
MANGOS_ASSERT(mCurrentRow);
for (uint32 i = 0; i < mFieldCount; ++i)
{
mCurrentRow[i].SetType(ConvertNativeType(fields[i].type));
}
}
QueryResultMysql::~QueryResultMysql()

View file

@ -54,7 +54,9 @@ void BitStream::WriteBit(uint32 bit)
template <typename T> void BitStream::WriteBits(T value, size_t bits)
{
for (int32 i = bits-1; i >= 0; --i)
{
WriteBit((value >> i) & 1);
}
}
bool BitStream::Empty()
@ -69,7 +71,9 @@ void BitStream::Reverse()
Clear();
for(uint32 i = len; i > 0; --i)
{
WriteBit(b[i-1]);
}
}
void BitStream::Print()
@ -77,7 +81,9 @@ void BitStream::Print()
std::stringstream ss;
ss << "BitStream: ";
for (uint32 i = 0; i < GetLength(); ++i)
{
ss << uint32(GetBit(i)) << " ";
}
sLog.outDebug("%s", ss.str().c_str());
}

View file

@ -244,7 +244,9 @@ class ByteBuffer
template <typename T> void WriteBits(T value, size_t bits)
{
for (int32 i = bits-1; i >= 0; --i)
{
WriteBit((value >> i) & 1);
}
}
uint32 ReadBits(size_t bits)
@ -261,7 +263,9 @@ class ByteBuffer
{
BitStream b;
for (uint32 i = 0; i < len; ++i)
{
b.WriteBit(ReadBit());
}
return b;
}
@ -270,7 +274,9 @@ class ByteBuffer
uint8* guidByte = ((uint8*)&guid);
for (uint8 i = 0; i < maskCount; i++)
{
WriteBit(guidByte[maskOrder[i + maskPos]]);
}
}
void WriteGuidBytes(uint64 guid, uint8* byteOrder, uint8 byteCount, uint8 bytePos)
@ -1081,7 +1087,9 @@ class ByteBuffer
{
sLog.outDebug("STORAGE_SIZE: %lu", (unsigned long)size() );
for (uint32 i = 0; i < size(); ++i)
{
sLog.outDebug("%u - ", read<uint8>(i) );
}
sLog.outDebug(" ");
}
@ -1089,7 +1097,9 @@ class ByteBuffer
{
sLog.outDebug("STORAGE_SIZE: %lu", (unsigned long)size() );
for (uint32 i = 0; i < size(); ++i)
{
sLog.outDebug("%c", read<uint8>(i) );
}
sLog.outDebug(" ");
}

View file

@ -124,7 +124,9 @@ int getBuildNumber()
/// jump over as much of the file as possible, before we start searching for the base #
for (int i = 0; i < 3300; i++)
{
fread(jumpBytesBuffer, sizeof(jumpBytesBuffer), 1, pFile);
}
/// Search for the build #
while (!bBuildFound && fread(byteSearchBuffer, 1, 1, pFile))

View file

@ -64,7 +64,9 @@ void fixnamen(char* name, size_t len)
}
//extension in lowercase
for (size_t i = len - 3; i < len; i++)
{
name[i] |= 0x20;
}
}
void fixname2(char* name, size_t len)

View file

@ -109,7 +109,9 @@ void ExtractGameobjectModels()
{
printf("Warning: Some models could not be extracted, see below\n");
for (StringSet::const_iterator itr = failedPaths.begin(); itr != failedPaths.end(); ++itr)
{
printf("Could not find file of model %s\n", itr->c_str());
}
printf("A few of these warnings are expected to happen, so be not alarmed!\n");
}