diff --git a/src/game/AchievementMgr.cpp b/src/game/AchievementMgr.cpp index 799542ac6..d8ba2e3b1 100644 --- a/src/game/AchievementMgr.cpp +++ b/src/game/AchievementMgr.cpp @@ -228,14 +228,14 @@ AchievementMgr::~AchievementMgr() void AchievementMgr::Reset() { - for(CompletedAchievementMap::iterator iter = m_completedAchievements.begin(); iter!=m_completedAchievements.end(); ++iter) + for(CompletedAchievementMap::const_iterator iter = m_completedAchievements.begin(); iter!=m_completedAchievements.end(); ++iter) { WorldPacket data(SMSG_ACHIEVEMENT_DELETED,4); data << uint32(iter->first); m_player->SendDirectMessage(&data); } - for(CriteriaProgressMap::iterator iter = m_criteriaProgress.begin(); iter!=m_criteriaProgress.end(); ++iter) + for(CriteriaProgressMap::const_iterator iter = m_criteriaProgress.begin(); iter!=m_criteriaProgress.end(); ++iter) { WorldPacket data(SMSG_CRITERIA_DELETED,4); data << uint32(iter->first); @@ -675,7 +675,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST_COUNT: { uint32 counter =0; - for(QuestStatusMap::iterator itr = GetPlayer()->getQuestStatusMap().begin(); itr!=GetPlayer()->getQuestStatusMap().end(); itr++) + for(QuestStatusMap::const_iterator itr = GetPlayer()->getQuestStatusMap().begin(); itr!=GetPlayer()->getQuestStatusMap().end(); itr++) if(itr->second.m_rewarded) counter++; SetCriteriaProgress(achievementCriteria, counter); @@ -688,7 +688,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui continue; uint32 counter =0; - for(QuestStatusMap::iterator itr = GetPlayer()->getQuestStatusMap().begin(); itr!=GetPlayer()->getQuestStatusMap().end(); itr++) + for(QuestStatusMap::const_iterator itr = GetPlayer()->getQuestStatusMap().begin(); itr!=GetPlayer()->getQuestStatusMap().end(); itr++) { Quest const* quest = objmgr.GetQuestTemplate(itr->first); if(itr->second.m_rewarded && quest->GetZoneOrSort() >= 0 && uint32(quest->GetZoneOrSort()) == achievementCriteria->complete_quests_in_zone.zoneID) diff --git a/src/game/ArenaTeam.cpp b/src/game/ArenaTeam.cpp index eb8906f73..6b88ba687 100644 --- a/src/game/ArenaTeam.cpp +++ b/src/game/ArenaTeam.cpp @@ -517,7 +517,7 @@ int32 ArenaTeam::WonAgainst(uint32 againstRating) stats.wins_season += 1; //update team's rank stats.rank = 1; - ObjectMgr::ArenaTeamMap::iterator i = objmgr.GetArenaTeamMapBegin(); + ObjectMgr::ArenaTeamMap::const_iterator i = objmgr.GetArenaTeamMapBegin(); for ( ; i != objmgr.GetArenaTeamMapEnd(); ++i) { if (i->second->GetType() == this->Type && i->second->GetStats().rating > stats.rating) @@ -542,7 +542,7 @@ int32 ArenaTeam::LostAgainst(uint32 againstRating) //update team's rank stats.rank = 1; - ObjectMgr::ArenaTeamMap::iterator i = objmgr.GetArenaTeamMapBegin(); + ObjectMgr::ArenaTeamMap::const_iterator i = objmgr.GetArenaTeamMapBegin(); for ( ; i != objmgr.GetArenaTeamMapEnd(); ++i) { if (i->second->GetType() == this->Type && i->second->GetStats().rating > stats.rating) @@ -630,7 +630,7 @@ void ArenaTeam::UpdateArenaPointsHelper(std::map& PlayerPoints) return; // to get points, a player has to participate in at least 30% of the matches uint32 min_plays = (uint32) ceil(stats.games_week * 0.3); - for(MemberList::iterator itr = members.begin(); itr != members.end(); ++itr) + for(MemberList::const_iterator itr = members.begin(); itr != members.end(); ++itr) { // the player participated in enough games, update his points uint32 points_to_add = 0; @@ -656,7 +656,7 @@ void ArenaTeam::SaveToDB() // called after a match has ended, or when calculating arena_points CharacterDatabase.BeginTransaction(); CharacterDatabase.PExecute("UPDATE arena_team_stats SET rating = '%u',games = '%u',played = '%u',rank = '%u',wins = '%u',wins2 = '%u' WHERE arenateamid = '%u'", stats.rating, stats.games_week, stats.games_season, stats.rank, stats.wins_week, stats.wins_season, GetId()); - for(MemberList::iterator itr = members.begin(); itr != members.end(); ++itr) + for(MemberList::const_iterator itr = members.begin(); itr != members.end(); ++itr) { CharacterDatabase.PExecute("UPDATE arena_team_member SET played_week = '%u', wons_week = '%u', played_season = '%u', wons_season = '%u', personal_rating = '%u' WHERE arenateamid = '%u' AND guid = '%u'", itr->games_week, itr->wins_week, itr->games_season, itr->wins_season, itr->personal_rating, Id, GUID_LOPART(itr->guid)); } diff --git a/src/game/ArenaTeamHandler.cpp b/src/game/ArenaTeamHandler.cpp index c31f39514..ebaec0ccb 100644 --- a/src/game/ArenaTeamHandler.cpp +++ b/src/game/ArenaTeamHandler.cpp @@ -38,7 +38,7 @@ void WorldSession::HandleInspectArenaStatsOpcode(WorldPacket & recv_data) if(Player *plr = objmgr.GetPlayer(guid)) { - for (uint8 i = 0; i < MAX_ARENA_SLOT; i++) + for (uint8 i = 0; i < MAX_ARENA_SLOT; ++i) { if(uint32 a_id = plr->GetArenaTeamId(i)) { diff --git a/src/game/AuctionHouseMgr.cpp b/src/game/AuctionHouseMgr.cpp index 8a2f838ba..0d39a6de2 100644 --- a/src/game/AuctionHouseMgr.cpp +++ b/src/game/AuctionHouseMgr.cpp @@ -43,7 +43,7 @@ AuctionHouseMgr::AuctionHouseMgr() AuctionHouseMgr::~AuctionHouseMgr() { - for(ItemMap::iterator itr = mAitems.begin(); itr != mAitems.end(); ++itr) + for(ItemMap::const_iterator itr = mAitems.begin(); itr != mAitems.end(); ++itr) delete itr->second; } @@ -635,7 +635,7 @@ bool AuctionEntry::BuildAuctionInfo(WorldPacket & data) const data << uint32(Id); data << uint32(pItem->GetEntry()); - for (uint8 i = 0; i < MAX_INSPECTED_ENCHANTMENT_SLOT; i++) + for (uint8 i = 0; i < MAX_INSPECTED_ENCHANTMENT_SLOT; ++i) { data << uint32(pItem->GetEnchantmentId(EnchantmentSlot(i))); data << uint32(pItem->GetEnchantmentDuration(EnchantmentSlot(i))); diff --git a/src/game/AuctionHouseMgr.h b/src/game/AuctionHouseMgr.h index 12e51cf79..2775838d9 100644 --- a/src/game/AuctionHouseMgr.h +++ b/src/game/AuctionHouseMgr.h @@ -76,7 +76,7 @@ class AuctionHouseObject AuctionHouseObject() {} ~AuctionHouseObject() { - for (AuctionEntryMap::iterator itr = AuctionsMap.begin(); itr != AuctionsMap.end(); ++itr) + for (AuctionEntryMap::const_iterator itr = AuctionsMap.begin(); itr != AuctionsMap.end(); ++itr) delete itr->second; } diff --git a/src/game/Bag.cpp b/src/game/Bag.cpp index eae355166..0feca6d14 100644 --- a/src/game/Bag.cpp +++ b/src/game/Bag.cpp @@ -82,7 +82,7 @@ bool Bag::Create(uint32 guidlow, uint32 itemid, Player const* owner) SetUInt32Value(CONTAINER_FIELD_NUM_SLOTS, itemProto->ContainerSlots); // Cleaning 20 slots - for (uint8 i = 0; i < MAX_BAG_SIZE; i++) + for (uint8 i = 0; i < MAX_BAG_SIZE; ++i) { SetUInt64Value(CONTAINER_FIELD_SLOT_1 + (i*2), 0); m_bagslot[i] = NULL; @@ -117,7 +117,7 @@ bool Bag::LoadFromDB(uint32 guid, uint64 owner_guid, QueryResult *result) void Bag::DeleteFromDB() { - for (int i = 0; i < MAX_BAG_SIZE; i++) + for (int i = 0; i < MAX_BAG_SIZE; ++i) if (m_bagslot[i]) m_bagslot[i]->DeleteFromDB(); @@ -127,7 +127,7 @@ void Bag::DeleteFromDB() uint32 Bag::GetFreeSlots() const { uint32 slots = 0; - for (uint32 i=0; i < GetBagSize(); i++) + for (uint32 i=0; i < GetBagSize(); ++i) if (!m_bagslot[i]) ++slots; diff --git a/src/game/BattleGround.cpp b/src/game/BattleGround.cpp index ee972d2d4..b19d53474 100644 --- a/src/game/BattleGround.cpp +++ b/src/game/BattleGround.cpp @@ -118,7 +118,7 @@ namespace MaNGOS template void BattleGround::BroadcastWorker(Do& _do) { - for(BattleGroundPlayerMap::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) + for(BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) if (Player *plr = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(itr->first, 0, HIGHGUID_PLAYER))) _do(plr); } @@ -260,7 +260,7 @@ void BattleGround::Update(uint32 diff) for(std::map >::iterator itr = m_ReviveQueue.begin(); itr != m_ReviveQueue.end(); ++itr) { Creature *sh = NULL; - for(std::vector::iterator itr2 = (itr->second).begin(); itr2 != (itr->second).end(); ++itr2) + for(std::vector::const_iterator itr2 = (itr->second).begin(); itr2 != (itr->second).end(); ++itr2) { Player *plr = objmgr.GetPlayer(*itr2); if (!plr) @@ -289,7 +289,7 @@ void BattleGround::Update(uint32 diff) } else if (m_LastResurrectTime > 500) // Resurrect players only half a second later, to see spirit heal effect on NPC { - for(std::vector::iterator itr = m_ResurrectQueue.begin(); itr != m_ResurrectQueue.end(); ++itr) + for(std::vector::const_iterator itr = m_ResurrectQueue.begin(); itr != m_ResurrectQueue.end(); ++itr) { Player *plr = objmgr.GetPlayer(*itr); if (!plr) @@ -459,7 +459,7 @@ void BattleGround::SetTeamStartLoc(uint32 TeamID, float X, float Y, float Z, flo void BattleGround::SendPacketToAll(WorldPacket *packet) { - for(BattleGroundPlayerMap::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) + for(BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) { Player *plr = objmgr.GetPlayer(itr->first); if (plr) @@ -471,7 +471,7 @@ void BattleGround::SendPacketToAll(WorldPacket *packet) void BattleGround::SendPacketToTeam(uint32 TeamID, WorldPacket *packet, Player *sender, bool self) { - for(BattleGroundPlayerMap::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) + for(BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) { Player *plr = objmgr.GetPlayer(itr->first); @@ -503,7 +503,7 @@ void BattleGround::PlaySoundToTeam(uint32 SoundID, uint32 TeamID) { WorldPacket data; - for(BattleGroundPlayerMap::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) + for(BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) { Player *plr = objmgr.GetPlayer(itr->first); @@ -526,7 +526,7 @@ void BattleGround::PlaySoundToTeam(uint32 SoundID, uint32 TeamID) void BattleGround::CastSpellOnTeam(uint32 SpellID, uint32 TeamID) { - for(BattleGroundPlayerMap::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) + for(BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) { Player *plr = objmgr.GetPlayer(itr->first); @@ -546,7 +546,7 @@ void BattleGround::CastSpellOnTeam(uint32 SpellID, uint32 TeamID) void BattleGround::RewardHonorToTeam(uint32 Honor, uint32 TeamID) { - for(BattleGroundPlayerMap::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) + for(BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) { Player *plr = objmgr.GetPlayer(itr->first); @@ -571,7 +571,7 @@ void BattleGround::RewardReputationToTeam(uint32 faction_id, uint32 Reputation, if (!factionEntry) return; - for(BattleGroundPlayerMap::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) + for(BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) { Player *plr = objmgr.GetPlayer(itr->first); @@ -1236,7 +1236,7 @@ bool BattleGround::HasFreeSlots() const void BattleGround::UpdatePlayerScore(Player *Source, uint32 type, uint32 value) { //this procedure is called from virtual function implemented in bg subclass - std::map::iterator itr = m_PlayerScores.find(Source->GetGUID()); + std::map::const_iterator itr = m_PlayerScores.find(Source->GetGUID()); if(itr == m_PlayerScores.end()) // player not found... return; @@ -1640,7 +1640,7 @@ void BattleGround::HandleKillPlayer( Player *player, Player *killer ) UpdatePlayerScore(killer, SCORE_HONORABLE_KILLS, 1); UpdatePlayerScore(killer, SCORE_KILLING_BLOWS, 1); - for(BattleGroundPlayerMap::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) + for(BattleGroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) { Player *plr = objmgr.GetPlayer(itr->first); diff --git a/src/game/BattleGroundBE.cpp b/src/game/BattleGroundBE.cpp index 371955414..111fff722 100644 --- a/src/game/BattleGroundBE.cpp +++ b/src/game/BattleGroundBE.cpp @@ -56,19 +56,19 @@ void BattleGroundBE::Update(uint32 diff) void BattleGroundBE::StartingEventCloseDoors() { - for(uint32 i = BG_BE_OBJECT_DOOR_1; i <= BG_BE_OBJECT_DOOR_4; i++) + for(uint32 i = BG_BE_OBJECT_DOOR_1; i <= BG_BE_OBJECT_DOOR_4; ++i) SpawnBGObject(i, RESPAWN_IMMEDIATELY); - for(uint32 i = BG_BE_OBJECT_BUFF_1; i <= BG_BE_OBJECT_BUFF_2; i++) + for(uint32 i = BG_BE_OBJECT_BUFF_1; i <= BG_BE_OBJECT_BUFF_2; ++i) SpawnBGObject(i, RESPAWN_ONE_DAY); } void BattleGroundBE::StartingEventOpenDoors() { - for(uint32 i = BG_BE_OBJECT_DOOR_1; i <= BG_BE_OBJECT_DOOR_2; i++) + for(uint32 i = BG_BE_OBJECT_DOOR_1; i <= BG_BE_OBJECT_DOOR_2; ++i) DoorOpen(i); - for(uint32 i = BG_BE_OBJECT_BUFF_1; i <= BG_BE_OBJECT_BUFF_2; i++) + for(uint32 i = BG_BE_OBJECT_BUFF_1; i <= BG_BE_OBJECT_BUFF_2; ++i) SpawnBGObject(i, 60); } diff --git a/src/game/BattleGroundHandler.cpp b/src/game/BattleGroundHandler.cpp index f5cf3bf48..426ff9839 100644 --- a/src/game/BattleGroundHandler.cpp +++ b/src/game/BattleGroundHandler.cpp @@ -228,7 +228,7 @@ void WorldSession::HandleBattleGroundPlayerPositionsOpcode( WorldPacket & /*recv WorldPacket data(MSG_BATTLEGROUND_PLAYER_POSITIONS, (4+4+16*count1+16*count2)); data << count1; // alliance flag holders count - obsolete, now always 0 - /*for(uint8 i = 0; i < count1; i++) + /*for(uint8 i = 0; i < count1; ++i) { data << uint64(0); // guid data << (float)0; // x @@ -330,7 +330,7 @@ void WorldSession::HandleBattleGroundPlayerPortOpcode( WorldPacket &recv_data ) if (_player->InBattleGroundQueue()) { // update all queues, send invitation info if player is invited, queue info if queued - for (uint32 i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; i++) + for (uint32 i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i) { BattleGroundQueueTypeId bgQueueTypeId = _player->GetBattleGroundQueueTypeId(i); if (!bgQueueTypeId) @@ -532,7 +532,7 @@ void WorldSession::HandleBattlefieldStatusOpcode( WorldPacket & /*recv_data*/ ) WorldPacket data; // we must update all queues here BattleGround *bg = NULL; - for (uint8 i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; i++) + for (uint8 i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i) { BattleGroundQueueTypeId bgQueueTypeId = _player->GetBattleGroundQueueTypeId(i); if (!bgQueueTypeId) diff --git a/src/game/BattleGroundNA.cpp b/src/game/BattleGroundNA.cpp index 76729e543..bc8738202 100644 --- a/src/game/BattleGroundNA.cpp +++ b/src/game/BattleGroundNA.cpp @@ -56,16 +56,16 @@ void BattleGroundNA::Update(uint32 diff) void BattleGroundNA::StartingEventCloseDoors() { - for(uint32 i = BG_NA_OBJECT_DOOR_1; i <= BG_NA_OBJECT_DOOR_4; i++) + for(uint32 i = BG_NA_OBJECT_DOOR_1; i <= BG_NA_OBJECT_DOOR_4; ++i) SpawnBGObject(i, RESPAWN_IMMEDIATELY); } void BattleGroundNA::StartingEventOpenDoors() { - for(uint32 i = BG_NA_OBJECT_DOOR_1; i <= BG_NA_OBJECT_DOOR_2; i++) + for(uint32 i = BG_NA_OBJECT_DOOR_1; i <= BG_NA_OBJECT_DOOR_2; ++i) DoorOpen(i); - for(uint32 i = BG_NA_OBJECT_BUFF_1; i <= BG_NA_OBJECT_BUFF_2; i++) + for(uint32 i = BG_NA_OBJECT_BUFF_1; i <= BG_NA_OBJECT_BUFF_2; ++i) SpawnBGObject(i, 60); } diff --git a/src/game/BattleGroundRL.cpp b/src/game/BattleGroundRL.cpp index fd04a657c..d79db75b1 100644 --- a/src/game/BattleGroundRL.cpp +++ b/src/game/BattleGroundRL.cpp @@ -56,16 +56,16 @@ void BattleGroundRL::Update(uint32 diff) void BattleGroundRL::StartingEventCloseDoors() { - for(uint32 i = BG_RL_OBJECT_DOOR_1; i <= BG_RL_OBJECT_DOOR_2; i++) + for(uint32 i = BG_RL_OBJECT_DOOR_1; i <= BG_RL_OBJECT_DOOR_2; ++i) SpawnBGObject(i, RESPAWN_IMMEDIATELY); } void BattleGroundRL::StartingEventOpenDoors() { - for(uint32 i = BG_RL_OBJECT_DOOR_1; i <= BG_RL_OBJECT_DOOR_2; i++) + for(uint32 i = BG_RL_OBJECT_DOOR_1; i <= BG_RL_OBJECT_DOOR_2; ++i) DoorOpen(i); - for(uint32 i = BG_RL_OBJECT_BUFF_1; i <= BG_RL_OBJECT_BUFF_2; i++) + for(uint32 i = BG_RL_OBJECT_BUFF_1; i <= BG_RL_OBJECT_BUFF_2; ++i) SpawnBGObject(i, 60); } diff --git a/src/game/BattleGroundWS.cpp b/src/game/BattleGroundWS.cpp index 573b9ea0f..5f6fb4b2c 100644 --- a/src/game/BattleGroundWS.cpp +++ b/src/game/BattleGroundWS.cpp @@ -92,20 +92,20 @@ void BattleGroundWS::Update(uint32 diff) void BattleGroundWS::StartingEventCloseDoors() { - for(uint32 i = BG_WS_OBJECT_DOOR_A_1; i <= BG_WS_OBJECT_DOOR_H_4; i++) + for(uint32 i = BG_WS_OBJECT_DOOR_A_1; i <= BG_WS_OBJECT_DOOR_H_4; ++i) { DoorClose(i); SpawnBGObject(i, RESPAWN_IMMEDIATELY); } - for(uint32 i = BG_WS_OBJECT_A_FLAG; i <= BG_WS_OBJECT_BERSERKBUFF_2; i++) + for(uint32 i = BG_WS_OBJECT_A_FLAG; i <= BG_WS_OBJECT_BERSERKBUFF_2; ++i) SpawnBGObject(i, RESPAWN_ONE_DAY); } void BattleGroundWS::StartingEventOpenDoors() { - for(uint32 i = BG_WS_OBJECT_DOOR_A_1; i <= BG_WS_OBJECT_DOOR_A_4; i++) + for(uint32 i = BG_WS_OBJECT_DOOR_A_1; i <= BG_WS_OBJECT_DOOR_A_4; ++i) DoorOpen(i); - for(uint32 i = BG_WS_OBJECT_DOOR_H_1; i <= BG_WS_OBJECT_DOOR_H_2; i++) + for(uint32 i = BG_WS_OBJECT_DOOR_H_1; i <= BG_WS_OBJECT_DOOR_H_2; ++i) DoorOpen(i); SpawnBGObject(BG_WS_OBJECT_DOOR_A_5, RESPAWN_ONE_DAY); @@ -113,7 +113,7 @@ void BattleGroundWS::StartingEventOpenDoors() SpawnBGObject(BG_WS_OBJECT_DOOR_H_3, RESPAWN_ONE_DAY); SpawnBGObject(BG_WS_OBJECT_DOOR_H_4, RESPAWN_ONE_DAY); - for(uint32 i = BG_WS_OBJECT_A_FLAG; i <= BG_WS_OBJECT_BERSERKBUFF_2; i++) + for(uint32 i = BG_WS_OBJECT_A_FLAG; i <= BG_WS_OBJECT_BERSERKBUFF_2; ++i) SpawnBGObject(i, RESPAWN_IMMEDIATELY); } diff --git a/src/game/CalendarHandler.cpp b/src/game/CalendarHandler.cpp index 9d1171687..f4acb2641 100644 --- a/src/game/CalendarHandler.cpp +++ b/src/game/CalendarHandler.cpp @@ -47,7 +47,7 @@ void WorldSession::HandleCalendarGetCalendar(WorldPacket &recv_data) for(int i = 0; i < TOTAL_DIFFICULTIES; ++i) { - for (Player::BoundInstancesMap::iterator itr = _player->m_boundInstances[i].begin(); itr != _player->m_boundInstances[i].end(); ++itr) + for (Player::BoundInstancesMap::const_iterator itr = _player->m_boundInstances[i].begin(); itr != _player->m_boundInstances[i].end(); ++itr) { if(itr->second.perm) { diff --git a/src/game/Channel.cpp b/src/game/Channel.cpp index f5710b9f5..63733dcdf 100644 --- a/src/game/Channel.cpp +++ b/src/game/Channel.cpp @@ -449,7 +449,7 @@ void Channel::List(Player* player) bool gmInWhoList = sWorld.getConfig(CONFIG_GM_IN_WHO_LIST) || player->GetSession()->GetSecurity() > SEC_PLAYER; uint32 count = 0; - for(PlayerList::iterator i = players.begin(); i != players.end(); ++i) + for(PlayerList::const_iterator i = players.begin(); i != players.end(); ++i) { Player *plr = objmgr.GetPlayer(i->first); @@ -662,7 +662,7 @@ void Channel::SetOwner(uint64 guid, bool exclaim) void Channel::SendToAll(WorldPacket *data, uint64 p) { - for(PlayerList::iterator i = players.begin(); i != players.end(); ++i) + for(PlayerList::const_iterator i = players.begin(); i != players.end(); ++i) { Player *plr = objmgr.GetPlayer(i->first); if(plr) @@ -675,7 +675,7 @@ void Channel::SendToAll(WorldPacket *data, uint64 p) void Channel::SendToAllButOne(WorldPacket *data, uint64 who) { - for(PlayerList::iterator i = players.begin(); i != players.end(); ++i) + for(PlayerList::const_iterator i = players.begin(); i != players.end(); ++i) { if(i->first != who) { diff --git a/src/game/ChannelMgr.h b/src/game/ChannelMgr.h index 79969bd41..5e2f165bb 100644 --- a/src/game/ChannelMgr.h +++ b/src/game/ChannelMgr.h @@ -32,7 +32,7 @@ class ChannelMgr ChannelMgr() {} ~ChannelMgr() { - for(ChannelMap::iterator itr = channels.begin();itr!=channels.end(); ++itr) + for(ChannelMap::const_iterator itr = channels.begin();itr!=channels.end(); ++itr) delete itr->second; channels.clear(); } diff --git a/src/game/CharacterHandler.cpp b/src/game/CharacterHandler.cpp index 79cb46ee9..f6153c80f 100644 --- a/src/game/CharacterHandler.cpp +++ b/src/game/CharacterHandler.cpp @@ -594,7 +594,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder) data.Initialize( SMSG_ACCOUNT_DATA_TIMES, 4+1+8*4 ); // changed in WotLK data << uint32(time(NULL)); // unix time of something data << uint8(1); - for(int i = 0; i < NUM_ACCOUNT_DATA_TYPES; i++) + for(int i = 0; i < NUM_ACCOUNT_DATA_TYPES; ++i) data << uint32(GetAccountData(i)->Time); // also unix time SendPacket(&data); @@ -915,14 +915,14 @@ void WorldSession::HandleTutorialFlag( WorldPacket & recv_data ) void WorldSession::HandleTutorialClear( WorldPacket & /*recv_data*/ ) { - for ( uint32 iI = 0; iI < 8; iI++) - GetPlayer()->SetTutorialInt( iI, 0xFFFFFFFF ); + for (int i = 0; i < 8; ++i) + GetPlayer()->SetTutorialInt( i, 0xFFFFFFFF ); } void WorldSession::HandleTutorialReset( WorldPacket & /*recv_data*/ ) { - for ( uint32 iI = 0; iI < 8; iI++) - GetPlayer()->SetTutorialInt( iI, 0x00000000 ); + for (int i = 0; i < 8; ++i) + GetPlayer()->SetTutorialInt( i, 0x00000000 ); } void WorldSession::HandleSetWatchedFactionIndexOpcode(WorldPacket & recv_data) diff --git a/src/game/Chat.cpp b/src/game/Chat.cpp index e8b207494..34daba7a9 100644 --- a/src/game/Chat.cpp +++ b/src/game/Chat.cpp @@ -816,7 +816,7 @@ bool ChatHandler::ExecuteCommandInTable(ChatCommand *table, const char* text, co while (*text == ' ') ++text; - for(uint32 i = 0; table[i].Name != NULL; i++) + for(uint32 i = 0; table[i].Name != NULL; ++i) { if( !hasStringAbbr(table[i].Name, cmd.c_str()) ) continue; diff --git a/src/game/Corpse.cpp b/src/game/Corpse.cpp index cf1f11bd8..f8ee0aa5c 100644 --- a/src/game/Corpse.cpp +++ b/src/game/Corpse.cpp @@ -109,7 +109,7 @@ void Corpse::SaveToDB() << GetOrientation() << ", " << GetZoneId() << ", " << GetMapId() << ", '"; - for(uint16 i = 0; i < m_valuesCount; i++ ) + for(uint16 i = 0; i < m_valuesCount; ++i ) ss << GetUInt32Value(i) << " "; ss << "'," << uint64(m_time) <<", " diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index ca5fb4a13..250af557c 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -1348,7 +1348,7 @@ void Creature::LoadEquipment(uint32 equip_entry, bool force) { if (force) { - for (uint8 i = 0; i < 3; i++) + for (uint8 i = 0; i < 3; ++i) SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + i, 0); m_equipmentId = 0; } @@ -1360,7 +1360,7 @@ void Creature::LoadEquipment(uint32 equip_entry, bool force) return; m_equipmentId = equip_entry; - for (uint8 i = 0; i < 3; i++) + for (uint8 i = 0; i < 3; ++i) SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + i, einfo->equipentry[i]); } @@ -1555,7 +1555,7 @@ SpellEntry const *Creature::reachWithSpellAttack(Unit *pVictim) if(!pVictim) return NULL; - for(uint32 i=0; i < CREATURE_MAX_SPELLS; i++) + for(uint32 i=0; i < CREATURE_MAX_SPELLS; ++i) { if(!m_spells[i]) continue; @@ -1607,7 +1607,7 @@ SpellEntry const *Creature::reachWithSpellCure(Unit *pVictim) if(!pVictim) return NULL; - for(uint32 i=0; i < CREATURE_MAX_SPELLS; i++) + for(uint32 i=0; i < CREATURE_MAX_SPELLS; ++i) { if(!m_spells[i]) continue; diff --git a/src/game/Creature.h b/src/game/Creature.h index 4536aaf45..ba113a2d7 100644 --- a/src/game/Creature.h +++ b/src/game/Creature.h @@ -368,7 +368,7 @@ struct VendorItemData void Clear() { - for (VendorItemList::iterator itr = m_items.begin(); itr != m_items.end(); ++itr) + for (VendorItemList::const_iterator itr = m_items.begin(); itr != m_items.end(); ++itr) delete (*itr); m_items.clear(); } diff --git a/src/game/FleeingMovementGenerator.cpp b/src/game/FleeingMovementGenerator.cpp index 073a95ade..639b374b7 100644 --- a/src/game/FleeingMovementGenerator.cpp +++ b/src/game/FleeingMovementGenerator.cpp @@ -61,7 +61,7 @@ FleeingMovementGenerator::_getPoint(T &owner, float &x, float &y, float &z) float temp_x, temp_y, angle; const Map * _map = MapManager::Instance().GetBaseMap(owner.GetMapId()); //primitive path-finding - for(uint8 i = 0; i < 18; i++) + for(uint8 i = 0; i < 18; ++i) { if(i_only_forward && i > 2) break; diff --git a/src/game/GMTicketHandler.cpp b/src/game/GMTicketHandler.cpp index 3a1aefdfd..76dab39cd 100644 --- a/src/game/GMTicketHandler.cpp +++ b/src/game/GMTicketHandler.cpp @@ -123,7 +123,7 @@ void WorldSession::HandleGMTicketCreateOpcode( WorldPacket & recv_data ) //TODO: Guard player map HashMapHolder::MapType &m = ObjectAccessor::Instance().GetPlayers(); - for(HashMapHolder::MapType::iterator itr = m.begin(); itr != m.end(); ++itr) + for(HashMapHolder::MapType::const_iterator itr = m.begin(); itr != m.end(); ++itr) { if(itr->second->GetSession()->GetSecurity() >= SEC_GAMEMASTER && itr->second->isAcceptTickets()) ChatHandler(itr->second).PSendSysMessage(LANG_COMMAND_TICKETNEW,GetPlayer()->GetName()); diff --git a/src/game/GMTicketMgr.cpp b/src/game/GMTicketMgr.cpp index e122daac8..621c18b42 100644 --- a/src/game/GMTicketMgr.cpp +++ b/src/game/GMTicketMgr.cpp @@ -70,7 +70,7 @@ void GMTicketMgr::LoadGMTickets() void GMTicketMgr::DeleteAll() { - for(GMTicketMap::iterator itr = m_GMTicketMap.begin(); itr != m_GMTicketMap.end(); ++itr) + for(GMTicketMap::const_iterator itr = m_GMTicketMap.begin(); itr != m_GMTicketMap.end(); ++itr) { if(Player* owner = objmgr.GetPlayer(MAKE_NEW_GUID(itr->first,0,HIGHGUID_PLAYER))) owner->GetSession()->SendGMTicketGetTicket(0x0A,0); diff --git a/src/game/GameObject.cpp b/src/game/GameObject.cpp index 600d74b66..a0b49afce 100644 --- a/src/game/GameObject.cpp +++ b/src/game/GameObject.cpp @@ -383,8 +383,8 @@ void GameObject::Update(uint32 /*p_time*/) if(spellId) { - std::set::iterator it = m_unique_users.begin(); - std::set::iterator end = m_unique_users.end(); + std::set::const_iterator it = m_unique_users.begin(); + std::set::const_iterator end = m_unique_users.end(); for (; it != end; it++) { Unit* owner = Unit::GetUnit(*this, uint64(*it)); @@ -902,7 +902,7 @@ void GameObject::Use(Unit* user) // every slot will be on that straight line float orthogonalOrientation = GetOrientation()+M_PI*0.5f; // find nearest slot - for(uint32 i=0; ichair.slots; i++) + for(uint32 i=0; ichair.slots; ++i) { // the distance between this slot and the center of the go - imagine a 1D space float relativeDistance = (info->size*i)-(info->size*(info->chair.slots-1)/2.0f); diff --git a/src/game/GossipDef.cpp b/src/game/GossipDef.cpp index 2eefba679..ec3107cbe 100644 --- a/src/game/GossipDef.cpp +++ b/src/game/GossipDef.cpp @@ -130,7 +130,7 @@ void PlayerMenu::SendGossipMenu( uint32 TitleTextId, uint64 npcGUID ) data << uint32( TitleTextId ); data << uint32( mGossipMenu.MenuItemCount() ); // max count 0x0F - for ( unsigned int iI = 0; iI < mGossipMenu.MenuItemCount(); iI++ ) + for (int iI = 0; iI < mGossipMenu.MenuItemCount(); ++iI ) { GossipMenuItem const& gItem = mGossipMenu.GetItem(iI); data << uint32( iI ); @@ -143,7 +143,7 @@ void PlayerMenu::SendGossipMenu( uint32 TitleTextId, uint64 npcGUID ) data << uint32( mQuestMenu.MenuItemCount() ); // max count 0x20 - for ( uint16 iI = 0; iI < mQuestMenu.MenuItemCount(); iI++ ) + for ( int iI = 0; iI < mQuestMenu.MenuItemCount(); ++iI ) { QuestMenuItem const& qItem = mQuestMenu.GetItem(iI); uint32 questID = qItem.m_qId; @@ -253,7 +253,7 @@ void PlayerMenu::SendTalking( uint32 textID ) else { std::string Text_0[8],Text_1[8]; - for (int i=0;i<8;i++) + for (int i=0;i<8;++i) { Text_0[i]=pGossip->Options[i].Text_0; Text_1[i]=pGossip->Options[i].Text_1; @@ -264,7 +264,7 @@ void PlayerMenu::SendTalking( uint32 textID ) NpcTextLocale const *nl = objmgr.GetNpcTextLocale(textID); if (nl) { - for (int i=0;i<8;i++) + for (int i=0;i<8;++i) { if (nl->Text_0[i].size() > loc_idx && !nl->Text_0[i][loc_idx].empty()) Text_0[i]=nl->Text_0[i][loc_idx]; @@ -273,7 +273,7 @@ void PlayerMenu::SendTalking( uint32 textID ) } } } - for (int i=0; i<8; i++) + for (int i=0; i<8; ++i) { data << pGossip->Options[i].Probability; @@ -355,7 +355,7 @@ void QuestMenu::AddMenuItem( uint32 QuestId, uint8 Icon) bool QuestMenu::HasItem( uint32 questid ) { - for (QuestMenuItemList::iterator i = m_qItems.begin(); i != m_qItems.end(); ++i) + for (QuestMenuItemList::const_iterator i = m_qItems.begin(); i != m_qItems.end(); ++i) { if(i->m_qId==questid) { @@ -379,7 +379,7 @@ void PlayerMenu::SendQuestGiverQuestList( QEmote eEmote, const std::string& Titl data << uint32(eEmote._Emote ); // NPC emote data << uint8 ( mQuestMenu.MenuItemCount() ); - for ( uint16 iI = 0; iI < mQuestMenu.MenuItemCount(); iI++ ) + for ( int iI = 0; iI < mQuestMenu.MenuItemCount(); ++iI ) { QuestMenuItem const& qmi = mQuestMenu.GetItem(iI); @@ -464,7 +464,7 @@ void PlayerMenu::SendQuestGiverQuestDetails( Quest const *pQuest, uint64 npcGUID ItemPrototype const* IProto; data << uint32(pQuest->GetRewChoiceItemsCount()); - for (uint32 i=0; i < QUEST_REWARD_CHOICES_COUNT; i++) + for (uint32 i=0; i < QUEST_REWARD_CHOICES_COUNT; ++i) { if ( !pQuest->RewChoiceItemId[i] ) continue; data << uint32(pQuest->RewChoiceItemId[i]); @@ -477,7 +477,7 @@ void PlayerMenu::SendQuestGiverQuestDetails( Quest const *pQuest, uint64 npcGUID } data << uint32(pQuest->GetRewItemsCount()); - for (uint32 i=0; i < QUEST_REWARDS_COUNT; i++) + for (uint32 i=0; i < QUEST_REWARDS_COUNT; ++i) { if ( !pQuest->RewItemId[i] ) continue; data << uint32(pQuest->RewItemId[i]); @@ -500,7 +500,7 @@ void PlayerMenu::SendQuestGiverQuestDetails( Quest const *pQuest, uint64 npcGUID data << uint32(pQuest->GetBonusTalents()); // bonus talents data << uint32(QUEST_EMOTE_COUNT); - for (uint32 i=0; i < QUEST_EMOTE_COUNT; i++) + for (uint32 i=0; i < QUEST_EMOTE_COUNT; ++i) { data << uint32(pQuest->DetailsEmote[i]); data << uint32(0); // DetailsEmoteDelay @@ -518,7 +518,7 @@ void PlayerMenu::SendQuestQueryResponse( Quest const *pQuest ) Details = pQuest->GetDetails(); Objectives = pQuest->GetObjectives(); EndText = pQuest->GetEndText(); - for (int i=0;iObjectiveText[i]; int loc_idx = pSession->GetSessionDbLocaleIndex(); @@ -536,7 +536,7 @@ void PlayerMenu::SendQuestQueryResponse( Quest const *pQuest ) if (ql->EndText.size() > loc_idx && !ql->EndText[loc_idx].empty()) EndText=ql->EndText[loc_idx]; - for (int i=0;iObjectiveText[i].size() > loc_idx && !ql->ObjectiveText[i][loc_idx].empty()) ObjectiveText[i]=ql->ObjectiveText[i][loc_idx]; } @@ -581,19 +581,19 @@ void PlayerMenu::SendQuestQueryResponse( Quest const *pQuest ) if (pQuest->HasFlag(QUEST_FLAGS_HIDDEN_REWARDS)) { - for (iI = 0; iI < QUEST_REWARDS_COUNT; iI++) + for (iI = 0; iI < QUEST_REWARDS_COUNT; ++iI) data << uint32(0) << uint32(0); - for (iI = 0; iI < QUEST_REWARD_CHOICES_COUNT; iI++) + for (iI = 0; iI < QUEST_REWARD_CHOICES_COUNT; ++iI) data << uint32(0) << uint32(0); } else { - for (iI = 0; iI < QUEST_REWARDS_COUNT; iI++) + for (iI = 0; iI < QUEST_REWARDS_COUNT; ++iI) { data << uint32(pQuest->RewItemId[iI]); data << uint32(pQuest->RewItemCount[iI]); } - for (iI = 0; iI < QUEST_REWARD_CHOICES_COUNT; iI++) + for (iI = 0; iI < QUEST_REWARD_CHOICES_COUNT; ++iI) { data << uint32(pQuest->RewChoiceItemId[iI]); data << uint32(pQuest->RewChoiceItemCount[iI]); @@ -610,7 +610,7 @@ void PlayerMenu::SendQuestQueryResponse( Quest const *pQuest ) data << Details; data << EndText; - for (iI = 0; iI < QUEST_OBJECTIVES_COUNT; iI++) + for (iI = 0; iI < QUEST_OBJECTIVES_COUNT; ++iI) { if (pQuest->ReqCreatureOrGOId[iI] < 0) { @@ -634,7 +634,7 @@ void PlayerMenu::SendQuestQueryResponse( Quest const *pQuest ) data << uint32(0); // TODO: 5 item objective data << uint32(0); - for (iI = 0; iI < QUEST_OBJECTIVES_COUNT; iI++) + for (iI = 0; iI < QUEST_OBJECTIVES_COUNT; ++iI) data << ObjectiveText[iI]; pSession->SendPacket( &data ); @@ -670,7 +670,7 @@ void PlayerMenu::SendQuestGiverOfferReward( Quest const* pQuest, uint64 npcGUID, data << uint32(0); // unk uint32 EmoteCount = 0; - for (uint32 i = 0; i < QUEST_EMOTE_COUNT; i++) + for (uint32 i = 0; i < QUEST_EMOTE_COUNT; ++i) { if(pQuest->OfferRewardEmote[i] <= 0) break; @@ -678,7 +678,7 @@ void PlayerMenu::SendQuestGiverOfferReward( Quest const* pQuest, uint64 npcGUID, } data << EmoteCount; // Emote Count - for (uint32 i = 0; i < EmoteCount; i++) + for (uint32 i = 0; i < EmoteCount; ++i) { data << uint32(0); // Delay Emote data << pQuest->OfferRewardEmote[i]; @@ -687,7 +687,7 @@ void PlayerMenu::SendQuestGiverOfferReward( Quest const* pQuest, uint64 npcGUID, ItemPrototype const *pItem; data << uint32(pQuest->GetRewChoiceItemsCount()); - for (uint32 i=0; i < pQuest->GetRewChoiceItemsCount(); i++) + for (uint32 i=0; i < pQuest->GetRewChoiceItemsCount(); ++i) { pItem = objmgr.GetItemPrototype( pQuest->RewChoiceItemId[i] ); @@ -701,7 +701,7 @@ void PlayerMenu::SendQuestGiverOfferReward( Quest const* pQuest, uint64 npcGUID, } data << uint32(pQuest->GetRewItemsCount()); - for (uint16 i=0; i < pQuest->GetRewItemsCount(); i++) + for (uint16 i=0; i < pQuest->GetRewItemsCount(); ++i) { pItem = objmgr.GetItemPrototype(pQuest->RewItemId[i]); data << uint32(pQuest->RewItemId[i]); @@ -780,7 +780,7 @@ void PlayerMenu::SendQuestGiverRequestItems( Quest const *pQuest, uint64 npcGUID data << uint32( pQuest->GetReqItemsCount() ); ItemPrototype const *pItem; - for (int i = 0; i < QUEST_OBJECTIVES_COUNT; i++) + for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) { if ( !pQuest->ReqItemId[i] ) continue; pItem = objmgr.GetItemPrototype(pQuest->ReqItemId[i]); diff --git a/src/game/Group.cpp b/src/game/Group.cpp index c2e81576d..46863ce76 100644 --- a/src/game/Group.cpp +++ b/src/game/Group.cpp @@ -44,7 +44,7 @@ Group::Group() m_lootThreshold = ITEM_QUALITY_UNCOMMON; m_subGroupsCounts = NULL; - for(int i=0; isecond.save->RemoveGroup(this); @@ -154,7 +154,7 @@ bool Group::LoadGroupFromDB(const uint64 &leaderGuid, QueryResult *result, bool m_looterGuid = MAKE_NEW_GUID((*result)[3].GetUInt32(), 0, HIGHGUID_PLAYER); m_lootThreshold = (ItemQualities)(*result)[4].GetUInt16(); - for(int i=0; iguid); if(player) { - for(uint8 i = 0; i < TOTAL_DIFFICULTIES; i++) + for(uint8 i = 0; i < TOTAL_DIFFICULTIES; ++i) { for(BoundInstancesMap::iterator itr = m_boundInstances[i].begin(); itr != m_boundInstances[i].end();) { diff --git a/src/game/Guild.cpp b/src/game/Guild.cpp index d49b6bf2b..d97616270 100644 --- a/src/game/Guild.cpp +++ b/src/game/Guild.cpp @@ -544,7 +544,7 @@ void Guild::BroadcastToOfficers(WorldSession *session, const std::string& msg, u { if (session && session->GetPlayer() && HasRankRight(session->GetPlayer()->GetRank(),GR_RIGHT_OFFCHATSPEAK)) { - for(MemberList::iterator itr = members.begin(); itr != members.end(); ++itr) + for(MemberList::const_iterator itr = members.begin(); itr != members.end(); ++itr) { WorldPacket data; ChatHandler::FillMessageData(&data, session, CHAT_MSG_OFFICER, language, NULL, 0, msg.c_str(),NULL); @@ -559,7 +559,7 @@ void Guild::BroadcastToOfficers(WorldSession *session, const std::string& msg, u void Guild::BroadcastPacket(WorldPacket *packet) { - for(MemberList::iterator itr = members.begin(); itr != members.end(); ++itr) + for(MemberList::const_iterator itr = members.begin(); itr != members.end(); ++itr) { Player *player = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(itr->first, 0, HIGHGUID_PLAYER)); if(player) @@ -569,7 +569,7 @@ void Guild::BroadcastPacket(WorldPacket *packet) void Guild::BroadcastPacketToRank(WorldPacket *packet, uint32 rankId) { - for(MemberList::iterator itr = members.begin(); itr != members.end(); ++itr) + for(MemberList::const_iterator itr = members.begin(); itr != members.end(); ++itr) { if (itr->second.RankId == rankId) { @@ -656,7 +656,7 @@ void Guild::SetRankRights(uint32 rankId, uint32 rights) int32 Guild::GetRank(uint32 LowGuid) { - MemberList::iterator itr = members.find(LowGuid); + MemberList::const_iterator itr = members.find(LowGuid); if (itr==members.end()) return -1; @@ -671,7 +671,7 @@ void Guild::Disband() while (!members.empty()) { - MemberList::iterator itr = members.begin(); + MemberList::const_iterator itr = members.begin(); DelMember(MAKE_NEW_GUID(itr->first, 0, HIGHGUID_PLAYER), true); } diff --git a/src/game/Item.cpp b/src/game/Item.cpp index 473fc3ddb..2d25b7f0f 100644 --- a/src/game/Item.cpp +++ b/src/game/Item.cpp @@ -299,7 +299,7 @@ void Item::SaveToDB() CharacterDatabase.PExecute( "DELETE FROM item_instance WHERE guid = '%u'", guid ); std::ostringstream ss; ss << "INSERT INTO item_instance (guid,owner_guid,data) VALUES (" << guid << "," << GUID_LOPART(GetOwnerGUID()) << ",'"; - for(uint16 i = 0; i < m_valuesCount; i++ ) + for(uint16 i = 0; i < m_valuesCount; ++i ) ss << GetUInt32Value(i) << " "; ss << "' )"; CharacterDatabase.Execute( ss.str().c_str() ); @@ -308,7 +308,7 @@ void Item::SaveToDB() { std::ostringstream ss; ss << "UPDATE item_instance SET data = '"; - for(uint16 i = 0; i < m_valuesCount; i++ ) + for(uint16 i = 0; i < m_valuesCount; ++i ) ss << GetUInt32Value(i) << " "; ss << "', owner_guid = '" << GUID_LOPART(GetOwnerGUID()) << "' WHERE guid = '" << guid << "'"; @@ -409,7 +409,7 @@ bool Item::LoadFromDB(uint32 guid, uint64 owner_guid, QueryResult *result) { std::ostringstream ss; ss << "UPDATE item_instance SET data = '"; - for(uint16 i = 0; i < m_valuesCount; i++ ) + for(uint16 i = 0; i < m_valuesCount; ++i ) ss << GetUInt32Value(i) << " "; ss << "', owner_guid = '" << GUID_LOPART(GetOwnerGUID()) << "' WHERE guid = '" << guid << "'"; diff --git a/src/game/ItemEnchantmentMgr.cpp b/src/game/ItemEnchantmentMgr.cpp index ea9e7ef18..aa81d9189 100644 --- a/src/game/ItemEnchantmentMgr.cpp +++ b/src/game/ItemEnchantmentMgr.cpp @@ -48,7 +48,7 @@ void LoadRandomEnchantmentsTable() { RandomItemEnch.clear(); // for reload case - EnchantmentStore::iterator tab; + EnchantmentStore::const_iterator tab; uint32 entry, ench; float chance; uint32 count = 0; @@ -90,7 +90,7 @@ uint32 GetItemEnchantMod(uint32 entry) { if (!entry) return 0; - EnchantmentStore::iterator tab = RandomItemEnch.find(entry); + EnchantmentStore::const_iterator tab = RandomItemEnch.find(entry); if (tab == RandomItemEnch.end()) { @@ -101,7 +101,7 @@ uint32 GetItemEnchantMod(uint32 entry) double dRoll = rand_chance(); float fCount = 0; - for(EnchStoreList::iterator ench_iter = tab->second.begin(); ench_iter != tab->second.end(); ++ench_iter) + for(EnchStoreList::const_iterator ench_iter = tab->second.begin(); ench_iter != tab->second.end(); ++ench_iter) { fCount += ench_iter->chance; @@ -112,7 +112,7 @@ uint32 GetItemEnchantMod(uint32 entry) dRoll = (irand(0, (int)floor(fCount * 100) + 1)) / 100; fCount = 0; - for(EnchStoreList::iterator ench_iter = tab->second.begin(); ench_iter != tab->second.end(); ++ench_iter) + for(EnchStoreList::const_iterator ench_iter = tab->second.begin(); ench_iter != tab->second.end(); ++ench_iter) { fCount += ench_iter->chance; diff --git a/src/game/Level0.cpp b/src/game/Level0.cpp index c0c9aab8c..5854381fc 100644 --- a/src/game/Level0.cpp +++ b/src/game/Level0.cpp @@ -154,7 +154,7 @@ bool ChatHandler::HandleGMListIngameCommand(const char* /*args*/) bool first = true; HashMapHolder::MapType &m = HashMapHolder::GetContainer(); - HashMapHolder::MapType::iterator itr = m.begin(); + HashMapHolder::MapType::const_iterator itr = m.begin(); for(; itr != m.end(); ++itr) { if (itr->second->GetSession()->GetSecurity() && diff --git a/src/game/Level2.cpp b/src/game/Level2.cpp index cc4117c13..654e9d964 100644 --- a/src/game/Level2.cpp +++ b/src/game/Level2.cpp @@ -1915,7 +1915,7 @@ bool ChatHandler::HandleNpcNameCommand(const char* /*args*/) return true; } - for (uint8 i = 0; i < strlen(args); i++) + for (uint8 i = 0; i < strlen(args); ++i) { if(!isalpha(args[i]) && args[i]!=' ') { diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp index 58d2d61bb..12e7b566b 100644 --- a/src/game/Level3.cpp +++ b/src/game/Level3.cpp @@ -1747,7 +1747,7 @@ bool ChatHandler::HandleLearnAllMySpellsCommand(const char* /*args*/) return true; uint32 family = clsEntry->spellfamily; - for (uint32 i = 0; i < sSpellStore.GetNumRows(); i++) + for (uint32 i = 0; i < sSpellStore.GetNumRows(); ++i) { SpellEntry const *spellInfo = sSpellStore.LookupEntry(i); if(!spellInfo) @@ -1786,7 +1786,7 @@ bool ChatHandler::HandleLearnAllMyTalentsCommand(const char* /*args*/) Player* player = m_session->GetPlayer(); uint32 classMask = player->getClassMask(); - for (uint32 i = 0; i < sTalentStore.GetNumRows(); i++) + for (uint32 i = 0; i < sTalentStore.GetNumRows(); ++i) { TalentEntry const *talentInfo = sTalentStore.LookupEntry(i); if(!talentInfo) @@ -1861,7 +1861,7 @@ bool ChatHandler::HandleLearnAllMyPetTalentsCommand(const char* /*args*/) return false; } - for (uint32 i = 0; i < sTalentStore.GetNumRows(); i++) + for (uint32 i = 0; i < sTalentStore.GetNumRows(); ++i) { TalentEntry const *talentInfo = sTalentStore.LookupEntry(i); if(!talentInfo) @@ -3496,7 +3496,7 @@ bool ChatHandler::HandleAuraCommand(const char* args) SpellEntry const *spellInfo = sSpellStore.LookupEntry( spellID ); if(spellInfo) { - for(uint32 i = 0;i<3;i++) + for(uint32 i = 0;i<3;++i) { uint8 eff = spellInfo->Effect[i]; if (eff>=TOTAL_SPELL_EFFECTS) @@ -3862,7 +3862,7 @@ bool ChatHandler::HandleExploreCheatCommand(const char* args) ChatHandler(chr).PSendSysMessage(LANG_YOURS_EXPLORE_SET_NOTHING,GetNameLink().c_str()); } - for (uint8 i=0; i<128; i++) + for (uint8 i=0; i<128; ++i) { if (flag != 0) { @@ -4516,7 +4516,7 @@ bool ChatHandler::HandleListAurasCommand (const char * /*args*/) IS_PLAYER_GUID(itr->second->GetCasterGUID()) ? "player" : "creature",GUID_LOPART(itr->second->GetCasterGUID())); } } - for (int i = 0; i < TOTAL_AURAS; i++) + for (int i = 0; i < TOTAL_AURAS; ++i) { Unit::AuraList const& uAuraList = unit->GetAurasByType(AuraType(i)); if (uAuraList.empty()) continue; @@ -5209,7 +5209,7 @@ bool ChatHandler::HandleQuestComplete(const char* args) } // All creature/GO slain/casted (not required, but otherwise it will display "Creature slain 0/10") - for(uint8 i = 0; i < QUEST_OBJECTIVES_COUNT; i++) + for(uint8 i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) { uint32 creature = pQuest->ReqCreatureOrGOId[i]; uint32 creaturecount = pQuest->ReqCreatureOrGOCount[i]; @@ -6320,10 +6320,10 @@ bool ChatHandler::HandleInstanceListBindsCommand(const char* /*args*/) Player* player = getSelectedPlayer(); if (!player) player = m_session->GetPlayer(); uint32 counter = 0; - for(uint8 i = 0; i < TOTAL_DIFFICULTIES; i++) + for(uint8 i = 0; i < TOTAL_DIFFICULTIES; ++i) { Player::BoundInstancesMap &binds = player->GetBoundInstances(i); - for(Player::BoundInstancesMap::iterator itr = binds.begin(); itr != binds.end(); ++itr) + for(Player::BoundInstancesMap::const_iterator itr = binds.begin(); itr != binds.end(); ++itr) { InstanceSave *save = itr->second.save; std::string timeleft = GetTimeString(save->GetResetTime() - time(NULL)); @@ -6336,10 +6336,10 @@ bool ChatHandler::HandleInstanceListBindsCommand(const char* /*args*/) Group *group = player->GetGroup(); if(group) { - for(uint8 i = 0; i < TOTAL_DIFFICULTIES; i++) + for(uint8 i = 0; i < TOTAL_DIFFICULTIES; ++i) { Group::BoundInstancesMap &binds = group->GetBoundInstances(i); - for(Group::BoundInstancesMap::iterator itr = binds.begin(); itr != binds.end(); ++itr) + for(Group::BoundInstancesMap::const_iterator itr = binds.begin(); itr != binds.end(); ++itr) { InstanceSave *save = itr->second.save; std::string timeleft = GetTimeString(save->GetResetTime() - time(NULL)); @@ -6364,7 +6364,7 @@ bool ChatHandler::HandleInstanceUnbindCommand(const char* args) Player* player = getSelectedPlayer(); if (!player) player = m_session->GetPlayer(); uint32 counter = 0; - for(uint8 i = 0; i < TOTAL_DIFFICULTIES; i++) + for(uint8 i = 0; i < TOTAL_DIFFICULTIES; ++i) { Player::BoundInstancesMap &binds = player->GetBoundInstances(i); for(Player::BoundInstancesMap::iterator itr = binds.begin(); itr != binds.end();) diff --git a/src/game/LootHandler.cpp b/src/game/LootHandler.cpp index 6d3191a27..69b9a1f1c 100644 --- a/src/game/LootHandler.cpp +++ b/src/game/LootHandler.cpp @@ -217,7 +217,7 @@ void WorldSession::HandleLootMoneyOpcode( WorldPacket & /*recv_data*/ ) uint32 money_per_player = uint32((pLoot->gold)/(playersNear.size())); - for (std::vector::iterator i = playersNear.begin(); i != playersNear.end(); ++i) + for (std::vector::const_iterator i = playersNear.begin(); i != playersNear.end(); ++i) { (*i)->ModifyMoney( money_per_player ); (*i)->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_MONEY, money_per_player); diff --git a/src/game/LootMgr.cpp b/src/game/LootMgr.cpp index 0eba205f2..b872c14e0 100644 --- a/src/game/LootMgr.cpp +++ b/src/game/LootMgr.cpp @@ -89,7 +89,7 @@ void LootStore::Verify() const // All checks of the loaded template are called from here, no error reports at loot generation required void LootStore::LoadLootTable() { - LootTemplateMap::iterator tab; + LootTemplateMap::const_iterator tab; uint32 count = 0; // Clearing store (for reloading case) @@ -148,7 +148,7 @@ void LootStore::LoadLootTable() tab = m_LootTemplates.find(entry); if ( tab == m_LootTemplates.end() ) { - std::pair< LootTemplateMap::iterator, bool > pr = m_LootTemplates.insert(LootTemplateMap::value_type(entry, new LootTemplate)); + std::pair< LootTemplateMap::const_iterator, bool > pr = m_LootTemplates.insert(LootTemplateMap::value_type(entry, new LootTemplate)); tab = pr.first; } } @@ -422,7 +422,7 @@ void Loot::FillNotNormalLootFor(Player* pl) { uint32 plguid = pl->GetGUIDLow(); - QuestItemMap::iterator qmapitr = PlayerQuestItems.find(plguid); + QuestItemMap::const_iterator qmapitr = PlayerQuestItems.find(plguid); if (qmapitr == PlayerQuestItems.end()) FillQuestLoot(pl); @@ -439,7 +439,7 @@ QuestItemList* Loot::FillFFALoot(Player* player) { QuestItemList *ql = new QuestItemList(); - for(uint8 i = 0; i < items.size(); i++) + for(uint8 i = 0; i < items.size(); ++i) { LootItem &item = items[i]; if(!item.is_looted && item.freeforall && item.AllowedForPlayer(player) ) @@ -463,7 +463,7 @@ QuestItemList* Loot::FillQuestLoot(Player* player) if (items.size() == MAX_NR_LOOT_ITEMS) return NULL; QuestItemList *ql = new QuestItemList(); - for(uint8 i = 0; i < quest_items.size(); i++) + for(uint8 i = 0; i < quest_items.size(); ++i) { LootItem &item = quest_items[i]; if(!item.is_looted && item.AllowedForPlayer(player) ) @@ -567,7 +567,7 @@ void Loot::NotifyQuestItemRemoved(uint8 questIndex) ++i_next; if(Player* pl = ObjectAccessor::FindPlayer(*i)) { - QuestItemMap::iterator pq = PlayerQuestItems.find(pl->GetGUIDLow()); + QuestItemMap::const_iterator pq = PlayerQuestItems.find(pl->GetGUIDLow()); if (pq != PlayerQuestItems.end() && pq->second) { // find where/if the player has the given item in it's vector @@ -626,7 +626,7 @@ LootItem* Loot::LootItemInSlot(uint32 lootSlot, Player* player, QuestItem **qite QuestItemMap::const_iterator itr = PlayerFFAItems.find(player->GetGUIDLow()); if (itr != PlayerFFAItems.end()) { - for(QuestItemList::iterator iter=itr->second->begin(); iter!= itr->second->end(); ++iter) + for(QuestItemList::const_iterator iter=itr->second->begin(); iter!= itr->second->end(); ++iter) if(iter->index==lootSlot) { QuestItem *ffaitem2 = (QuestItem*)&(*iter); @@ -642,7 +642,7 @@ LootItem* Loot::LootItemInSlot(uint32 lootSlot, Player* player, QuestItem **qite QuestItemMap::const_iterator itr = PlayerNonQuestNonFFAConditionalItems.find(player->GetGUIDLow()); if (itr != PlayerNonQuestNonFFAConditionalItems.end()) { - for(QuestItemList::iterator iter=itr->second->begin(); iter!= itr->second->end(); ++iter) + for(QuestItemList::const_iterator iter=itr->second->begin(); iter!= itr->second->end(); ++iter) { if(iter->index==lootSlot) { @@ -742,7 +742,7 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv) if (q_itr != lootPlayerQuestItems.end()) { QuestItemList *q_list = q_itr->second; - for (QuestItemList::iterator qi = q_list->begin() ; qi != q_list->end(); ++qi) + for (QuestItemList::const_iterator qi = q_list->begin() ; qi != q_list->end(); ++qi) { LootItem &item = l.quest_items[qi->index]; if (!qi->is_looted && !item.is_looted) @@ -760,7 +760,7 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv) if (ffa_itr != lootPlayerFFAItems.end()) { QuestItemList *ffa_list = ffa_itr->second; - for (QuestItemList::iterator fi = ffa_list->begin() ; fi != ffa_list->end(); ++fi) + for (QuestItemList::const_iterator fi = ffa_list->begin() ; fi != ffa_list->end(); ++fi) { LootItem &item = l.items[fi->index]; if (!fi->is_looted && !item.is_looted) @@ -777,7 +777,7 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv) if (nn_itr != lootPlayerNonQuestNonFFAConditionalItems.end()) { QuestItemList *conditional_list = nn_itr->second; - for (QuestItemList::iterator ci = conditional_list->begin() ; ci != conditional_list->end(); ++ci) + for (QuestItemList::const_iterator ci = conditional_list->begin() ; ci != conditional_list->end(); ++ci) { LootItem &item = l.items[ci->index]; if (!ci->is_looted && !item.is_looted) diff --git a/src/game/LootMgr.h b/src/game/LootMgr.h index b16757d49..40ea2303a 100644 --- a/src/game/LootMgr.h +++ b/src/game/LootMgr.h @@ -237,15 +237,15 @@ struct Loot // void clear(); void clear() { - for (QuestItemMap::iterator itr = PlayerQuestItems.begin(); itr != PlayerQuestItems.end(); ++itr) + for (QuestItemMap::const_iterator itr = PlayerQuestItems.begin(); itr != PlayerQuestItems.end(); ++itr) delete itr->second; PlayerQuestItems.clear(); - for (QuestItemMap::iterator itr = PlayerFFAItems.begin(); itr != PlayerFFAItems.end(); ++itr) + for (QuestItemMap::const_iterator itr = PlayerFFAItems.begin(); itr != PlayerFFAItems.end(); ++itr) delete itr->second; PlayerFFAItems.clear(); - for (QuestItemMap::iterator itr = PlayerNonQuestNonFFAConditionalItems.begin(); itr != PlayerNonQuestNonFFAConditionalItems.end(); ++itr) + for (QuestItemMap::const_iterator itr = PlayerNonQuestNonFFAConditionalItems.begin(); itr != PlayerNonQuestNonFFAConditionalItems.end(); ++itr) delete itr->second; PlayerNonQuestNonFFAConditionalItems.clear(); diff --git a/src/game/Mail.h b/src/game/Mail.h index 9fcb8df4b..ba223a890 100644 --- a/src/game/Mail.h +++ b/src/game/Mail.h @@ -194,11 +194,11 @@ struct Mail } } - bool RemoveItem(uint32 itemId) + bool RemoveItem(uint32 item_guid) { for(std::vector::iterator itr = items.begin(); itr != items.end(); ++itr) { - if(itr->item_guid == itemId) + if(itr->item_guid == item_guid) { items.erase(itr); return true; diff --git a/src/game/Map.cpp b/src/game/Map.cpp index 7de4dfa3f..27b9a21f4 100644 --- a/src/game/Map.cpp +++ b/src/game/Map.cpp @@ -1923,7 +1923,7 @@ void Map::SendInitTransports( Player * player ) bool hasTransport = false; - for (MapManager::TransportSet::iterator i = tset.begin(); i != tset.end(); ++i) + for (MapManager::TransportSet::const_iterator i = tset.begin(); i != tset.end(); ++i) { // send data for current transport in other place if((*i) != player->GetTransport() && (*i)->GetMapId()==i_id) @@ -1952,7 +1952,7 @@ void Map::SendRemoveTransports( Player * player ) MapManager::TransportSet& tset = tmap[player->GetMapId()]; // except used transport - for (MapManager::TransportSet::iterator i = tset.begin(); i != tset.end(); ++i) + for (MapManager::TransportSet::const_iterator i = tset.begin(); i != tset.end(); ++i) if((*i) != player->GetTransport() && (*i)->GetMapId()!=i_id) (*i)->BuildOutOfRangeUpdateBlock(&transData); diff --git a/src/game/MiscHandler.cpp b/src/game/MiscHandler.cpp index cc40850c6..4d8b6067d 100644 --- a/src/game/MiscHandler.cpp +++ b/src/game/MiscHandler.cpp @@ -99,7 +99,7 @@ void WorldSession::HandleWhoOpcode( WorldPacket & recv_data ) // recheck CHECK_PACKET_SIZE(recv_data,4+4+(player_name.size()+1)+(guild_name.size()+1)+4+4+4+(4*zones_count)+4); - for(uint32 i = 0; i < zones_count; i++) + for(uint32 i = 0; i < zones_count; ++i) { uint32 temp; recv_data >> temp; // zone id, 0 if zone is unknown... @@ -118,7 +118,7 @@ void WorldSession::HandleWhoOpcode( WorldPacket & recv_data ) sLog.outDebug("Minlvl %u, maxlvl %u, name %s, guild %s, racemask %u, classmask %u, zones %u, strings %u", level_min, level_max, player_name.c_str(), guild_name.c_str(), racemask, classmask, zones_count, str_count); std::wstring str[4]; // 4 is client limit - for(uint32 i = 0; i < str_count; i++) + for(uint32 i = 0; i < str_count; ++i) { // recheck (have one more byte) CHECK_PACKET_SIZE(recv_data,recv_data.rpos()); @@ -157,7 +157,7 @@ void WorldSession::HandleWhoOpcode( WorldPacket & recv_data ) //TODO: Guard Player map HashMapHolder::MapType& m = ObjectAccessor::Instance().GetPlayers(); - for(HashMapHolder::MapType::iterator itr = m.begin(); itr != m.end(); ++itr) + for(HashMapHolder::MapType::const_iterator itr = m.begin(); itr != m.end(); ++itr) { if (security == SEC_PLAYER) { @@ -192,7 +192,7 @@ void WorldSession::HandleWhoOpcode( WorldPacket & recv_data ) uint32 pzoneid = itr->second->GetZoneId(); bool z_show = true; - for(uint32 i = 0; i < zones_count; i++) + for(uint32 i = 0; i < zones_count; ++i) { if(zoneids[i] == pzoneid) { @@ -228,7 +228,7 @@ void WorldSession::HandleWhoOpcode( WorldPacket & recv_data ) aname = areaEntry->area_name[GetSessionDbcLocale()]; bool s_show = true; - for(uint32 i = 0; i < str_count; i++) + for(uint32 i = 0; i < str_count; ++i) { if (!str[i].empty()) { diff --git a/src/game/MovementHandler.cpp b/src/game/MovementHandler.cpp index 6e586593a..2c0b59e77 100644 --- a/src/game/MovementHandler.cpp +++ b/src/game/MovementHandler.cpp @@ -249,7 +249,7 @@ void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data ) if (plMover && !plMover->m_transport) { // elevators also cause the client to send MOVEMENTFLAG_ONTRANSPORT - just unmount if the guid can be found in the transport list - for (MapManager::TransportSet::iterator iter = MapManager::Instance().m_Transports.begin(); iter != MapManager::Instance().m_Transports.end(); ++iter) + for (MapManager::TransportSet::const_iterator iter = MapManager::Instance().m_Transports.begin(); iter != MapManager::Instance().m_Transports.end(); ++iter) { if ((*iter)->GetGUID() == movementInfo.t_guid) { diff --git a/src/game/Pet.cpp b/src/game/Pet.cpp index 38ca2a200..b8ea6540e 100644 --- a/src/game/Pet.cpp +++ b/src/game/Pet.cpp @@ -59,7 +59,7 @@ Pet::~Pet() { if(m_uint32Values) // only for fully created Object { - for (PetSpellMap::iterator i = m_spells.begin(); i != m_spells.end(); ++i) + for (PetSpellMap::const_iterator i = m_spells.begin(); i != m_spells.end(); ++i) delete i->second; ObjectAccessor::Instance().RemoveObject(this); } @@ -435,14 +435,14 @@ void Pet::SavePetToDB(PetSaveMode mode) << curmana << ", " << GetPower(POWER_HAPPINESS) << ", '"; - for(uint32 i = 0; i < 10; i++) + for(uint32 i = 0; i < 10; ++i) ss << uint32(m_charmInfo->GetActionBarEntry(i)->Type) << " " << uint32(m_charmInfo->GetActionBarEntry(i)->SpellOrAction) << " "; ss << "', '"; //save spells the pet can teach to it's Master { int i = 0; - for(TeachSpellMap::iterator itr = m_teachspells.begin(); i < 4 && itr != m_teachspells.end(); ++i, ++itr) + for(TeachSpellMap::const_iterator itr = m_teachspells.begin(); i < 4 && itr != m_teachspells.end(); ++i, ++itr) ss << itr->first << " " << itr->second << " "; for(; i < 4; ++i) ss << uint32(0) << " " << uint32(0) << " "; @@ -629,7 +629,7 @@ bool Pet::CanTakeMoreActiveSpells(uint32 spellid) chainstartstore[0] = spellmgr.GetFirstSpellInChain(spellid); - for (PetSpellMap::iterator itr = m_spells.begin(); itr != m_spells.end(); ++itr) + for (PetSpellMap::const_iterator itr = m_spells.begin(); itr != m_spells.end(); ++itr) { if(IsPassiveSpell(itr->first)) continue; @@ -932,7 +932,7 @@ bool Pet::InitStatsForLevel(uint32 petlevel) SetModifierValue(UNIT_MOD_ARMOR, BASE_VALUE, float(pInfo->armor)); //SetModifierValue(UNIT_MOD_ATTACK_POWER, BASE_VALUE, float(cinfo->attackpower)); - for( int i = STAT_STRENGTH; i < MAX_STATS; i++) + for( int i = STAT_STRENGTH; i < MAX_STATS; ++i) { SetCreateStat(Stats(i), float(pInfo->stats[i])); } @@ -1124,7 +1124,7 @@ void Pet::_SaveSpells() void Pet::_LoadAuras(uint32 timediff) { m_Auras.clear(); - for (int i = 0; i < TOTAL_AURAS; i++) + for (int i = 0; i < TOTAL_AURAS; ++i) m_modAuras[i].clear(); QueryResult *result = CharacterDatabase.PQuery("SELECT caster_guid,spell,effect_index,stackcount,amount,maxduration,remaintime,remaincharges FROM pet_aura WHERE guid = '%u'",m_charmInfo->GetPetNumber()); @@ -1178,7 +1178,7 @@ void Pet::_LoadAuras(uint32 timediff) if (caster_guid != GetGUID() && IsSingleTargetSpell(spellproto)) continue; - for(uint32 i=0; iEffectApplyAuraName[i] == SPELL_AURA_MOD_STEALTH || spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AREA_AURA_OWNER || spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AREA_AURA_PET ) @@ -1321,7 +1321,7 @@ bool Pet::addSpell(uint32 spell_id, uint16 active, PetSpellState state, PetSpell } else if(uint32 chainstart = spellmgr.GetFirstSpellInChain(spell_id)) { - for (PetSpellMap::iterator itr2 = m_spells.begin(); itr2 != m_spells.end(); ++itr2) + for (PetSpellMap::const_iterator itr2 = m_spells.begin(); itr2 != m_spells.end(); ++itr2) { if(itr2->second->state == PETSPELL_REMOVED) continue; @@ -1466,7 +1466,7 @@ void Pet::InitPetCreateSpells() { m_charmInfo->InitPetActionBar(); - for (PetSpellMap::iterator i = m_spells.begin(); i != m_spells.end(); ++i) + for (PetSpellMap::const_iterator i = m_spells.begin(); i != m_spells.end(); ++i) delete i->second; m_spells.clear(); @@ -1474,7 +1474,7 @@ void Pet::InitPetCreateSpells() PetCreateSpellEntry const* CreateSpells = objmgr.GetPetCreateSpellEntry(GetEntry()); if(CreateSpells) { - for(uint8 i = 0; i < 4; i++) + for(uint8 i = 0; i < 4; ++i) { if(!CreateSpells->spellid[i]) break; @@ -1567,7 +1567,7 @@ bool Pet::resetTalents(bool no_cost) } } - for (unsigned int i = 0; i < sTalentStore.GetNumRows(); i++) + for (unsigned int i = 0; i < sTalentStore.GetNumRows(); ++i) { TalentEntry const *talentInfo = sTalentStore.LookupEntry(i); @@ -1584,7 +1584,7 @@ bool Pet::resetTalents(bool no_cost) for (int j = 0; j < MAX_TALENT_RANK; j++) { - for(PetSpellMap::iterator itr = m_spells.begin(); itr != m_spells.end();) + for(PetSpellMap::const_iterator itr = m_spells.begin(); itr != m_spells.end();) { if(itr->second->state == PETSPELL_REMOVED) { @@ -1671,7 +1671,7 @@ void Pet::ToggleAutocast(uint32 spellid, bool apply) if(apply) { - for (i = 0; i < m_autospells.size() && m_autospells[i] != spellid; i++) + for (i = 0; i < m_autospells.size() && m_autospells[i] != spellid; ++i) ; // just search if (i == m_autospells.size()) @@ -1684,7 +1684,7 @@ void Pet::ToggleAutocast(uint32 spellid, bool apply) else { AutoSpellList::iterator itr2 = m_autospells.begin(); - for (i = 0; i < m_autospells.size() && m_autospells[i] != spellid; i++, itr2++) + for (i = 0; i < m_autospells.size() && m_autospells[i] != spellid; ++i, itr2++) ; // just search if (i < m_autospells.size()) @@ -1752,7 +1752,7 @@ void Pet::CastPetAuras(bool current) if(getPetType() != HUNTER_PET && (getPetType() != SUMMON_PET || owner->getClass() != CLASS_WARLOCK)) return; - for(PetAuraSet::iterator itr = owner->m_petAuras.begin(); itr != owner->m_petAuras.end();) + for(PetAuraSet::const_iterator itr = owner->m_petAuras.begin(); itr != owner->m_petAuras.end();) { PetAura const* pa = *itr; ++itr; diff --git a/src/game/PetAI.cpp b/src/game/PetAI.cpp index 89c9073cd..3fc412c6f 100644 --- a/src/game/PetAI.cpp +++ b/src/game/PetAI.cpp @@ -197,7 +197,7 @@ void PetAI::UpdateAI(const uint32 diff) if (m_creature->GetGlobalCooldown() == 0 && !m_creature->IsNonMeleeSpellCasted(false)) { //Autocast - for (uint8 i = 0; i < m_creature->GetPetAutoSpellSize(); i++) + for (uint8 i = 0; i < m_creature->GetPetAutoSpellSize(); ++i) { uint32 spellID = m_creature->GetPetAutoSpellOnPos(i); if (!spellID) @@ -229,7 +229,7 @@ void PetAI::UpdateAI(const uint32 diff) else { bool spellUsed = false; - for(std::set::iterator tar = m_AllySet.begin(); tar != m_AllySet.end(); ++tar) + for(std::set::const_iterator tar = m_AllySet.begin(); tar != m_AllySet.end(); ++tar) { Unit* Target = ObjectAccessor::GetUnit(*m_creature,*tar); diff --git a/src/game/PetHandler.cpp b/src/game/PetHandler.cpp index 5d2f5d6e7..d57cff527 100644 --- a/src/game/PetHandler.cpp +++ b/src/game/PetHandler.cpp @@ -175,7 +175,7 @@ void WorldSession::HandlePetAction( WorldPacket & recv_data ) return; } - for(uint32 i = 0; i < 3;i++) + for(uint32 i = 0; i < 3;++i) { if(spellInfo->EffectImplicitTargetA[i] == TARGET_ALL_ENEMY_IN_AREA || spellInfo->EffectImplicitTargetA[i] == TARGET_ALL_ENEMY_IN_AREA_INSTANT || spellInfo->EffectImplicitTargetA[i] == TARGET_ALL_ENEMY_IN_AREA_CHANNELED) return; @@ -349,7 +349,7 @@ void WorldSession::HandlePetSetAction( WorldPacket & recv_data ) } count = (recv_data.size() == 24) ? 2 : 1; - for(uint8 i = 0; i < count; i++) + for(uint8 i = 0; i < count; ++i) { recv_data >> position; recv_data >> spell_id; diff --git a/src/game/PetitionsHandler.cpp b/src/game/PetitionsHandler.cpp index 2dc05079a..e5da6cf84 100644 --- a/src/game/PetitionsHandler.cpp +++ b/src/game/PetitionsHandler.cpp @@ -277,7 +277,7 @@ void WorldSession::HandlePetitionShowSignOpcode(WorldPacket & recv_data) data << petitionguid_low; // guild guid (in mangos always same as GUID_LOPART(petitionguid) data << signs; // sign's count - for(uint8 i = 1; i <= signs; i++) + for(uint8 i = 1; i <= signs; ++i) { Field *fields2 = result->Fetch(); uint64 plguid = fields2[0].GetUInt64(); @@ -688,7 +688,7 @@ void WorldSession::HandleOfferPetitionOpcode(WorldPacket & recv_data) data << GUID_LOPART(petitionguid); // guild guid (in mangos always same as GUID_LOPART(petition guid) data << signs; // sign's count - for(uint8 i = 1; i <= signs; i++) + for(uint8 i = 1; i <= signs; ++i) { Field *fields2 = result->Fetch(); plguid = fields2[0].GetUInt64(); @@ -957,7 +957,7 @@ void WorldSession::SendPetitionShowList(uint64 guid) data << uint32(5); // unknown data << uint32(5); // required signs? } - //for(uint8 i = 0; i < count; i++) + //for(uint8 i = 0; i < count; ++i) //{ // data << uint32(i); // index // data << uint32(GUILD_CHARTER); // charter entry diff --git a/src/game/Player.cpp b/src/game/Player.cpp index c15c2004f..6f9e274ea 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -184,12 +184,12 @@ void PlayerTaxi::AppendTaximaskTo( ByteBuffer& data, bool all ) { if(all) { - for (uint8 i=0; isecond; //all mailed items should be deleted, also all mail should be deallocated - for (PlayerMails::iterator itr = m_mail.begin(); itr != m_mail.end();++itr) + for (PlayerMails::const_iterator itr = m_mail.begin(); itr != m_mail.end();++itr) delete *itr; - for (ItemMap::iterator iter = mMitems.begin(); iter != mMitems.end(); ++iter) + for (ItemMap::const_iterator iter = mMitems.begin(); iter != mMitems.end(); ++iter) delete iter->second; //if item is duplicated... then server may crash ... but that item should be deallocated delete PlayerTalkClass; @@ -503,7 +503,7 @@ Player::~Player () delete ItemSetEff[x]; // clean up player-instance binds, may unload some instance saves - for(uint8 i = 0; i < TOTAL_DIFFICULTIES; i++) + for(uint8 i = 0; i < TOTAL_DIFFICULTIES; ++i) for(BoundInstancesMap::iterator itr = m_boundInstances[i].begin(); itr != m_boundInstances[i].end(); ++itr) itr->second.save->RemovePlayer(this); @@ -536,7 +536,7 @@ bool Player::Create( uint32 guidlow, const std::string& name, uint8 race, uint8 return false; } - for (int i = 0; i < PLAYER_SLOTS_COUNT; i++) + for (int i = 0; i < PLAYER_SLOTS_COUNT; ++i) m_items[i] = NULL; m_race = race; @@ -657,18 +657,18 @@ bool Player::Create( uint32 guidlow, const std::string& name, uint8 race, uint8 // original action bar std::list::const_iterator action_itr[4]; - for(int i=0; i<4; i++) + for(int i=0; i<4; ++i) action_itr[i] = info->action[i].begin(); for (; action_itr[0]!=info->action[0].end() && action_itr[1]!=info->action[1].end();) { uint16 taction[4]; - for(int i=0; i<4 ;i++) + for(int i=0; i<4 ;++i) taction[i] = (*action_itr[i]); addActionButton((uint8)taction[0], taction[1], (uint8)taction[2], (uint8)taction[3]); - for(int i=0; i<4 ;i++) + for(int i=0; i<4 ;++i) ++action_itr[i]; } @@ -735,7 +735,7 @@ bool Player::Create( uint32 guidlow, const std::string& name, uint8 race, uint8 // bags and main-hand weapon must equipped at this moment // now second pass for not equipped (offhand weapon/shield if it attempt equipped before main-hand weapon) // or ammo not equipped in special bag - for(int i = INVENTORY_SLOT_ITEM_START; i < INVENTORY_SLOT_ITEM_END; i++) + for(int i = INVENTORY_SLOT_ITEM_START; i < INVENTORY_SLOT_ITEM_END; ++i) { if(Item* pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i )) { @@ -1741,7 +1741,7 @@ void Player::AddToWorld() ///- The player should only be added when logging in Unit::AddToWorld(); - for(int i = PLAYER_SLOT_START; i < PLAYER_SLOT_END; i++) + for(int i = PLAYER_SLOT_START; i < PLAYER_SLOT_END; ++i) { if(m_items[i]) m_items[i]->AddToWorld(); @@ -1760,7 +1760,7 @@ void Player::RemoveFromWorld() RemoveGuardians(); } - for(int i = PLAYER_SLOT_START; i < PLAYER_SLOT_END; i++) + for(int i = PLAYER_SLOT_START; i < PLAYER_SLOT_END; ++i) { if(m_items[i]) m_items[i]->RemoveFromWorld(); @@ -2375,7 +2375,7 @@ void Player::InitStatsForLevel(bool reapplyMods) SetUInt32Value(index, 0); SetUInt32Value(PLAYER_FIELD_MOD_HEALING_DONE_POS,0); - for (int i = 0; i < 7; i++) + for (int i = 0; i < 7; ++i) { SetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG+i, 0); SetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS+i, 0); @@ -2422,7 +2422,7 @@ void Player::InitStatsForLevel(bool reapplyMods) SetResistanceBuffMods(SpellSchools(0), true, 0.0f); SetResistanceBuffMods(SpellSchools(0), false, 0.0f); // set other resistance to original value (0) - for (int i = 1; i < MAX_SPELL_SCHOOL; i++) + for (int i = 1; i < MAX_SPELL_SCHOOL; ++i) { SetResistance(SpellSchools(i), 0); SetResistanceBuffMods(SpellSchools(i), true, 0.0f); @@ -2437,13 +2437,13 @@ void Player::InitStatsForLevel(bool reapplyMods) SetFloatValue(UNIT_FIELD_POWER_COST_MULTIPLIER+i,0.0f); } // Reset no reagent cost field - for(int i = 0; i < 3; i++) + 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++) + for (int i = POWER_MANA; i < MAX_POWERS; ++i) SetMaxPower(Powers(i), uint32(GetCreatePowers(Powers(i)))); SetMaxHealth(classInfo.basehealth); // stamina bonus will applied later @@ -3375,7 +3375,7 @@ bool Player::resetTalents(bool no_cost) } } - for (unsigned int i = 0; i < sTalentStore.GetNumRows(); i++) + for (unsigned int i = 0; i < sTalentStore.GetNumRows(); ++i) { TalentEntry const *talentInfo = sTalentStore.LookupEntry(i); @@ -3392,7 +3392,7 @@ bool Player::resetTalents(bool no_cost) if( (getClassMask() & talentTabInfo->ClassMask) == 0 ) continue; - for (int j = 0; j < MAX_TALENT_RANK; j++) + for (int j = 0; j < MAX_TALENT_RANK; ++j) { for(PlayerSpellMap::iterator itr = GetSpellMap().begin(); itr != GetSpellMap().end();) { @@ -3585,7 +3585,7 @@ void Player::InitVisibleBits() void Player::BuildCreateUpdateBlockForPlayer( UpdateData *data, Player *target ) const { - for(int i = 0; i < EQUIPMENT_SLOT_END; i++) + for(int i = 0; i < EQUIPMENT_SLOT_END; ++i) { if(m_items[i] == NULL) continue; @@ -3595,14 +3595,14 @@ void Player::BuildCreateUpdateBlockForPlayer( UpdateData *data, Player *target ) if(target == this) { - for(int i = INVENTORY_SLOT_BAG_START; i < BANK_SLOT_BAG_END; i++) + for(int i = INVENTORY_SLOT_BAG_START; i < BANK_SLOT_BAG_END; ++i) { if(m_items[i] == NULL) continue; m_items[i]->BuildCreateUpdateBlockForPlayer( data, target ); } - for(int i = KEYRING_SLOT_START; i < QUESTBAG_SLOT_END; i++) + for(int i = KEYRING_SLOT_START; i < QUESTBAG_SLOT_END; ++i) { if(m_items[i] == NULL) continue; @@ -3618,7 +3618,7 @@ void Player::DestroyForPlayer( Player *target ) const { Unit::DestroyForPlayer( target ); - for(int i = 0; i < INVENTORY_SLOT_BAG_END; i++) + for(int i = 0; i < INVENTORY_SLOT_BAG_END; ++i) { if(m_items[i] == NULL) continue; @@ -3628,14 +3628,14 @@ void Player::DestroyForPlayer( Player *target ) const if(target == this) { - for(int i = INVENTORY_SLOT_BAG_START; i < BANK_SLOT_BAG_END; i++) + for(int i = INVENTORY_SLOT_BAG_START; i < BANK_SLOT_BAG_END; ++i) { if(m_items[i] == NULL) continue; m_items[i]->DestroyForPlayer( target ); } - for(int i = KEYRING_SLOT_START; i < QUESTBAG_SLOT_END; i++) + for(int i = KEYRING_SLOT_START; i < QUESTBAG_SLOT_END; ++i) { if(m_items[i] == NULL) continue; @@ -4088,7 +4088,7 @@ void Player::CreateCorpse() uint32 iDisplayID; uint16 iIventoryType; uint32 _cfi; - for (int i = 0; i < EQUIPMENT_SLOT_END; i++) + for (int i = 0; i < EQUIPMENT_SLOT_END; ++i) { if(m_items[i]) { @@ -4123,25 +4123,25 @@ Corpse* Player::GetCorpse() const void Player::DurabilityLossAll(double percent, bool inventory) { - for(int i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; i++) + for(int i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; ++i) if(Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i )) DurabilityLoss(pItem,percent); if(inventory) { // bags not have durability - // for(int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++) + // for(int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i) - for(int i = INVENTORY_SLOT_ITEM_START; i < INVENTORY_SLOT_ITEM_END; i++) + for(int i = INVENTORY_SLOT_ITEM_START; i < INVENTORY_SLOT_ITEM_END; ++i) if(Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i )) DurabilityLoss(pItem,percent); // keys not have durability - //for(int i = KEYRING_SLOT_START; i < KEYRING_SLOT_END; i++) + //for(int i = KEYRING_SLOT_START; i < KEYRING_SLOT_END; ++i) - for(int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++) + for(int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i) if(Bag* pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, i )) - for(uint32 j = 0; j < pBag->GetBagSize(); j++) + for(uint32 j = 0; j < pBag->GetBagSize(); ++j) if(Item* pItem = GetItemByPos( i, j )) DurabilityLoss(pItem,percent); } @@ -4167,25 +4167,25 @@ void Player::DurabilityLoss(Item* item, double percent) void Player::DurabilityPointsLossAll(int32 points, bool inventory) { - for(int i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; i++) + for(int i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; ++i) if(Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i )) DurabilityPointsLoss(pItem,points); if(inventory) { // bags not have durability - // for(int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++) + // for(int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i) - for(int i = INVENTORY_SLOT_ITEM_START; i < INVENTORY_SLOT_ITEM_END; i++) + for(int i = INVENTORY_SLOT_ITEM_START; i < INVENTORY_SLOT_ITEM_END; ++i) if(Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i )) DurabilityPointsLoss(pItem,points); // keys not have durability - //for(int i = KEYRING_SLOT_START; i < KEYRING_SLOT_END; i++) + //for(int i = KEYRING_SLOT_START; i < KEYRING_SLOT_END; ++i) - for(int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++) + for(int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i) if(Bag* pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, i )) - for(uint32 j = 0; j < pBag->GetBagSize(); j++) + for(uint32 j = 0; j < pBag->GetBagSize(); ++j) if(Item* pItem = GetItemByPos( i, j )) DurabilityPointsLoss(pItem,points); } @@ -4228,14 +4228,14 @@ 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++) + 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++) + 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; } @@ -4847,7 +4847,7 @@ bool Player::UpdateSkill(uint32 skill_id, uint32 step) return false; uint16 i=0; - for (; i < PLAYER_MAX_SKILLS; i++) + for (; i < PLAYER_MAX_SKILLS; ++i) if ((GetUInt32Value(PLAYER_SKILL_INDEX(i)) & 0x0000FFFF) == skill_id) break; @@ -4978,7 +4978,7 @@ bool Player::UpdateSkillPro(uint16 SkillId, int32 Chance, uint32 step) } uint16 i=0; - for (; i < PLAYER_MAX_SKILLS; i++) + for (; i < PLAYER_MAX_SKILLS; ++i) if ( SKILL_VALUE(GetUInt32Value(PLAYER_SKILL_INDEX(i))) == SkillId ) break; if ( i >= PLAYER_MAX_SKILLS ) return false; @@ -5096,7 +5096,7 @@ void Player::UpdateCombatSkills(Unit *pVictim, WeaponAttackType attType, bool de void Player::ModifySkillBonus(uint32 skillid,int32 val, bool talent) { - for (uint16 i=0; i < PLAYER_MAX_SKILLS; i++) + for (uint16 i=0; i < PLAYER_MAX_SKILLS; ++i) if ((GetUInt32Value(PLAYER_SKILL_INDEX(i)) & 0x0000FFFF) == skillid) { uint32 bonus_val = GetUInt32Value(PLAYER_SKILL_BONUS_INDEX(i)); @@ -5118,7 +5118,7 @@ void Player::UpdateSkillsForLevel() bool alwaysMaxSkill = sWorld.getConfig(CONFIG_ALWAYS_MAX_SKILL_FOR_LEVEL); - for (uint16 i=0; i < PLAYER_MAX_SKILLS; i++) + for (uint16 i=0; i < PLAYER_MAX_SKILLS; ++i) if (GetUInt32Value(PLAYER_SKILL_INDEX(i))) { uint32 pskill = GetUInt32Value(PLAYER_SKILL_INDEX(i)) & 0x0000FFFF; @@ -5149,7 +5149,7 @@ void Player::UpdateSkillsForLevel() void Player::UpdateSkillsToMaxSkillsForLevel() { - for (uint16 i=0; i < PLAYER_MAX_SKILLS; i++) + for (uint16 i=0; i < PLAYER_MAX_SKILLS; ++i) if (GetUInt32Value(PLAYER_SKILL_INDEX(i))) { uint32 pskill = GetUInt32Value(PLAYER_SKILL_INDEX(i)) & 0x0000FFFF; @@ -5175,7 +5175,7 @@ void Player::SetSkill(uint32 id, uint16 currVal, uint16 maxVal) return; uint16 i=0; - for (; i < PLAYER_MAX_SKILLS; i++) + for (; i < PLAYER_MAX_SKILLS; ++i) if ((GetUInt32Value(PLAYER_SKILL_INDEX(i)) & 0x0000FFFF) == id) break; if(isecond->GetId()); } - for(size_t i=0; iopponent->RemoveAurasDueToSpell(auras2remove[i]); auras2remove.clear(); @@ -6226,7 +6226,7 @@ void Player::DuelComplete(DuelCompleteType type) if (!i->second->IsPositive() && i->second->GetCasterGUID() == duel->opponent->GetGUID() && i->second->GetAuraApplyTime() >= duel->startTime) auras2remove.push_back(i->second->GetId()); } - for(size_t i=0; iId, k); - for (AuraMap::iterator iter = m_Auras.lower_bound(spair); iter != m_Auras.upper_bound(spair); ++iter) + for (AuraMap::const_iterator iter = m_Auras.lower_bound(spair); iter != m_Auras.upper_bound(spair); ++iter) { if(!item || iter->second->GetCastItemGUID() == item->GetGUID()) { @@ -6699,7 +6699,7 @@ void Player::ApplyEquipSpell(SpellEntry const* spellInfo, Item* item, bool apply void Player::UpdateEquipSpellsAtFormChange() { - for (int i = 0; i < INVENTORY_SLOT_BAG_END; i++) + for (int i = 0; i < INVENTORY_SLOT_BAG_END; ++i) { if(m_items[i] && !m_items[i]->IsBroken()) { @@ -6898,7 +6898,7 @@ void Player::_RemoveAllItemMods() { sLog.outDebug("_RemoveAllItemMods start."); - for (int i = 0; i < INVENTORY_SLOT_BAG_END; i++) + for (int i = 0; i < INVENTORY_SLOT_BAG_END; ++i) { if(m_items[i]) { @@ -6918,7 +6918,7 @@ void Player::_RemoveAllItemMods() } } - for (int i = 0; i < INVENTORY_SLOT_BAG_END; i++) + for (int i = 0; i < INVENTORY_SLOT_BAG_END; ++i) { if(m_items[i]) { @@ -6946,7 +6946,7 @@ void Player::_ApplyAllItemMods() { sLog.outDebug("_ApplyAllItemMods start."); - for (int i = 0; i < INVENTORY_SLOT_BAG_END; i++) + for (int i = 0; i < INVENTORY_SLOT_BAG_END; ++i) { if(m_items[i]) { @@ -6968,7 +6968,7 @@ void Player::_ApplyAllItemMods() } } - for (int i = 0; i < INVENTORY_SLOT_BAG_END; i++) + for (int i = 0; i < INVENTORY_SLOT_BAG_END; ++i) { if(m_items[i]) { @@ -7974,7 +7974,7 @@ uint8 Player::FindEquipSlot( ItemPrototype const* proto, uint32 slot, bool swap { if( swap || !GetItemByPos( INVENTORY_SLOT_BAG_0, slot ) ) { - for (int i = 0; i < 4; i++) + for (int i = 0; i < 4; ++i) { if ( slots[i] == slot ) return slot; @@ -7984,7 +7984,7 @@ uint8 Player::FindEquipSlot( ItemPrototype const* proto, uint32 slot, bool swap else { // search free slot at first - for (int i = 0; i < 4; i++) + for (int i = 0; i < 4; ++i) { if ( slots[i] != NULL_SLOT && !GetItemByPos( INVENTORY_SLOT_BAG_0, slots[i] ) ) { @@ -7995,7 +7995,7 @@ uint8 Player::FindEquipSlot( ItemPrototype const* proto, uint32 slot, bool swap } // if not found free and can swap return first appropriate from used - for (int i = 0; i < 4; i++) + for (int i = 0; i < 4; ++i) { if ( slots[i] != NULL_SLOT && swap ) return slots[i]; @@ -8013,7 +8013,7 @@ uint8 Player::CanUnequipItems( uint32 item, uint32 count ) const uint8 res = EQUIP_ERR_OK; - for(int i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_BAG_END; i++) + for(int i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_BAG_END; ++i) { pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i ); if( pItem && pItem->GetEntry() == item ) @@ -8029,7 +8029,7 @@ uint8 Player::CanUnequipItems( uint32 item, uint32 count ) const res = ires; } } - for(int i = INVENTORY_SLOT_ITEM_START; i < INVENTORY_SLOT_ITEM_END; i++) + for(int i = INVENTORY_SLOT_ITEM_START; i < INVENTORY_SLOT_ITEM_END; ++i) { pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i ); if( pItem && pItem->GetEntry() == item ) @@ -8039,7 +8039,7 @@ uint8 Player::CanUnequipItems( uint32 item, uint32 count ) const return EQUIP_ERR_OK; } } - for(int i = KEYRING_SLOT_START; i < QUESTBAG_SLOT_END; i++) + for(int i = KEYRING_SLOT_START; i < QUESTBAG_SLOT_END; ++i) { pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i ); if( pItem && pItem->GetEntry() == item ) @@ -8050,12 +8050,12 @@ uint8 Player::CanUnequipItems( uint32 item, uint32 count ) const } } Bag *pBag; - for(int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++) + for(int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i) { pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, i ); if( pBag ) { - for(uint32 j = 0; j < pBag->GetBagSize(); j++) + for(uint32 j = 0; j < pBag->GetBagSize(); ++j) { pItem = GetItemByPos( i, j ); if( pItem && pItem->GetEntry() == item ) @@ -8075,19 +8075,19 @@ uint8 Player::CanUnequipItems( uint32 item, uint32 count ) const uint32 Player::GetItemCount( uint32 item, bool inBankAlso, Item* skipItem ) const { uint32 count = 0; - for(int i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_ITEM_END; i++) + for(int i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_ITEM_END; ++i) { Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i ); if( pItem && pItem != skipItem && pItem->GetEntry() == item ) count += pItem->GetCount(); } - for(int i = KEYRING_SLOT_START; i < QUESTBAG_SLOT_END; i++) + for(int i = KEYRING_SLOT_START; i < QUESTBAG_SLOT_END; ++i) { Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i ); if( pItem && pItem != skipItem && pItem->GetEntry() == item ) count += pItem->GetCount(); } - for(int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++) + for(int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i) { Bag* pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, i ); if( pBag ) @@ -8096,7 +8096,7 @@ uint32 Player::GetItemCount( uint32 item, bool inBankAlso, Item* skipItem ) cons if(skipItem && skipItem->GetProto()->GemProperties) { - for(int i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_ITEM_END; i++) + for(int i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_ITEM_END; ++i) { Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i ); if( pItem && pItem != skipItem && pItem->GetProto()->Socket[0].Color ) @@ -8106,13 +8106,13 @@ uint32 Player::GetItemCount( uint32 item, bool inBankAlso, Item* skipItem ) cons if(inBankAlso) { - for(int i = BANK_SLOT_ITEM_START; i < BANK_SLOT_ITEM_END; i++) + for(int i = BANK_SLOT_ITEM_START; i < BANK_SLOT_ITEM_END; ++i) { Item* pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i ); if( pItem && pItem != skipItem && pItem->GetEntry() == item ) count += pItem->GetCount(); } - for(int i = BANK_SLOT_BAG_START; i < BANK_SLOT_BAG_END; i++) + for(int i = BANK_SLOT_BAG_START; i < BANK_SLOT_BAG_END; ++i) { Bag* pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, i ); if( pBag ) @@ -8121,7 +8121,7 @@ uint32 Player::GetItemCount( uint32 item, bool inBankAlso, Item* skipItem ) cons if(skipItem && skipItem->GetProto()->GemProperties) { - for(int i = BANK_SLOT_ITEM_START; i < BANK_SLOT_ITEM_END; i++) + for(int i = BANK_SLOT_ITEM_START; i < BANK_SLOT_ITEM_END; ++i) { Item* pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i ); if( pItem && pItem != skipItem && pItem->GetProto()->Socket[0].Color ) @@ -8135,25 +8135,25 @@ uint32 Player::GetItemCount( uint32 item, bool inBankAlso, Item* skipItem ) cons Item* Player::GetItemByGuid( uint64 guid ) const { - for(int i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_ITEM_END; i++) + for(int i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_ITEM_END; ++i) { Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i ); if( pItem && pItem->GetGUID() == guid ) return pItem; } - for(int i = KEYRING_SLOT_START; i < QUESTBAG_SLOT_END; i++) + for(int i = KEYRING_SLOT_START; i < QUESTBAG_SLOT_END; ++i) { Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i ); if( pItem && pItem->GetGUID() == guid ) return pItem; } - for(int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++) + for(int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i) { Bag *pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, i ); if( pBag ) { - for(uint32 j = 0; j < pBag->GetBagSize(); j++) + for(uint32 j = 0; j < pBag->GetBagSize(); ++j) { Item* pItem = pBag->GetItemByPos( j ); if( pItem && pItem->GetGUID() == guid ) @@ -8161,12 +8161,12 @@ Item* Player::GetItemByGuid( uint64 guid ) const } } } - for(int i = BANK_SLOT_BAG_START; i < BANK_SLOT_BAG_END; i++) + for(int i = BANK_SLOT_BAG_START; i < BANK_SLOT_BAG_END; ++i) { Bag *pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, i ); if( pBag ) { - for(uint32 j = 0; j < pBag->GetBagSize(); j++) + for(uint32 j = 0; j < pBag->GetBagSize(); ++j) { Item* pItem = pBag->GetItemByPos( j ); if( pItem && pItem->GetGUID() == guid ) @@ -8376,7 +8376,7 @@ bool Player::IsValidPos( uint8 bag, uint8 slot ) bool Player::HasItemCount( uint32 item, uint32 count, bool inBankAlso ) const { uint32 tempcount = 0; - for(int i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_ITEM_END; i++) + for(int i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_ITEM_END; ++i) { Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i ); if( pItem && pItem->GetEntry() == item ) @@ -8386,7 +8386,7 @@ bool Player::HasItemCount( uint32 item, uint32 count, bool inBankAlso ) const return true; } } - for(int i = KEYRING_SLOT_START; i < QUESTBAG_SLOT_END; i++) + for(int i = KEYRING_SLOT_START; i < QUESTBAG_SLOT_END; ++i) { Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i ); if( pItem && pItem->GetEntry() == item ) @@ -8396,11 +8396,11 @@ bool Player::HasItemCount( uint32 item, uint32 count, bool inBankAlso ) const return true; } } - for(int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++) + for(int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i) { if(Bag* pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, i )) { - for(uint32 j = 0; j < pBag->GetBagSize(); j++) + for(uint32 j = 0; j < pBag->GetBagSize(); ++j) { Item* pItem = GetItemByPos( i, j ); if( pItem && pItem->GetEntry() == item ) @@ -8415,7 +8415,7 @@ bool Player::HasItemCount( uint32 item, uint32 count, bool inBankAlso ) const if(inBankAlso) { - for(int i = BANK_SLOT_ITEM_START; i < BANK_SLOT_ITEM_END; i++) + for(int i = BANK_SLOT_ITEM_START; i < BANK_SLOT_ITEM_END; ++i) { Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i ); if( pItem && pItem->GetEntry() == item ) @@ -8425,11 +8425,11 @@ bool Player::HasItemCount( uint32 item, uint32 count, bool inBankAlso ) const return true; } } - for(int i = BANK_SLOT_BAG_START; i < BANK_SLOT_BAG_END; i++) + for(int i = BANK_SLOT_BAG_START; i < BANK_SLOT_BAG_END; ++i) { if(Bag* pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, i )) { - for(uint32 j = 0; j < pBag->GetBagSize(); j++) + for(uint32 j = 0; j < pBag->GetBagSize(); ++j) { Item* pItem = GetItemByPos( i, j ); if( pItem && pItem->GetEntry() == item ) @@ -8674,7 +8674,7 @@ uint8 Player::_CanStoreItem_InBag( uint8 bag, ItemPosCountVec &dest, ItemPrototy if( !ItemCanGoIntoBag(pProto,pBagProto) ) return EQUIP_ERR_ITEM_DOESNT_GO_INTO_BAG; - for(uint32 j = 0; j < pBag->GetBagSize(); j++) + for(uint32 j = 0; j < pBag->GetBagSize(); ++j) { // skip specific slot already processed in first called _CanStoreItem_InSpecificSlot if(j==skip_slot) @@ -8731,7 +8731,7 @@ uint8 Player::_CanStoreItem_InBag( uint8 bag, ItemPosCountVec &dest, ItemPrototy uint8 Player::_CanStoreItem_InInventorySlots( uint8 slot_begin, uint8 slot_end, ItemPosCountVec &dest, ItemPrototype const *pProto, uint32& count, bool merge, Item* pSrcItem, uint8 skip_bag, uint8 skip_slot ) const { - for(uint32 j = slot_begin; j < slot_end; j++) + for(uint32 j = slot_begin; j < slot_end; ++j) { // skip specific slot already processed in first called _CanStoreItem_InSpecificSlot if(INVENTORY_SLOT_BAG_0==skip_bag && j==skip_slot) @@ -9062,7 +9062,7 @@ uint8 Player::_CanStoreItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, uint3 if( pProto->BagFamily ) { - for(int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++) + for(int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i) { res = _CanStoreItem_InBag(i,dest,pProto,count,true,false,pItem,bag,slot); if(res!=EQUIP_ERR_OK) @@ -9080,7 +9080,7 @@ uint8 Player::_CanStoreItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, uint3 } } - for(int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++) + for(int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i) { res = _CanStoreItem_InBag(i,dest,pProto,count,true,true,pItem,bag,slot); if(res!=EQUIP_ERR_OK) @@ -9143,7 +9143,7 @@ uint8 Player::_CanStoreItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, uint3 } } - for(int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++) + for(int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i) { res = _CanStoreItem_InBag(i,dest,pProto,count,false,false,pItem,bag,slot); if(res!=EQUIP_ERR_OK) @@ -9180,7 +9180,7 @@ uint8 Player::_CanStoreItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, uint3 return EQUIP_ERR_CANT_CARRY_MORE_OF_THIS; } - for(int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++) + for(int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i) { res = _CanStoreItem_InBag(i,dest,pProto,count,false,true,pItem,bag,slot); if(res!=EQUIP_ERR_OK) @@ -9219,7 +9219,7 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const memset(inv_keys,0,sizeof(int)*(KEYRING_SLOT_END-KEYRING_SLOT_START)); memset(inv_tokens,0,sizeof(int)*(CURRENCYTOKEN_SLOT_END-CURRENCYTOKEN_SLOT_START)); - for(int i = INVENTORY_SLOT_ITEM_START; i < INVENTORY_SLOT_ITEM_END; i++) + for(int i = INVENTORY_SLOT_ITEM_START; i < INVENTORY_SLOT_ITEM_END; ++i) { pItem2 = GetItemByPos( INVENTORY_SLOT_BAG_0, i ); @@ -9229,7 +9229,7 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const } } - for(int i = KEYRING_SLOT_START; i < KEYRING_SLOT_END; i++) + for(int i = KEYRING_SLOT_START; i < KEYRING_SLOT_END; ++i) { pItem2 = GetItemByPos( INVENTORY_SLOT_BAG_0, i ); @@ -9239,7 +9239,7 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const } } - for(int i = CURRENCYTOKEN_SLOT_START; i < CURRENCYTOKEN_SLOT_END; i++) + for(int i = CURRENCYTOKEN_SLOT_START; i < CURRENCYTOKEN_SLOT_END; ++i) { pItem2 = GetItemByPos( INVENTORY_SLOT_BAG_0, i ); @@ -9249,11 +9249,11 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const } } - for(int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++) + for(int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i) { if(Bag* pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, i )) { - for(uint32 j = 0; j < pBag->GetBagSize(); j++) + for(uint32 j = 0; j < pBag->GetBagSize(); ++j) { pItem2 = GetItemByPos( i, j ); if (pItem2 && !pItem2->IsInTrade()) @@ -9337,7 +9337,7 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, t ); if( pBag ) { - for(uint32 j = 0; j < pBag->GetBagSize(); j++) + for(uint32 j = 0; j < pBag->GetBagSize(); ++j) { pItem2 = GetItemByPos( t, j ); if( pItem2 && pItem2->GetEntry() == pItem->GetEntry() && inv_bags[t-INVENTORY_SLOT_BAG_START][j] + pItem->GetCount() <= pProto->GetMaxStackSize()) @@ -9398,7 +9398,7 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const if( pBagProto && (pBagProto->Class != ITEM_CLASS_CONTAINER || pBagProto->SubClass != ITEM_SUBCLASS_CONTAINER) && ItemCanGoIntoBag(pProto,pBagProto) ) { - for(uint32 j = 0; j < pBag->GetBagSize(); j++) + for(uint32 j = 0; j < pBag->GetBagSize(); ++j) { if( inv_bags[t-INVENTORY_SLOT_BAG_START][j] == 0 ) { @@ -9438,7 +9438,7 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const if( pBagProto && (pBagProto->Class != ITEM_CLASS_CONTAINER || pBagProto->SubClass != ITEM_SUBCLASS_CONTAINER)) continue; - for(uint32 j = 0; j < pBag->GetBagSize(); j++) + for(uint32 j = 0; j < pBag->GetBagSize(); ++j) { if( inv_bags[t-INVENTORY_SLOT_BAG_START][j] == 0 ) { @@ -9763,7 +9763,7 @@ uint8 Player::CanBankItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, Item *p // in special bags if( pProto->BagFamily ) { - for(int i = BANK_SLOT_BAG_START; i < BANK_SLOT_BAG_END; i++) + for(int i = BANK_SLOT_BAG_START; i < BANK_SLOT_BAG_END; ++i) { res = _CanStoreItem_InBag(i,dest,pProto,count,true,false,pItem,bag,slot); if(res!=EQUIP_ERR_OK) @@ -9774,7 +9774,7 @@ uint8 Player::CanBankItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, Item *p } } - for(int i = BANK_SLOT_BAG_START; i < BANK_SLOT_BAG_END; i++) + for(int i = BANK_SLOT_BAG_START; i < BANK_SLOT_BAG_END; ++i) { res = _CanStoreItem_InBag(i,dest,pProto,count,true,true,pItem,bag,slot); if(res!=EQUIP_ERR_OK) @@ -9788,7 +9788,7 @@ uint8 Player::CanBankItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, Item *p // search free place in special bag if( pProto->BagFamily ) { - for(int i = BANK_SLOT_BAG_START; i < BANK_SLOT_BAG_END; i++) + for(int i = BANK_SLOT_BAG_START; i < BANK_SLOT_BAG_END; ++i) { res = _CanStoreItem_InBag(i,dest,pProto,count,false,false,pItem,bag,slot); if(res!=EQUIP_ERR_OK) @@ -9807,7 +9807,7 @@ uint8 Player::CanBankItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, Item *p if(count==0) return EQUIP_ERR_OK; - for(int i = BANK_SLOT_BAG_START; i < BANK_SLOT_BAG_END; i++) + for(int i = BANK_SLOT_BAG_START; i < BANK_SLOT_BAG_END; ++i) { res = _CanStoreItem_InBag(i,dest,pProto,count,false,true,pItem,bag,slot); if(res!=EQUIP_ERR_OK) @@ -10420,7 +10420,7 @@ void Player::DestroyItem( uint8 bag, uint8 slot, bool update ) // start from destroy contained items (only equipped bag can have its) 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++) + for (int i = 0; i < MAX_BAG_SIZE; ++i) DestroyItem(slot,i,update); } @@ -10490,7 +10490,7 @@ void Player::DestroyItemCount( uint32 item, uint32 count, bool update, bool uneq uint32 remcount = 0; // in inventory - for(int i = INVENTORY_SLOT_ITEM_START; i < INVENTORY_SLOT_ITEM_END; i++) + for(int i = INVENTORY_SLOT_ITEM_START; i < INVENTORY_SLOT_ITEM_END; ++i) { if (Item* pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i )) { @@ -10518,7 +10518,7 @@ void Player::DestroyItemCount( uint32 item, uint32 count, bool update, bool uneq } } - for(int i = KEYRING_SLOT_START; i < QUESTBAG_SLOT_END; i++) + for(int i = KEYRING_SLOT_START; i < QUESTBAG_SLOT_END; ++i) { if (Item* pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i )) { @@ -10547,11 +10547,11 @@ void Player::DestroyItemCount( uint32 item, uint32 count, bool update, bool uneq } // in inventory bags - for(int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++) + for(int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i) { if(Bag *pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, i )) { - for(uint32 j = 0; j < pBag->GetBagSize(); j++) + for(uint32 j = 0; j < pBag->GetBagSize(); ++j) { if(Item* pItem = pBag->GetItemByPos(j)) { @@ -10582,7 +10582,7 @@ void Player::DestroyItemCount( uint32 item, uint32 count, bool update, bool uneq } // in equipment and bag list - for(int i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_BAG_END; i++) + for(int i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_BAG_END; ++i) { if (Item* pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i )) { @@ -10618,26 +10618,26 @@ void Player::DestroyZoneLimitedItem( bool update, uint32 new_zone ) sLog.outDebug( "STORAGE: DestroyZoneLimitedItem in map %u and area %u", GetMapId(), new_zone ); // in inventory - for(int i = INVENTORY_SLOT_ITEM_START; i < INVENTORY_SLOT_ITEM_END; i++) + for(int i = INVENTORY_SLOT_ITEM_START; i < INVENTORY_SLOT_ITEM_END; ++i) if (Item* pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i )) if (pItem->IsLimitedToAnotherMapOrZone(GetMapId(),new_zone)) DestroyItem( INVENTORY_SLOT_BAG_0, i, update); - for(int i = KEYRING_SLOT_START; i < QUESTBAG_SLOT_END; i++) + for(int i = KEYRING_SLOT_START; i < QUESTBAG_SLOT_END; ++i) if (Item* pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i )) if (pItem->IsLimitedToAnotherMapOrZone(GetMapId(),new_zone)) DestroyItem( INVENTORY_SLOT_BAG_0, i, update); // in inventory bags - for(int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++) + for(int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i) if (Bag* pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, i )) - for(uint32 j = 0; j < pBag->GetBagSize(); j++) + for(uint32 j = 0; j < pBag->GetBagSize(); ++j) if (Item* pItem = pBag->GetItemByPos(j)) if (pItem->IsLimitedToAnotherMapOrZone(GetMapId(),new_zone)) DestroyItem( i, j, update); // in equipment and bag list - for(int i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_BAG_END; i++) + for(int i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_BAG_END; ++i) if (Item* pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i )) if (pItem->IsLimitedToAnotherMapOrZone(GetMapId(),new_zone)) DestroyItem( INVENTORY_SLOT_BAG_0, i, update); @@ -10650,21 +10650,21 @@ void Player::DestroyConjuredItems( bool update ) sLog.outDebug( "STORAGE: DestroyConjuredItems" ); // in inventory - for(int i = INVENTORY_SLOT_ITEM_START; i < INVENTORY_SLOT_ITEM_END; i++) + for(int i = INVENTORY_SLOT_ITEM_START; i < INVENTORY_SLOT_ITEM_END; ++i) if (Item* pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i )) if (pItem->IsConjuredConsumable()) DestroyItem( INVENTORY_SLOT_BAG_0, i, update); // in inventory bags - for(int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++) + for(int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i) if (Bag* pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, i )) - for(uint32 j = 0; j < pBag->GetBagSize(); j++) + for(uint32 j = 0; j < pBag->GetBagSize(); ++j) if (Item* pItem = pBag->GetItemByPos(j)) if (pItem->IsConjuredConsumable()) DestroyItem( i, j, update); // in equipment and bag list - for(int i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_BAG_END; i++) + for(int i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_BAG_END; ++i) if (Item* pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i )) if (pItem->IsConjuredConsumable()) DestroyItem( INVENTORY_SLOT_BAG_0, i, update); @@ -11246,7 +11246,7 @@ void Player::ClearTrade() { tradeGold = 0; acceptTrade = false; - for(int i = 0; i < TRADE_SLOT_COUNT; i++) + for(int i = 0; i < TRADE_SLOT_COUNT; ++i) tradeItems[i] = NULL_SLOT; } @@ -11279,7 +11279,7 @@ void Player::UpdateItemDuration(uint32 time, bool realtimeonly) sLog.outDebug("Player::UpdateItemDuration(%u,%u)", time,realtimeonly); - for(ItemDurationList::iterator itr = m_itemDuration.begin();itr != m_itemDuration.end(); ) + for(ItemDurationList::const_iterator itr = m_itemDuration.begin();itr != m_itemDuration.end(); ) { Item* item = *itr; ++itr; // current element can be erased in UpdateDuration @@ -11366,7 +11366,7 @@ void Player::RemoveAllEnchantments(EnchantmentSlot slot) // remove enchants from inventory items // NOTE: no need to remove these from stats, since these aren't equipped // in inventory - for(int i = INVENTORY_SLOT_ITEM_START; i < INVENTORY_SLOT_ITEM_END; i++) + for(int i = INVENTORY_SLOT_ITEM_START; i < INVENTORY_SLOT_ITEM_END; ++i) { Item* pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i ); if( pItem && pItem->GetEnchantmentId(slot) ) @@ -11374,12 +11374,12 @@ void Player::RemoveAllEnchantments(EnchantmentSlot slot) } // in inventory bags - for(int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++) + for(int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i) { Bag* pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, i ); if( pBag ) { - for(uint32 j = 0; j < pBag->GetBagSize(); j++) + for(uint32 j = 0; j < pBag->GetBagSize(); ++j) { Item* pItem = pBag->GetItemByPos(j); if( pItem && pItem->GetEnchantmentId(slot) ) @@ -11764,7 +11764,7 @@ void Player::ApplyEnchantment(Item *item,EnchantmentSlot slot,bool apply, bool a void Player::SendEnchantmentDurations() { - for(EnchantDurationList::iterator itr = m_enchantDuration.begin();itr != m_enchantDuration.end();++itr) + for(EnchantDurationList::const_iterator itr = m_enchantDuration.begin();itr != m_enchantDuration.end();++itr) { GetSession()->SendItemEnchantTimeUpdate(GetGUID(), itr->item->GetGUID(),itr->slot,uint32(itr->leftduration)/1000); } @@ -11772,7 +11772,7 @@ void Player::SendEnchantmentDurations() void Player::SendItemDurations() { - for(ItemDurationList::iterator itr = m_itemDuration.begin();itr != m_itemDuration.end();++itr) + for(ItemDurationList::const_iterator itr = m_itemDuration.begin();itr != m_itemDuration.end();++itr) { (*itr)->SendTimeUpdate(this); } @@ -12062,7 +12062,7 @@ bool Player::CanCompleteQuest( uint32 quest_id ) if ( qInfo->HasFlag( QUEST_MANGOS_FLAGS_DELIVER ) ) { - for(int i = 0; i < QUEST_OBJECTIVES_COUNT; i++) + for(int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) { if( qInfo->ReqItemCount[i]!= 0 && q_status.m_itemcount[i] < qInfo->ReqItemCount[i] ) return false; @@ -12071,7 +12071,7 @@ bool Player::CanCompleteQuest( uint32 quest_id ) if ( qInfo->HasFlag(QUEST_MANGOS_FLAGS_KILL_OR_CAST | QUEST_MANGOS_FLAGS_SPEAKTO) ) { - for(int i = 0; i < QUEST_OBJECTIVES_COUNT; i++) + for(int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) { if( qInfo->ReqCreatureOrGOId[i] == 0 ) continue; @@ -12112,7 +12112,7 @@ bool Player::CanCompleteRepeatableQuest( Quest const *pQuest ) return false; if (pQuest->HasFlag( QUEST_MANGOS_FLAGS_DELIVER) ) - for(int i = 0; i < QUEST_OBJECTIVES_COUNT; i++) + for(int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) if( pQuest->ReqItemId[i] && pQuest->ReqItemCount[i] && !HasItemCount(pQuest->ReqItemId[i],pQuest->ReqItemCount[i]) ) return false; @@ -12139,7 +12139,7 @@ bool Player::CanRewardQuest( Quest const *pQuest, bool msg ) // prevent receive reward with quest items in bank if ( pQuest->HasFlag( QUEST_MANGOS_FLAGS_DELIVER ) ) { - for(int i = 0; i < QUEST_OBJECTIVES_COUNT; i++) + for(int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) { if( pQuest->ReqItemCount[i]!= 0 && GetItemCount(pQuest->ReqItemId[i]) < pQuest->ReqItemCount[i] ) @@ -12308,7 +12308,7 @@ void Player::RewardQuest( Quest const *pQuest, uint32 reward, Object* questGiver { uint32 quest_id = pQuest->GetQuestId(); - for (int i = 0; i < QUEST_OBJECTIVES_COUNT; i++ ) + for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i ) { if ( pQuest->ReqItemId[i] ) DestroyItemCount( pQuest->ReqItemId[i], pQuest->ReqItemCount[i], true); @@ -12620,7 +12620,7 @@ bool Player::SatisfyQuestPreviousQuest( Quest const* qInfo, bool msg ) { uint32 prevId = abs(*iter); - QuestStatusMap::iterator i_prevstatus = mQuestStatus.find( prevId ); + QuestStatusMap::const_iterator i_prevstatus = mQuestStatus.find( prevId ); Quest const* qPrevInfo = objmgr.GetQuestTemplate(prevId); if( qPrevInfo && i_prevstatus != mQuestStatus.end() ) @@ -12634,8 +12634,8 @@ bool Player::SatisfyQuestPreviousQuest( Quest const* qInfo, bool msg ) // each-from-all exclusive group ( < 0) // can be start if only all quests in prev quest exclusive group completed and rewarded - ObjectMgr::ExclusiveQuestGroups::iterator iter2 = objmgr.mExclusiveQuestGroups.lower_bound(qPrevInfo->GetExclusiveGroup()); - ObjectMgr::ExclusiveQuestGroups::iterator end = objmgr.mExclusiveQuestGroups.upper_bound(qPrevInfo->GetExclusiveGroup()); + ObjectMgr::ExclusiveQuestGroups::const_iterator iter2 = objmgr.mExclusiveQuestGroups.lower_bound(qPrevInfo->GetExclusiveGroup()); + ObjectMgr::ExclusiveQuestGroups::const_iterator end = objmgr.mExclusiveQuestGroups.upper_bound(qPrevInfo->GetExclusiveGroup()); assert(iter2!=end); // always must be found if qPrevInfo->ExclusiveGroup != 0 @@ -12647,7 +12647,7 @@ bool Player::SatisfyQuestPreviousQuest( Quest const* qInfo, bool msg ) if(exclude_Id == prevId) continue; - QuestStatusMap::iterator i_exstatus = mQuestStatus.find( exclude_Id ); + QuestStatusMap::const_iterator i_exstatus = mQuestStatus.find( exclude_Id ); // alternative quest from group also must be completed and rewarded(reported) if( i_exstatus == mQuestStatus.end() || !i_exstatus->second.m_rewarded ) @@ -12669,8 +12669,8 @@ bool Player::SatisfyQuestPreviousQuest( Quest const* qInfo, bool msg ) // each-from-all exclusive group ( < 0) // can be start if only all quests in prev quest exclusive group active - ObjectMgr::ExclusiveQuestGroups::iterator iter2 = objmgr.mExclusiveQuestGroups.lower_bound(qPrevInfo->GetExclusiveGroup()); - ObjectMgr::ExclusiveQuestGroups::iterator end = objmgr.mExclusiveQuestGroups.upper_bound(qPrevInfo->GetExclusiveGroup()); + ObjectMgr::ExclusiveQuestGroups::const_iterator iter2 = objmgr.mExclusiveQuestGroups.lower_bound(qPrevInfo->GetExclusiveGroup()); + ObjectMgr::ExclusiveQuestGroups::const_iterator end = objmgr.mExclusiveQuestGroups.upper_bound(qPrevInfo->GetExclusiveGroup()); assert(iter2!=end); // always must be found if qPrevInfo->ExclusiveGroup != 0 @@ -12682,7 +12682,7 @@ bool Player::SatisfyQuestPreviousQuest( Quest const* qInfo, bool msg ) if(exclude_Id == prevId) continue; - QuestStatusMap::iterator i_exstatus = mQuestStatus.find( exclude_Id ); + QuestStatusMap::const_iterator i_exstatus = mQuestStatus.find( exclude_Id ); // alternative quest from group also must be active if( i_exstatus == mQuestStatus.end() || @@ -12744,7 +12744,7 @@ bool Player::SatisfyQuestReputation( Quest const* qInfo, bool msg ) bool Player::SatisfyQuestStatus( Quest const* qInfo, bool msg ) { - QuestStatusMap::iterator itr = mQuestStatus.find( qInfo->GetQuestId() ); + QuestStatusMap::const_iterator itr = mQuestStatus.find( qInfo->GetQuestId() ); if ( itr != mQuestStatus.end() && itr->second.m_status != QUEST_STATUS_NONE ) { if( msg ) @@ -12771,8 +12771,8 @@ bool Player::SatisfyQuestExclusiveGroup( Quest const* qInfo, bool msg ) if(qInfo->GetExclusiveGroup() <= 0) return true; - ObjectMgr::ExclusiveQuestGroups::iterator iter = objmgr.mExclusiveQuestGroups.lower_bound(qInfo->GetExclusiveGroup()); - ObjectMgr::ExclusiveQuestGroups::iterator end = objmgr.mExclusiveQuestGroups.upper_bound(qInfo->GetExclusiveGroup()); + ObjectMgr::ExclusiveQuestGroups::const_iterator iter = objmgr.mExclusiveQuestGroups.lower_bound(qInfo->GetExclusiveGroup()); + ObjectMgr::ExclusiveQuestGroups::const_iterator end = objmgr.mExclusiveQuestGroups.upper_bound(qInfo->GetExclusiveGroup()); assert(iter!=end); // always must be found if qInfo->ExclusiveGroup != 0 @@ -12813,7 +12813,7 @@ bool Player::SatisfyQuestNextChain( Quest const* qInfo, bool msg ) return true; // next quest in chain already started or completed - QuestStatusMap::iterator itr = mQuestStatus.find( qInfo->GetNextQuestInChain() ); + QuestStatusMap::const_iterator itr = mQuestStatus.find( qInfo->GetNextQuestInChain() ); if( itr != mQuestStatus.end() && (itr->second.m_status == QUEST_STATUS_COMPLETE || itr->second.m_status == QUEST_STATUS_INCOMPLETE) ) { @@ -12838,7 +12838,7 @@ bool Player::SatisfyQuestPrevChain( Quest const* qInfo, bool msg ) { uint32 prevId = *iter; - QuestStatusMap::iterator i_prevstatus = mQuestStatus.find( prevId ); + QuestStatusMap::const_iterator i_prevstatus = mQuestStatus.find( prevId ); if( i_prevstatus != mQuestStatus.end() ) { @@ -13101,7 +13101,7 @@ void Player::ItemAddedQuestCheck( uint32 entry, uint32 count ) if( !qInfo || !qInfo->HasFlag( QUEST_MANGOS_FLAGS_DELIVER ) ) continue; - for (int j = 0; j < QUEST_OBJECTIVES_COUNT; j++) + for (int j = 0; j < QUEST_OBJECTIVES_COUNT; ++j) { uint32 reqitem = qInfo->ReqItemId[j]; if ( reqitem == entry ) @@ -13138,7 +13138,7 @@ void Player::ItemRemovedQuestCheck( uint32 entry, uint32 count ) if( !qInfo->HasFlag( QUEST_MANGOS_FLAGS_DELIVER ) ) continue; - for (int j = 0; j < QUEST_OBJECTIVES_COUNT; j++) + for (int j = 0; j < QUEST_OBJECTIVES_COUNT; ++j) { uint32 reqitem = qInfo->ReqItemId[j]; if ( reqitem == entry ) @@ -13185,7 +13185,7 @@ void Player::KilledMonster( uint32 entry, uint64 guid ) { if( qInfo->HasFlag( QUEST_MANGOS_FLAGS_KILL_OR_CAST) ) { - for (int j = 0; j < QUEST_OBJECTIVES_COUNT; j++) + for (int j = 0; j < QUEST_OBJECTIVES_COUNT; ++j) { // skip GO activate objective or none if(qInfo->ReqCreatureOrGOId[j] <=0) @@ -13241,7 +13241,7 @@ void Player::CastedCreatureOrGO( uint32 entry, uint64 guid, uint32 spell_id ) { if( qInfo->HasFlag( QUEST_MANGOS_FLAGS_KILL_OR_CAST ) ) { - for (int j = 0; j < QUEST_OBJECTIVES_COUNT; j++) + for (int j = 0; j < QUEST_OBJECTIVES_COUNT; ++j) { // skip kill creature objective (0) or wrong spell casts if(qInfo->ReqSpell[j] != spell_id ) @@ -13308,7 +13308,7 @@ void Player::TalkedToCreature( uint32 entry, uint64 guid ) { if( qInfo->HasFlag( QUEST_MANGOS_FLAGS_KILL_OR_CAST | QUEST_MANGOS_FLAGS_SPEAKTO ) ) { - for (int j = 0; j < QUEST_OBJECTIVES_COUNT; j++) + for (int j = 0; j < QUEST_OBJECTIVES_COUNT; ++j) { // skip spell casts and Gameobject objectives if(qInfo->ReqSpell[j] > 0 || qInfo->ReqCreatureOrGOId[j] < 0) @@ -13429,13 +13429,13 @@ bool Player::HasQuestForItem( uint32 itemid ) const // There should be no mixed ReqItem/ReqSource drop // This part for ReqItem drop - for (int j = 0; j < QUEST_OBJECTIVES_COUNT; j++) + for (int j = 0; j < QUEST_OBJECTIVES_COUNT; ++j) { if(itemid == qinfo->ReqItemId[j] && q_status.m_itemcount[j] < qinfo->ReqItemCount[j] ) return true; } // This part - for ReqSource - for (int j = 0; j < QUEST_SOURCE_ITEM_IDS_COUNT; j++) + for (int j = 0; j < QUEST_SOURCE_ITEM_IDS_COUNT; ++j) { // examined item is a source item if (qinfo->ReqSourceId[j] == itemid) @@ -13617,7 +13617,7 @@ bool Player::MinimalLoadFromDB( QueryResult *result, uint32 guid ) if (delete_result) delete result; - for (int i = 0; i < PLAYER_SLOTS_COUNT; i++) + for (int i = 0; i < PLAYER_SLOTS_COUNT; ++i) m_items[i] = NULL; if( HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST) ) @@ -13956,7 +13956,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) if (transGUID != 0) { - for (MapManager::TransportSet::iterator iter = MapManager::Instance().m_Transports.begin(); iter != MapManager::Instance().m_Transports.end(); ++iter) + for (MapManager::TransportSet::const_iterator iter = MapManager::Instance().m_Transports.begin(); iter != MapManager::Instance().m_Transports.end(); ++iter) { if( (*iter)->GetGUIDLow() == transGUID) { @@ -14352,7 +14352,7 @@ void Player::_LoadActions(QueryResult *result) void Player::_LoadAuras(QueryResult *result, uint32 timediff) { m_Auras.clear(); - for (int i = 0; i < TOTAL_AURAS; i++) + for (int i = 0; i < TOTAL_AURAS; ++i) m_modAuras[i].clear(); //QueryResult *result = CharacterDatabase.PQuery("SELECT caster_guid,spell,effect_index,stackcount,amount,maxduration,remaintime,remaincharges FROM character_aura WHERE guid = '%u'",GetGUIDLow()); @@ -14403,7 +14403,7 @@ void Player::_LoadAuras(QueryResult *result, uint32 timediff) remaincharges = 0; - for(uint32 i=0; iSetSlot(NULL_SLOT); // the item is in a bag, find the bag - std::map::iterator itr = bagMap.find(bag_guid); + std::map::const_iterator itr = bagMap.find(bag_guid); if(itr != bagMap.end()) itr->second->StoreItem(slot, item, true ); else @@ -14927,7 +14927,7 @@ void Player::_LoadTutorials(QueryResult *result) { Field *fields = result->Fetch(); - for (int iI=0; iI<8; iI++) + for (int iI=0; iI<8; ++iI) m_Tutorials[iI] = fields[iI].GetUInt32(); } while( result->NextRow() ); @@ -14961,7 +14961,7 @@ void Player::_LoadGroup(QueryResult *result) void Player::_LoadBoundInstances(QueryResult *result) { - for(uint8 i = 0; i < TOTAL_DIFFICULTIES; i++) + for(uint8 i = 0; i < TOTAL_DIFFICULTIES; ++i) m_boundInstances[i].clear(); Group *group = GetGroup(); @@ -15075,7 +15075,7 @@ void Player::SendRaidInfo() for(int i = 0; i < TOTAL_DIFFICULTIES; ++i) { - for (BoundInstancesMap::iterator itr = m_boundInstances[i].begin(); itr != m_boundInstances[i].end(); ++itr) + for (BoundInstancesMap::const_iterator itr = m_boundInstances[i].begin(); itr != m_boundInstances[i].end(); ++itr) { if(itr->second.perm) { @@ -15100,9 +15100,9 @@ void Player::SendSavedInstances() bool hasBeenSaved = false; WorldPacket data; - for(uint8 i = 0; i < TOTAL_DIFFICULTIES; i++) + for(uint8 i = 0; i < TOTAL_DIFFICULTIES; ++i) { - for (BoundInstancesMap::iterator itr = m_boundInstances[i].begin(); itr != m_boundInstances[i].end(); ++itr) + for (BoundInstancesMap::const_iterator itr = m_boundInstances[i].begin(); itr != m_boundInstances[i].end(); ++itr) { if(itr->second.perm) // only permanent binds are sent { @@ -15120,9 +15120,9 @@ void Player::SendSavedInstances() if(!hasBeenSaved) return; - for(uint8 i = 0; i < TOTAL_DIFFICULTIES; i++) + for(uint8 i = 0; i < TOTAL_DIFFICULTIES; ++i) { - for (BoundInstancesMap::iterator itr = m_boundInstances[i].begin(); itr != m_boundInstances[i].end(); ++itr) + for (BoundInstancesMap::const_iterator itr = m_boundInstances[i].begin(); itr != m_boundInstances[i].end(); ++itr) { if(itr->second.perm) { @@ -15148,7 +15148,7 @@ void Player::ConvertInstancesToGroup(Player *player, Group *group, uint64 player if(player) { - for(uint8 i = 0; i < TOTAL_DIFFICULTIES; i++) + for(uint8 i = 0; i < TOTAL_DIFFICULTIES; ++i) { for (BoundInstancesMap::iterator itr = player->m_boundInstances[i].begin(); itr != player->m_boundInstances[i].end();) { @@ -15295,7 +15295,7 @@ void Player::SaveToDB() } uint16 i; - for( i = 0; i < m_valuesCount; i++ ) + for( i = 0; i < m_valuesCount; ++i ) { ss << GetUInt32Value(i) << " "; } @@ -15466,7 +15466,7 @@ void Player::_SaveAuras() { uint8 i; // or apply at cast SPELL_AURA_MOD_SHAPESHIFT or SPELL_AURA_MOD_STEALTH auras - for (i = 0; i < 3; i++) + for (i = 0; i < 3; ++i) if (spellInfo->EffectApplyAuraName[i] == SPELL_AURA_MOD_SHAPESHIFT || spellInfo->EffectApplyAuraName[i] == SPELL_AURA_MOD_STEALTH) break; @@ -15498,7 +15498,7 @@ void Player::_SaveInventory() { // force items in buyback slots to new state // and remove those that aren't already - for (uint8 i = BUYBACK_SLOT_START; i < BUYBACK_SLOT_END; i++) + for (uint8 i = BUYBACK_SLOT_START; i < BUYBACK_SLOT_END; ++i) { Item *item = m_items[i]; if (!item || item->GetState() == ITEM_NEW) continue; @@ -15508,7 +15508,7 @@ void Player::_SaveInventory() } // update enchantment durations - for(EnchantDurationList::iterator itr = m_enchantDuration.begin();itr != m_enchantDuration.end();++itr) + for(EnchantDurationList::const_iterator itr = m_enchantDuration.begin();itr != m_enchantDuration.end();++itr) { itr->item->SetEnchantmentDuration(itr->slot,itr->leftduration); } @@ -15518,7 +15518,7 @@ void Player::_SaveInventory() // do not save if the update queue is corrupt bool error = false; - for(size_t i = 0; i < m_itemUpdateQueue.size(); i++) + for(size_t i = 0; i < m_itemUpdateQueue.size(); ++i) { Item *item = m_itemUpdateQueue[i]; if(!item || item->GetState() == ITEM_REMOVED) continue; @@ -15543,7 +15543,7 @@ void Player::_SaveInventory() return; } - for(size_t i = 0; i < m_itemUpdateQueue.size(); i++) + for(size_t i = 0; i < m_itemUpdateQueue.size(); ++i) { Item *item = m_itemUpdateQueue[i]; if(!item) continue; @@ -15585,7 +15585,7 @@ void Player::_SaveMail() m->itemTextId, m->HasItems() ? 1 : 0, (uint64)m->expire_time, (uint64)m->deliver_time, m->money, m->COD, m->checked, m->messageID); if(m->removedItems.size()) { - for(std::vector::iterator itr2 = m->removedItems.begin(); itr2 != m->removedItems.end(); ++itr2) + for(std::vector::const_iterator itr2 = m->removedItems.begin(); itr2 != m->removedItems.end(); ++itr2) CharacterDatabase.PExecute("DELETE FROM mail_items WHERE item_guid = '%u'", *itr2); m->removedItems.clear(); } @@ -15594,7 +15594,7 @@ void Player::_SaveMail() else if (m->state == MAIL_STATE_DELETED) { if (m->HasItems()) - for(std::vector::iterator itr2 = m->items.begin(); itr2 != m->items.end(); ++itr2) + for(std::vector::const_iterator itr2 = m->items.begin(); itr2 != m->items.end(); ++itr2) CharacterDatabase.PExecute("DELETE FROM item_instance WHERE guid = '%u'", itr2->item_guid); if (m->itemTextId) CharacterDatabase.PExecute("DELETE FROM item_text WHERE id = '%u'", m->itemTextId); @@ -15796,7 +15796,7 @@ void Player::SaveDataFieldToDB() std::ostringstream ss; ss<<"UPDATE characters SET data='"; - for(uint16 i = 0; i < m_valuesCount; i++ ) + for(uint16 i = 0; i < m_valuesCount; ++i ) { ss << GetUInt32Value(i) << " "; } @@ -16284,7 +16284,7 @@ void Player::PetSpellInitialize() data << uint8(charmInfo->GetReactState()) << uint8(charmInfo->GetCommandState()) << uint16(0); // action bar loop - for(uint32 i = 0; i < 10; i++) + for(uint32 i = 0; i < 10; ++i) { data << uint32(charmInfo->GetActionBarEntry(i)->Raw); } @@ -16298,7 +16298,7 @@ void Player::PetSpellInitialize() if(pet->isControlled() && ((pet->getPetType() == HUNTER_PET) || ((pet->GetCreatureInfo()->type == CREATURE_TYPE_DEMON) && (getClass() == CLASS_WARLOCK)))) { // spells loop - for (PetSpellMap::iterator itr = pet->m_spells.begin(); itr != pet->m_spells.end(); ++itr) + for (PetSpellMap::const_iterator itr = pet->m_spells.begin(); itr != pet->m_spells.end(); ++itr) { if(itr->second->state == PETSPELL_REMOVED) continue; @@ -16363,7 +16363,7 @@ void Player::PossessSpellInitialize() data << uint32(0); data << uint32(0); - for(uint32 i = 0; i < 10; i++) //40 + for(uint32 i = 0; i < 10; ++i) //40 { data << uint16(charmInfo->GetActionBarEntry(i)->SpellOrAction) << uint16(charmInfo->GetActionBarEntry(i)->Type); } @@ -16417,7 +16417,7 @@ void Player::CharmSpellInitialize() data << uint8(0) << uint8(0); data << uint16(0); - for(uint32 i = 0; i < 10; i++) //40 + for(uint32 i = 0; i < 10; ++i) //40 { data << uint16(charmInfo->GetActionBarEntry(i)->SpellOrAction) << uint16(charmInfo->GetActionBarEntry(i)->Type); } @@ -16476,7 +16476,7 @@ void Player::AddSpellMod(SpellModifier* mod, bool apply) if ( mod->mask & _mask || mod->mask2 & _mask2) { int32 val = 0; - for (SpellModList::iterator itr = m_spellMods[mod->op].begin(); itr != m_spellMods[mod->op].end(); ++itr) + for (SpellModList::const_iterator itr = m_spellMods[mod->op].begin(); itr != m_spellMods[mod->op].end(); ++itr) { if ((*itr)->type == mod->type && ((*itr)->mask & _mask || (*itr)->mask2 & _mask2)) val += (*itr)->value; @@ -16508,7 +16508,7 @@ void Player::RemoveSpellMods(Spell const* spell) for(int i=0;iColor[i]) continue; @@ -18295,7 +18295,7 @@ bool Player::HasQuestForGO(int32 GOId) const if(GetGroup() && GetGroup()->isRaidGroup() && qinfo->GetType() != QUEST_TYPE_RAID) continue; - for (int j = 0; j < QUEST_OBJECTIVES_COUNT; j++) + for (int j = 0; j < QUEST_OBJECTIVES_COUNT; ++j) { if (qinfo->ReqCreatureOrGOId[j]>=0) //skip non GO case continue; @@ -18315,7 +18315,7 @@ void Player::UpdateForQuestsGO() UpdateData udata; WorldPacket packet; - for(ClientGUIDs::iterator itr=m_clientGUIDs.begin(); itr!=m_clientGUIDs.end(); ++itr) + for(ClientGUIDs::const_iterator itr=m_clientGUIDs.begin(); itr!=m_clientGUIDs.end(); ++itr) { if(IS_GAMEOBJECT_GUID(*itr)) { @@ -18475,7 +18475,7 @@ bool Player::CanNoReagentCast(SpellEntry const* spellInfo) const void Player::RemoveItemDependentAurasAndCasts( Item * pItem ) { AuraMap& auras = GetAuras(); - for(AuraMap::iterator itr = auras.begin(); itr != auras.end(); ) + for(AuraMap::const_iterator itr = auras.begin(); itr != auras.end(); ) { Aura* aura = itr->second; @@ -18500,7 +18500,7 @@ void Player::RemoveItemDependentAurasAndCasts( Item * pItem ) } // currently casted spells can be dependent from item - for (uint32 i = 0; i < CURRENT_MAX_SPELL; i++) + for (uint32 i = 0; i < CURRENT_MAX_SPELL; ++i) { if( m_currentSpells[i] && m_currentSpells[i]->getState()!=SPELL_STATE_DELAYED && !HasItemFitToSpellReqirements(m_currentSpells[i]->m_spellInfo,pItem) ) @@ -19338,7 +19338,7 @@ void Player::_LoadSkills() // Note: skill data itself loaded from `data` field. This is only cleanup part of load // reset skill modifiers and set correct unlearn flags - for (uint32 i = 0; i < PLAYER_MAX_SKILLS; i++) + for (uint32 i = 0; i < PLAYER_MAX_SKILLS; ++i) { SetUInt32Value(PLAYER_SKILL_BONUS_INDEX(i),0); @@ -19582,7 +19582,7 @@ void Player::LearnTalent(uint32 talentId, uint32 talentRank) if(TalentEntry const *depTalentInfo = sTalentStore.LookupEntry(talentInfo->DependsOn)) { bool hasEnoughRank = false; - for (int i = talentInfo->DependsOnRank; i < MAX_TALENT_RANK; i++) + for (int i = talentInfo->DependsOnRank; i < MAX_TALENT_RANK; ++i) { if (depTalentInfo->RankID[i] != 0) if (HasSpell(depTalentInfo->RankID[i])) @@ -19600,7 +19600,7 @@ void Player::LearnTalent(uint32 talentId, uint32 talentRank) if (talentInfo->Row > 0) { unsigned int numRows = sTalentStore.GetNumRows(); - for (unsigned int i = 0; i < numRows; i++) // Loop through all talents. + for (unsigned int i = 0; i < numRows; ++i) // Loop through all talents. { // Someday, someone needs to revamp const TalentEntry *tmpTalent = sTalentStore.LookupEntry(i); @@ -19608,7 +19608,7 @@ void Player::LearnTalent(uint32 talentId, uint32 talentRank) { if (tmpTalent->TalentTab == tTab) { - for (int j = 0; j < MAX_TALENT_RANK; j++) + for (int j = 0; j < MAX_TALENT_RANK; ++j) { if (tmpTalent->RankID[j] != 0) { @@ -19717,7 +19717,7 @@ void Player::LearnPetTalent(uint64 petGuid, uint32 talentId, uint32 talentRank) if(TalentEntry const *depTalentInfo = sTalentStore.LookupEntry(talentInfo->DependsOn)) { bool hasEnoughRank = false; - for (int i = talentInfo->DependsOnRank; i < MAX_TALENT_RANK; i++) + for (int i = talentInfo->DependsOnRank; i < MAX_TALENT_RANK; ++i) { if (depTalentInfo->RankID[i] != 0) if (pet->HasSpell(depTalentInfo->RankID[i])) @@ -19743,7 +19743,7 @@ void Player::LearnPetTalent(uint64 petGuid, uint32 talentId, uint32 talentRank) { if (tmpTalent->TalentTab == tTab) { - for (int j = 0; j < MAX_TALENT_RANK; j++) + for (int j = 0; j < MAX_TALENT_RANK; ++j) { if (tmpTalent->RankID[j] != 0) { diff --git a/src/game/Player.h b/src/game/Player.h index 96e04aedc..87768cc38 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -1777,7 +1777,7 @@ class MANGOS_DLL_SPEC Player : public Unit bool InBattleGroundQueue() const { - for (int i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; i++) + for (int i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i) if (m_bgBattleGroundQueueID[i].bgQueueTypeId != BATTLEGROUND_QUEUE_NONE) return true; return false; @@ -1786,14 +1786,14 @@ class MANGOS_DLL_SPEC Player : public Unit BattleGroundQueueTypeId GetBattleGroundQueueTypeId(uint32 index) const { return m_bgBattleGroundQueueID[index].bgQueueTypeId; } uint32 GetBattleGroundQueueIndex(BattleGroundQueueTypeId bgQueueTypeId) const { - for (int i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; i++) + for (int i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i) if (m_bgBattleGroundQueueID[i].bgQueueTypeId == bgQueueTypeId) return i; return PLAYER_MAX_BATTLEGROUND_QUEUES; } bool IsInvitedForBattleGroundQueueType(BattleGroundQueueTypeId bgQueueTypeId) const { - for (int i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; i++) + for (int i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i) if (m_bgBattleGroundQueueID[i].bgQueueTypeId == bgQueueTypeId) return m_bgBattleGroundQueueID[i].invitedToInstance != 0; return false; @@ -1810,7 +1810,7 @@ class MANGOS_DLL_SPEC Player : public Unit } uint32 AddBattleGroundQueueId(BattleGroundQueueTypeId val) { - for (int i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; i++) + for (int i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i) { if (m_bgBattleGroundQueueID[i].bgQueueTypeId == BATTLEGROUND_QUEUE_NONE || m_bgBattleGroundQueueID[i].bgQueueTypeId == val) { @@ -1823,14 +1823,14 @@ class MANGOS_DLL_SPEC Player : public Unit } bool HasFreeBattleGroundQueueId() { - for (int i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; i++) + for (int i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i) if (m_bgBattleGroundQueueID[i].bgQueueTypeId == BATTLEGROUND_QUEUE_NONE) return true; return false; } void RemoveBattleGroundQueueId(BattleGroundQueueTypeId val) { - for (int i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; i++) + for (int i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i) { if (m_bgBattleGroundQueueID[i].bgQueueTypeId == val) { @@ -1842,13 +1842,13 @@ class MANGOS_DLL_SPEC Player : public Unit } void SetInviteForBattleGroundQueueType(BattleGroundQueueTypeId bgQueueTypeId, uint32 instanceId) { - for (int i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; i++) + for (int i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i) if (m_bgBattleGroundQueueID[i].bgQueueTypeId == bgQueueTypeId) m_bgBattleGroundQueueID[i].invitedToInstance = instanceId; } bool IsInvitedForBattleGroundInstance(uint32 instanceId) const { - for (int i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; i++) + for (int i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i) if (m_bgBattleGroundQueueID[i].invitedToInstance == instanceId) return true; return false; diff --git a/src/game/PlayerDump.cpp b/src/game/PlayerDump.cpp index 7b3cb8f78..912c7519c 100644 --- a/src/game/PlayerDump.cpp +++ b/src/game/PlayerDump.cpp @@ -91,7 +91,7 @@ bool findnth(std::string &str, int n, std::string::size_type &s, std::string::si if (e == std::string::npos) return false; } while(str[e-1] == '\\'); - for(int i = 1; i < n; i++) + for(int i = 1; i < n; ++i) { do { @@ -155,7 +155,7 @@ bool changetoknth(std::string &str, int n, const char *with, bool insert = false uint32 registerNewGuid(uint32 oldGuid, std::map &guidMap, uint32 hiGuid) { - std::map::iterator itr = guidMap.find(oldGuid); + std::map::const_iterator itr = guidMap.find(oldGuid); if(itr != guidMap.end()) return itr->second; @@ -196,7 +196,7 @@ std::string CreateDumpString(char const* tableName, QueryResult *result) std::ostringstream ss; ss << "INSERT INTO "<< _TABLE_SIM_ << tableName << _TABLE_SIM_ << " VALUES ("; Field *fields = result->Fetch(); - for(uint32 i = 0; i < result->GetFieldCount(); i++) + for(uint32 i = 0; i < result->GetFieldCount(); ++i) { if (i == 0) ss << "'"; else ss << ", '"; @@ -362,7 +362,7 @@ std::string PlayerDumpWriter::GetDump(uint32 guid) else sLog.outError("Character DB not have 'character_db_version' table, revision guard query not added to pdump."); - for(int i = 0; i < DUMP_TABLE_COUNT; i++) + for(int i = 0; i < DUMP_TABLE_COUNT; ++i) DumpTable(dump, guid, dumpTables[i].name, dumpTables[i].name, dumpTables[i].type); // TODO: Add instance/group.. @@ -496,7 +496,7 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s DumpTableType type; uint8 i; - for(i = 0; i < DUMP_TABLE_COUNT; i++) + for(i = 0; i < DUMP_TABLE_COUNT; ++i) { if (tn == dumpTables[i].name) { diff --git a/src/game/QueryHandler.cpp b/src/game/QueryHandler.cpp index 4e31bfa42..ecf01ab1b 100644 --- a/src/game/QueryHandler.cpp +++ b/src/game/QueryHandler.cpp @@ -353,7 +353,7 @@ void WorldSession::HandleNpcTextQueryOpcode( WorldPacket & recv_data ) else { std::string Text_0[8], Text_1[8]; - for (int i=0;i<8;i++) + for (int i=0;i<8;++i) { Text_0[i]=pGossip->Options[i].Text_0; Text_1[i]=pGossip->Options[i].Text_1; @@ -365,7 +365,7 @@ void WorldSession::HandleNpcTextQueryOpcode( WorldPacket & recv_data ) NpcTextLocale const *nl = objmgr.GetNpcTextLocale(textID); if (nl) { - for (int i=0;i<8;i++) + for (int i=0;i<8;++i) { if (nl->Text_0[i].size() > size_t(loc_idx) && !nl->Text_0[i][loc_idx].empty()) Text_0[i]=nl->Text_0[i][loc_idx]; @@ -375,7 +375,7 @@ void WorldSession::HandleNpcTextQueryOpcode( WorldPacket & recv_data ) } } - for (int i=0; i<8; i++) + for (int i=0; i<8; ++i) { data << pGossip->Options[i].Probability; diff --git a/src/game/QuestDef.cpp b/src/game/QuestDef.cpp index 35ffefef4..2f0ed421c 100644 --- a/src/game/QuestDef.cpp +++ b/src/game/QuestDef.cpp @@ -131,7 +131,7 @@ Quest::Quest(Field * questRecord) m_rewitemscount = 0; m_rewchoiceitemscount = 0; - for (int i=0; i < QUEST_OBJECTIVES_COUNT; i++) + for (int i=0; i < QUEST_OBJECTIVES_COUNT; ++i) { if ( ReqItemId[i] ) ++m_reqitemscount; @@ -139,13 +139,13 @@ Quest::Quest(Field * questRecord) ++m_reqCreatureOrGOcount; } - for (int i=0; i < QUEST_REWARDS_COUNT; i++) + for (int i=0; i < QUEST_REWARDS_COUNT; ++i) { if ( RewItemId[i] ) ++m_rewitemscount; } - for (int i=0; i < QUEST_REWARD_CHOICES_COUNT; i++) + for (int i=0; i < QUEST_REWARD_CHOICES_COUNT; ++i) { if (RewChoiceItemId[i]) ++m_rewchoiceitemscount; diff --git a/src/game/QuestHandler.cpp b/src/game/QuestHandler.cpp index 430d84c0f..346d2576a 100644 --- a/src/game/QuestHandler.cpp +++ b/src/game/QuestHandler.cpp @@ -174,7 +174,7 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode( WorldPacket & recv_data ) // destroy not required for quest finish quest starting item bool destroyItem = true; - for(int i = 0; i < QUEST_OBJECTIVES_COUNT; i++) + for(int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) { if ((qInfo->ReqItemId[i] == ((Item*)pObject)->GetEntry()) && (((Item*)pObject)->GetProto()->MaxCount > 0)) { @@ -604,7 +604,7 @@ void WorldSession::HandleQuestgiverStatusQueryMultipleOpcode(WorldPacket& /*recv WorldPacket data(SMSG_QUESTGIVER_STATUS_MULTIPLE, 4); data << uint32(count); // placeholder - for(Player::ClientGUIDs::iterator itr = _player->m_clientGUIDs.begin(); itr != _player->m_clientGUIDs.end(); ++itr) + for(Player::ClientGUIDs::const_iterator itr = _player->m_clientGUIDs.begin(); itr != _player->m_clientGUIDs.end(); ++itr) { uint8 questStatus = DIALOG_STATUS_NONE; uint8 defstatus = DIALOG_STATUS_NONE; diff --git a/src/game/SkillDiscovery.cpp b/src/game/SkillDiscovery.cpp index 242487a38..adc6b6b26 100644 --- a/src/game/SkillDiscovery.cpp +++ b/src/game/SkillDiscovery.cpp @@ -140,7 +140,7 @@ uint32 GetExplicitDiscoverySpell(uint32 spellId, Player* player) { // explicit discovery spell chances (always success if case exist) // in this case we have both skill and spell - SkillDiscoveryMap::iterator tab = SkillDiscoveryStore.find(spellId); + SkillDiscoveryMap::const_iterator tab = SkillDiscoveryStore.find(spellId); if(tab == SkillDiscoveryStore.end()) return 0; @@ -149,7 +149,7 @@ uint32 GetExplicitDiscoverySpell(uint32 spellId, Player* player) uint32 skillvalue = lower != upper ? player->GetSkillValue(lower->second->skillId) : 0; float full_chance = 0; - for(SkillDiscoveryList::iterator item_iter = tab->second.begin(); item_iter != tab->second.end(); ++item_iter) + for(SkillDiscoveryList::const_iterator item_iter = tab->second.begin(); item_iter != tab->second.end(); ++item_iter) if(item_iter->reqSkillValue <= skillvalue) if(!player->HasSpell(item_iter->spellId)) full_chance += item_iter->chance; @@ -157,7 +157,7 @@ uint32 GetExplicitDiscoverySpell(uint32 spellId, Player* player) float rate = full_chance / 100.0f; float roll = rand_chance() * rate; // roll now in range 0..full_chance - for(SkillDiscoveryList::iterator item_iter = tab->second.begin(); item_iter != tab->second.end(); ++item_iter) + for(SkillDiscoveryList::const_iterator item_iter = tab->second.begin(); item_iter != tab->second.end(); ++item_iter) { if(item_iter->reqSkillValue > skillvalue) continue; @@ -179,11 +179,11 @@ uint32 GetSkillDiscoverySpell(uint32 skillId, uint32 spellId, Player* player) uint32 skillvalue = skillId ? player->GetSkillValue(skillId) : 0; // check spell case - SkillDiscoveryMap::iterator tab = SkillDiscoveryStore.find(spellId); + SkillDiscoveryMap::const_iterator tab = SkillDiscoveryStore.find(spellId); if(tab != SkillDiscoveryStore.end()) { - for(SkillDiscoveryList::iterator item_iter = tab->second.begin(); item_iter != tab->second.end(); ++item_iter) + for(SkillDiscoveryList::const_iterator item_iter = tab->second.begin(); item_iter != tab->second.end(); ++item_iter) { if( roll_chance_f(item_iter->chance * sWorld.getRate(RATE_SKILL_DISCOVERY)) && item_iter->reqSkillValue <= skillvalue @@ -201,7 +201,7 @@ uint32 GetSkillDiscoverySpell(uint32 skillId, uint32 spellId, Player* player) tab = SkillDiscoveryStore.find(-(int32)skillId); if(tab != SkillDiscoveryStore.end()) { - for(SkillDiscoveryList::iterator item_iter = tab->second.begin(); item_iter != tab->second.end(); ++item_iter) + for(SkillDiscoveryList::const_iterator item_iter = tab->second.begin(); item_iter != tab->second.end(); ++item_iter) { if( roll_chance_f(item_iter->chance * sWorld.getRate(RATE_SKILL_DISCOVERY)) && item_iter->reqSkillValue <= skillvalue diff --git a/src/game/SocialMgr.cpp b/src/game/SocialMgr.cpp index 928411192..c9dc812ca 100644 --- a/src/game/SocialMgr.cpp +++ b/src/game/SocialMgr.cpp @@ -41,10 +41,10 @@ PlayerSocial::~PlayerSocial() uint32 PlayerSocial::GetNumberOfSocialsWithFlag(SocialFlag flag) { uint32 counter = 0; - for(PlayerSocialMap::iterator itr = m_playerSocialMap.begin(); itr != m_playerSocialMap.end(); ++itr) + for(PlayerSocialMap::const_iterator itr = m_playerSocialMap.begin(); itr != m_playerSocialMap.end(); ++itr) { if(itr->second.Flags & flag) - counter++; + ++counter; } return counter; } @@ -67,7 +67,7 @@ bool PlayerSocial::AddToSocialList(uint32 friend_guid, bool ignore) if(ignore) flag = SOCIAL_FLAG_IGNORED; - PlayerSocialMap::iterator itr = m_playerSocialMap.find(friend_guid); + PlayerSocialMap::const_iterator itr = m_playerSocialMap.find(friend_guid); if(itr != m_playerSocialMap.end()) { CharacterDatabase.PExecute("UPDATE character_social SET flags = (flags | %u) WHERE guid = '%u' AND friend = '%u'", flag, GetPlayerGUID(), friend_guid); @@ -107,7 +107,7 @@ void PlayerSocial::RemoveFromSocialList(uint32 friend_guid, bool ignore) void PlayerSocial::SetFriendNote(uint32 friend_guid, std::string note) { - PlayerSocialMap::iterator itr = m_playerSocialMap.find(friend_guid); + PlayerSocialMap::const_iterator itr = m_playerSocialMap.find(friend_guid); if(itr == m_playerSocialMap.end()) // not exist return; @@ -155,7 +155,7 @@ void PlayerSocial::SendSocialList() bool PlayerSocial::HasFriend(uint32 friend_guid) { - PlayerSocialMap::iterator itr = m_playerSocialMap.find(friend_guid); + PlayerSocialMap::const_iterator itr = m_playerSocialMap.find(friend_guid); if(itr != m_playerSocialMap.end()) return itr->second.Flags & SOCIAL_FLAG_FRIEND; return false; @@ -163,7 +163,7 @@ bool PlayerSocial::HasFriend(uint32 friend_guid) bool PlayerSocial::HasIgnore(uint32 ignore_guid) { - PlayerSocialMap::iterator itr = m_playerSocialMap.find(ignore_guid); + PlayerSocialMap::const_iterator itr = m_playerSocialMap.find(ignore_guid); if(itr != m_playerSocialMap.end()) return itr->second.Flags & SOCIAL_FLAG_IGNORED; return false; @@ -270,7 +270,7 @@ void SocialMgr::BroadcastToFriendListers(Player *player, WorldPacket *packet) bool gmInWhoList = sWorld.getConfig(CONFIG_GM_IN_WHO_LIST); bool allowTwoSideWhoList = sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_WHO_LIST); - for(SocialMap::iterator itr = m_socialMap.begin(); itr != m_socialMap.end(); ++itr) + for(SocialMap::const_iterator itr = m_socialMap.begin(); itr != m_socialMap.end(); ++itr) { PlayerSocialMap::const_iterator itr2 = itr->second.m_playerSocialMap.find(guid); if(itr2 != itr->second.m_playerSocialMap.end() && (itr2->second.Flags & SOCIAL_FLAG_FRIEND)) diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 7d95ed83a..c3af8e2d9 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -427,7 +427,7 @@ void Spell::FillTargetMap() { // TODO: ADD the correct target FILLS!!!!!! - for(uint32 i=0;i<3;i++) + for(uint32 i=0;i<3;++i) { // not call for empty effect. // Also some spells use not used effect targets for store targets for dummy effect in triggered spells @@ -739,7 +739,7 @@ void Spell::FillTargetMap() ++itr; } - for(std::list::iterator iunit= tmpUnitMap.begin();iunit != tmpUnitMap.end();++iunit) + for(std::list::const_iterator iunit= tmpUnitMap.begin();iunit != tmpUnitMap.end();++iunit) AddUnitTarget((*iunit), i); } } @@ -1260,7 +1260,7 @@ bool Spell::IsAliveUnitPresentInTargetList() uint8 needAliveTargetMask = m_needAliveTargetMask; - for(std::list::iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit) + for(std::list::const_iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit) { if( ihit->missCondition == SPELL_MISS_NONE && (needAliveTargetMask & ihit->effectMask) ) { @@ -2272,7 +2272,7 @@ void Spell::cancel() case SPELL_STATE_CASTING: { - for(std::list::iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit) + for(std::list::const_iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit) { if( ihit->missCondition == SPELL_MISS_NONE ) { @@ -2751,7 +2751,7 @@ void Spell::finish(bool ok) { if (!(*i)->isAffectedOnSpell(m_spellInfo)) continue; - for(std::list::iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit) + for(std::list::const_iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit) if( ihit->missCondition == SPELL_MISS_NONE ) { // check m_caster->GetGUID() let load auras at login and speedup most often case @@ -2788,7 +2788,7 @@ void Spell::finish(bool ok) // Not drop combopoints if negative spell and if any miss on enemy exist bool needDrop = true; if (!IsPositiveSpell(m_spellInfo->Id)) - for(std::list::iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit) + for(std::list::const_iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit) if (ihit->missCondition != SPELL_MISS_NONE && ihit->targetGUID!=m_caster->GetGUID()) { needDrop = false; @@ -3065,18 +3065,18 @@ void Spell::WriteSpellGoTargets( WorldPacket * data ) } *data << (uint8)hit; - for(std::list::iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit) + for(std::list::const_iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit) if ((*ihit).missCondition == SPELL_MISS_NONE) // Add only hits { *data << uint64(ihit->targetGUID); m_needAliveTargetMask |=ihit->effectMask; } - for(std::list::iterator ighit= m_UniqueGOTargetInfo.begin();ighit != m_UniqueGOTargetInfo.end();++ighit) + for(std::list::const_iterator ighit= m_UniqueGOTargetInfo.begin();ighit != m_UniqueGOTargetInfo.end();++ighit) *data << uint64(ighit->targetGUID); // Always hits *data << (uint8)miss; - for(std::list::iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit) + for(std::list::const_iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit) { if( ihit->missCondition != SPELL_MISS_NONE ) // Add only miss { @@ -3242,7 +3242,7 @@ void Spell::SendChannelStart(uint32 duration) // select first not resisted target from target list for _0_ effect if(!m_UniqueTargetInfo.empty()) { - for(std::list::iterator itr= m_UniqueTargetInfo.begin();itr != m_UniqueTargetInfo.end();++itr) + for(std::list::const_iterator itr= m_UniqueTargetInfo.begin();itr != m_UniqueTargetInfo.end();++itr) { if( (itr->effectMask & (1<<0)) && itr->reflectResult==SPELL_MISS_NONE && itr->targetGUID != m_caster->GetGUID()) { @@ -3253,7 +3253,7 @@ void Spell::SendChannelStart(uint32 duration) } else if(!m_UniqueGOTargetInfo.empty()) { - for(std::list::iterator itr= m_UniqueGOTargetInfo.begin();itr != m_UniqueGOTargetInfo.end();++itr) + for(std::list::const_iterator itr= m_UniqueGOTargetInfo.begin();itr != m_UniqueGOTargetInfo.end();++itr) { if(itr->effectMask & (1<<0) ) { @@ -3605,7 +3605,7 @@ void Spell::HandleEffects(Unit *pUnitTarget,Item *pItemTarget,GameObject *pGOTar void Spell::TriggerSpell() { - for(TriggerSpells::iterator si=m_TriggerSpells.begin(); si!=m_TriggerSpells.end(); ++si) + for(TriggerSpells::const_iterator si=m_TriggerSpells.begin(); si!=m_TriggerSpells.end(); ++si) { Spell* spell = new Spell(m_caster, (*si), true, m_originalCasterGUID, m_selfContainer); spell->prepare(&m_targets); // use original spell original targets @@ -3705,7 +3705,7 @@ SpellCastResult Spell::CheckCast(bool strict) // auto selection spell rank implemented in WorldSession::HandleCastSpellOpcode // this case can be triggered if rank not found (too low-level target for first rank) if(m_caster->GetTypeId() == TYPEID_PLAYER && !IsPassiveSpell(m_spellInfo->Id) && !m_CastItem) - for(int i=0;i<3;i++) + for(int i=0;i<3;++i) if(IsPositiveEffect(m_spellInfo->Id, i) && m_spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AURA) if(target->getLevel() + 10 < m_spellInfo->spellLevel) return SPELL_FAILED_LOWLEVEL; @@ -3995,7 +3995,7 @@ SpellCastResult Spell::CheckCast(bool strict) return castResult; } - for (int i = 0; i < 3; i++) + for (int i = 0; i < 3; ++i) { // for effects of spells that have only one target switch(m_spellInfo->Effect[i]) @@ -4331,7 +4331,7 @@ SpellCastResult Spell::CheckCast(bool strict) } } - for (int i = 0; i < 3; i++) + for (int i = 0; i < 3; ++i) { switch(m_spellInfo->EffectApplyAuraName[i]) { @@ -4458,7 +4458,7 @@ SpellCastResult Spell::CheckPetCast(Unit* target) target = m_targets.getUnitTarget(); bool need = false; - for(uint32 i = 0;i<3;i++) + for(uint32 i = 0;i<3;++i) { if(m_spellInfo->EffectImplicitTargetA[i] == TARGET_CHAIN_DAMAGE || m_spellInfo->EffectImplicitTargetA[i] == TARGET_SINGLE_FRIEND || m_spellInfo->EffectImplicitTargetA[i] == TARGET_DUELVSPLAYER || m_spellInfo->EffectImplicitTargetA[i] == TARGET_SINGLE_PARTY || m_spellInfo->EffectImplicitTargetA[i] == TARGET_CURRENT_ENEMY_COORDINATES) { @@ -4635,7 +4635,7 @@ bool Spell::CanAutoCast(Unit* target) { FillTargetMap(); //check if among target units, our WANTED target is as well (->only self cast spells return false) - for(std::list::iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit) + for(std::list::const_iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit) if( ihit->targetGUID == targetguid ) return true; } @@ -4808,7 +4808,7 @@ SpellCastResult Spell::CheckItems() if(!proto) return SPELL_FAILED_ITEM_NOT_READY; - for (int i = 0; i<5; i++) + for (int i = 0; i<5; ++i) if (proto->Spells[i].SpellCharges) if(m_CastItem->GetSpellCharges(i)==0) return SPELL_FAILED_NO_CHARGES_REMAIN; @@ -4818,7 +4818,7 @@ SpellCastResult Spell::CheckItems() { // such items should only fail if there is no suitable effect at all - see Rejuvenation Potions for example SpellCastResult failReason = SPELL_CAST_OK; - for (int i = 0; i < 3; i++) + for (int i = 0; i < 3; ++i) { // skip check, pet not required like checks, and for TARGET_PET m_targets.getUnitTarget() is not the real target but the caster if (m_spellInfo->EffectImplicitTargetA[i] == TARGET_PET) @@ -4908,7 +4908,7 @@ SpellCastResult Spell::CheckItems() // check reagents (ignore triggered spells with reagents processed by original spell) and special reagent ignore case. if (!m_IsTriggeredSpell && !p_caster->CanNoReagentCast(m_spellInfo)) { - for(uint32 i=0;i<8;i++) + for(uint32 i=0;i<8;++i) { if(m_spellInfo->Reagent[i] <= 0) continue; @@ -4974,7 +4974,7 @@ SpellCastResult Spell::CheckItems() return SPELL_FAILED_TOTEM_CATEGORY; //0x7B // special checks for spell effects - for(int i = 0; i < 3; i++) + for(int i = 0; i < 3; ++i) { switch (m_spellInfo->Effect[i]) { @@ -5248,7 +5248,7 @@ void Spell::DelayedChannel() sLog.outDebug("Spell %u partially interrupted for %i ms, new duration: %u ms", m_spellInfo->Id, delaytime, m_timer); - for(std::list::iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit) + for(std::list::const_iterator ihit= m_UniqueTargetInfo.begin();ihit != m_UniqueTargetInfo.end();++ihit) { if ((*ihit).missCondition == SPELL_MISS_NONE) { diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index edd592c8b..863c01d1b 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -191,7 +191,7 @@ SpellSpecific GetSpellSpecific(uint32 spellId) if ((spellInfo->SpellFamilyFlags & 0x00000820180400LL) && (spellInfo->AttributesEx3 & 0x200)) return SPELL_JUDGEMENT; - for (int i = 0; i < 3; i++) + for (int i = 0; i < 3; ++i) { // only paladin auras have this (for palaldin class family) if (spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AREA_AURA_RAID) @@ -485,7 +485,7 @@ bool IsPositiveSpell(uint32 spellId) // spells with atleast one negative effect are considered negative // some self-applied spells have negative effects but in self casting case negative check ignored. - for (int i = 0; i < 3; i++) + for (int i = 0; i < 3; ++i) if (!IsPositiveEffect(spellId, i)) return false; return true; @@ -541,7 +541,7 @@ bool IsAuraAddedBySpell(uint32 auraType, uint32 spellId) SpellEntry const *spellproto = sSpellStore.LookupEntry(spellId); if (!spellproto) return false; - for (int i = 0; i < 3; i++) + for (int i = 0; i < 3; ++i) if (spellproto->EffectApplyAuraName[i] == auraType) return true; return false; @@ -1078,7 +1078,7 @@ bool SpellMgr::canStackSpellRanks(SpellEntry const *spellInfo) return false; // All stance spells. if any better way, change it. - for (int i = 0; i < 3; i++) + for (int i = 0; i < 3; ++i) { switch(spellInfo->SpellFamilyName) { @@ -1452,7 +1452,7 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) cons spellInfo_1->SpellIconID != 0 && spellInfo_2->SpellIconID != 0) { bool isModifier = false; - for (int i = 0; i < 3; i++) + for (int i = 0; i < 3; ++i) { if (spellInfo_1->EffectApplyAuraName[i] == SPELL_AURA_ADD_FLAT_MODIFIER || spellInfo_1->EffectApplyAuraName[i] == SPELL_AURA_ADD_PCT_MODIFIER || @@ -1556,7 +1556,7 @@ SpellEntry const* SpellMgr::SelectAuraRankForPlayerLevel(SpellEntry const* spell return spellInfo; bool needRankSelection = false; - for(int i=0;i<3;i++) + for(int i=0;i<3;++i) { if( IsPositiveEffect(spellInfo->Id, i) && ( spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AURA || @@ -1709,11 +1709,11 @@ void SpellMgr::LoadSpellChains() delete result; // additional integrity checks - for(SpellChainMap::iterator i = mSpellChains.begin(); i != mSpellChains.end(); ++i) + for(SpellChainMap::const_iterator i = mSpellChains.begin(); i != mSpellChains.end(); ++i) { if(i->second.prev) { - SpellChainMap::iterator i_prev = mSpellChains.find(i->second.prev); + SpellChainMap::const_iterator i_prev = mSpellChains.find(i->second.prev); if(i_prev == mSpellChains.end()) { sLog.outErrorDb("Spell %u (prev: %u, first: %u, rank: %d, req: %u) listed in `spell_chain` has not found previous rank spell in table.", @@ -1735,7 +1735,7 @@ void SpellMgr::LoadSpellChains() if(i->second.req) { - SpellChainMap::iterator i_req = mSpellChains.find(i->second.req); + SpellChainMap::const_iterator i_req = mSpellChains.find(i->second.req); if(i_req == mSpellChains.end()) { sLog.outErrorDb("Spell %u (prev: %u, first: %u, rank: %d, req: %u) listed in `spell_chain` has not found required rank spell in table.", @@ -2591,7 +2591,7 @@ SpellCastResult SpellMgr::GetSpellAllowedInLocationError(SpellEntry const *spell AreaGroupEntry const* groupEntry = sAreaGroupStore.LookupEntry(spellInfo->AreaGroupId); while (groupEntry) { - for (uint32 i=0; i<6; i++) + for (uint32 i=0; i<6; ++i) if( groupEntry->AreaId[i] == zone_id || groupEntry->AreaId[i] == area_id ) found = true; if (found || !groupEntry->nextGroup) @@ -2691,7 +2691,7 @@ void SpellMgr::LoadSkillLineAbilityMap() barGoLink bar( sSkillLineAbilityStore.GetNumRows() ); uint32 count = 0; - for (uint32 i = 0; i < sSkillLineAbilityStore.GetNumRows(); i++) + for (uint32 i = 0; i < sSkillLineAbilityStore.GetNumRows(); ++i) { bar.step(); SkillLineAbilityEntry const *SkillInfo = sSkillLineAbilityStore.LookupEntry(i); diff --git a/src/game/StatSystem.cpp b/src/game/StatSystem.cpp index 9d40f59dc..1d49de04e 100644 --- a/src/game/StatSystem.cpp +++ b/src/game/StatSystem.cpp @@ -102,7 +102,7 @@ void Player::ApplySpellHealingBonus(int32 amount, bool apply) { m_baseSpellHealing+=apply?amount:-amount; // For speed just update for client - for(int i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; i++) + for(int i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i) ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS+i, amount, apply);; } @@ -113,13 +113,13 @@ void Player::UpdateSpellDamageAndHealingBonus() // Get healing bonus for all schools SetStatInt32Value(PLAYER_FIELD_MOD_HEALING_DONE_POS, SpellBaseHealingBonus(SPELL_SCHOOL_MASK_ALL)); // Get damage bonus for all schools - for(int i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; i++) + for(int i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i) SetStatInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS+i, SpellBaseDamageBonus(SpellSchoolMask(1 << i))); } bool Player::UpdateAllStats() { - for (int i = STAT_STRENGTH; i < MAX_STATS; i++) + for (int i = STAT_STRENGTH; i < MAX_STATS; ++i) { float value = GetTotalStatValue(Stats(i)); SetStat(Stats(i), (int32)value); @@ -130,7 +130,7 @@ bool Player::UpdateAllStats() UpdateArmor(); UpdateMaxHealth(); - for(int i = POWER_MANA; i < MAX_POWERS; i++) + for(int i = POWER_MANA; i < MAX_POWERS; ++i) UpdateMaxPower(Powers(i)); UpdateAllCritPercentages(); @@ -141,7 +141,7 @@ bool Player::UpdateAllStats() UpdateManaRegen(); UpdateExpertise(BASE_ATTACK); UpdateExpertise(OFF_ATTACK); - for (int i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; i++) + for (int i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i) UpdateResistances(i); return true; @@ -611,7 +611,7 @@ void Player::UpdateSpellHitChances() void Player::UpdateAllSpellCritChances() { - for (int i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; i++) + for (int i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i) UpdateSpellCritChance(i); } @@ -868,13 +868,13 @@ bool Pet::UpdateStats(Stats stat) bool Pet::UpdateAllStats() { - for (int i = STAT_STRENGTH; i < MAX_STATS; i++) + for (int i = STAT_STRENGTH; i < MAX_STATS; ++i) UpdateStats(Stats(i)); - for(int i = POWER_MANA; i < MAX_POWERS; i++) + for(int i = POWER_MANA; i < MAX_POWERS; ++i) UpdateMaxPower(Powers(i)); - for (int i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; i++) + for (int i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i) UpdateResistances(i); return true; diff --git a/src/game/ThreatManager.cpp b/src/game/ThreatManager.cpp index b94ce4171..1a87ace79 100644 --- a/src/game/ThreatManager.cpp +++ b/src/game/ThreatManager.cpp @@ -201,7 +201,7 @@ Unit* HostilReference::getSourceUnit() void ThreatContainer::clearReferences() { - for(std::list::iterator i = iThreatList.begin(); i != iThreatList.end(); ++i) + for(std::list::const_iterator i = iThreatList.begin(); i != iThreatList.end(); ++i) { (*i)->unlink(); delete (*i); @@ -215,7 +215,7 @@ HostilReference* ThreatContainer::getReferenceByTarget(Unit* pVictim) { HostilReference* result = NULL; uint64 guid = pVictim->GetGUID(); - for(std::list::iterator i = iThreatList.begin(); i != iThreatList.end(); ++i) + for(std::list::const_iterator i = iThreatList.begin(); i != iThreatList.end(); ++i) { if((*i)->getUnitGuid() == guid) { @@ -276,10 +276,10 @@ HostilReference* ThreatContainer::selectNextVictim(Creature* pAttacker, HostilRe bool found = false; bool noPriorityTargetFound = false; - std::list::iterator lastRef = iThreatList.end(); + std::list::const_iterator lastRef = iThreatList.end(); lastRef--; - for(std::list::iterator iter = iThreatList.begin(); iter != iThreatList.end() && !found;) + for(std::list::const_iterator iter = iThreatList.begin(); iter != iThreatList.end() && !found;) { currentRef = (*iter); diff --git a/src/game/TradeHandler.cpp b/src/game/TradeHandler.cpp index 0a315e3c5..aa323c974 100644 --- a/src/game/TradeHandler.cpp +++ b/src/game/TradeHandler.cpp @@ -132,7 +132,7 @@ void WorldSession::SendUpdateTrade() data << (uint32) _player->pTrader->tradeGold; // trader gold data << (uint32) 0; // spell casted on lowest slot item - for(uint8 i = 0; i < TRADE_SLOT_COUNT; i++) + for(uint8 i = 0; i < TRADE_SLOT_COUNT; ++i) { item = (_player->pTrader->tradeItems[i] != NULL_SLOT ? _player->pTrader->GetItemByPos( _player->pTrader->tradeItems[i] ) : NULL); @@ -177,7 +177,7 @@ void WorldSession::SendUpdateTrade() void WorldSession::moveItems(Item* myItems[], Item* hisItems[]) { - for(int i=0; itradeItems[i] != NULL_SLOT ) { @@ -309,7 +309,7 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/) _player->pTrader->GetSession()->SendTradeStatus(TRADE_STATUS_TRADE_ACCEPT); // store items in local list and set 'in-trade' flag - for(int i=0; itradeItems[i] != NULL_SLOT ) { @@ -334,7 +334,7 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/) myCanCompleteTrade = (_player->CanStoreItems( hisItems,TRADE_SLOT_TRADED_COUNT ) == EQUIP_ERR_OK); // clear 'in-trade' flag - for(int i=0; iSetInTrade(false); if(hisItems[i]) hisItems[i]->SetInTrade(false); @@ -359,7 +359,7 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/) } // execute trade: 1. remove - for(int i=0; i::iterator i = mapsUsed.begin(); i != mapsUsed.end(); ++i) + for (std::set::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: @@ -215,7 +215,7 @@ bool Transport::GenerateWaypoints(uint32 pathid, std::set &mapids) std::vector keyFrames; int mapChange = 0; mapids.clear(); - for (size_t i = 1; i < path.Size() - 1; i++) + for (size_t i = 1; i < path.Size() - 1; ++i) { if (mapChange == 0) { @@ -247,7 +247,7 @@ bool Transport::GenerateWaypoints(uint32 pathid, std::set &mapids) } // find the rest of the distances between key points - for (size_t i = 1; i < keyFrames.size(); i++) + for (size_t i = 1; i < keyFrames.size(); ++i) { if ((keyFrames[i].actionflag == 1) || (keyFrames[i].mapid != keyFrames[i-1].mapid)) { @@ -270,7 +270,7 @@ bool Transport::GenerateWaypoints(uint32 pathid, std::set &mapids) } float tmpDist = 0; - for (size_t i = 0; i < keyFrames.size(); i++) + for (size_t i = 0; i < keyFrames.size(); ++i) { int j = (i + lastStop) % keyFrames.size(); if (keyFrames[j].actionflag == 2) @@ -289,7 +289,7 @@ bool Transport::GenerateWaypoints(uint32 pathid, std::set &mapids) tmpDist = 0; } - for (size_t i = 0; i < keyFrames.size(); i++) + for (size_t i = 0; i < keyFrames.size(); ++i) { if (keyFrames[i].distSinceStop < (30 * 30 * 0.5f)) keyFrames[i].tFrom = sqrt(2 * keyFrames[i].distSinceStop); @@ -305,7 +305,7 @@ bool Transport::GenerateWaypoints(uint32 pathid, std::set &mapids) keyFrames[i].tTo *= 1000; } - // for (int i = 0; i < keyFrames.size(); i++) { + // for (int i = 0; i < keyFrames.size(); ++i) { // sLog.outString("%f, %f, %f, %f, %f, %f, %f", keyFrames[i].x, keyFrames[i].y, keyFrames[i].distUntilStop, keyFrames[i].distSinceStop, keyFrames[i].distFromPrev, keyFrames[i].tFrom, keyFrames[i].tTo); // } @@ -321,7 +321,7 @@ bool Transport::GenerateWaypoints(uint32 pathid, std::set &mapids) t += keyFrames[0].delay * 1000; uint32 cM = keyFrames[0].mapid; - for (size_t i = 0; i < keyFrames.size() - 1; i++) + for (size_t i = 0; i < keyFrames.size() - 1; ++i) { float d = 0; float tFrom = keyFrames[i].tFrom; @@ -421,9 +421,9 @@ bool Transport::GenerateWaypoints(uint32 pathid, std::set &mapids) return true; } -Transport::WayPointMap::iterator Transport::GetNextWayPoint() +Transport::WayPointMap::const_iterator Transport::GetNextWayPoint() { - WayPointMap::iterator iter = m_curr; + WayPointMap::const_iterator iter = m_curr; ++iter; if (iter == m_WayPoints.end()) iter = m_WayPoints.begin(); @@ -436,9 +436,9 @@ void Transport::TeleportTransport(uint32 newMapid, float x, float y, float z) SetMapId(newMapid); Relocate(x, y, z); - for(PlayerSet::iterator itr = m_passengers.begin(); itr != m_passengers.end();) + for(PlayerSet::const_iterator itr = m_passengers.begin(); itr != m_passengers.end();) { - PlayerSet::iterator it2 = itr; + PlayerSet::const_iterator it2 = itr; ++itr; Player *plr = *it2; @@ -507,9 +507,9 @@ void Transport::Update(uint32 /*p_time*/) } /* - for(PlayerSet::iterator itr = m_passengers.begin(); itr != m_passengers.end();) + for(PlayerSet::const_iterator itr = m_passengers.begin(); itr != m_passengers.end();) { - PlayerSet::iterator it2 = itr; + PlayerSet::const_iterator it2 = itr; ++itr; //(*it2)->SetPosition( m_curr->second.x + (*it2)->GetTransOffsetX(), m_curr->second.y + (*it2)->GetTransOffsetY(), m_curr->second.z + (*it2)->GetTransOffsetZ(), (*it2)->GetTransOffsetO() ); } diff --git a/src/game/Transports.h b/src/game/Transports.h index d9107b9c9..8fc96e57f 100644 --- a/src/game/Transports.h +++ b/src/game/Transports.h @@ -95,8 +95,8 @@ class Transport : protected GameObject typedef std::map WayPointMap; - WayPointMap::iterator m_curr; - WayPointMap::iterator m_next; + WayPointMap::const_iterator m_curr; + WayPointMap::const_iterator m_next; uint32 m_pathTime; uint32 m_timer; @@ -110,6 +110,6 @@ class Transport : protected GameObject private: void TeleportTransport(uint32 newMapid, float x, float y, float z); void UpdateForMap(Map const* map); - WayPointMap::iterator GetNextWayPoint(); + WayPointMap::const_iterator GetNextWayPoint(); }; #endif diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index f5e5f8c90..4ed56827c 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -90,7 +90,7 @@ Unit::Unit() m_form = FORM_NONE; m_deathState = ALIVE; - for (uint32 i = 0; i < CURRENT_MAX_SPELL; i++) + for (uint32 i = 0; i < CURRENT_MAX_SPELL; ++i) m_currentSpells[i] = NULL; m_addDmgOnce = 0; @@ -160,7 +160,7 @@ Unit::Unit() Unit::~Unit() { // set current spells as deletable - for (uint32 i = 0; i < CURRENT_MAX_SPELL; i++) + for (uint32 i = 0; i < CURRENT_MAX_SPELL; ++i) { if (m_currentSpells[i]) { @@ -332,7 +332,7 @@ bool Unit::canReachWithAttack(Unit *pVictim) const void Unit::RemoveSpellsCausingAura(AuraType auraType) { if (auraType >= TOTAL_AURAS) return; - AuraList::iterator iter, next; + AuraList::const_iterator iter, next; for (iter = m_modAuras[auraType].begin(); iter != m_modAuras[auraType].end(); iter = next) { next = iter; @@ -757,7 +757,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa // TODO: Store auras by interrupt flag to speed this up. AuraMap& vAuras = pVictim->GetAuras(); - for (AuraMap::iterator i = vAuras.begin(), next; i != vAuras.end(); i = next) + for (AuraMap::const_iterator i = vAuras.begin(), next; i != vAuras.end(); i = next) { const SpellEntry *se = i->second->GetSpellProto(); next = i; ++next; @@ -784,7 +784,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa { if( damagetype != DOT ) { - for (uint32 i = CURRENT_FIRST_NON_MELEE_SPELL; i < CURRENT_MAX_SPELL; i++) + for (uint32 i = CURRENT_FIRST_NON_MELEE_SPELL; i < CURRENT_MAX_SPELL; ++i) { // skip channeled spell (processed differently below) if (i == CURRENT_CHANNELED_SPELL) @@ -851,7 +851,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa void Unit::CastStop(uint32 except_spellid) { - for (uint32 i = CURRENT_FIRST_NON_MELEE_SPELL; i < CURRENT_MAX_SPELL; i++) + for (uint32 i = CURRENT_FIRST_NON_MELEE_SPELL; i < CURRENT_MAX_SPELL; ++i) if (m_currentSpells[i] && m_currentSpells[i]->m_spellInfo->Id!=except_spellid) InterruptSpell(i,false); } @@ -1483,7 +1483,7 @@ void Unit::DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss) { if(GetTypeId() == TYPEID_PLAYER && pVictim->isAlive()) { - for(int i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; i++) + for(int i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; ++i) ((Player*)this)->CastItemCombatSpell(((Player*)this)->GetItemByPos(INVENTORY_SLOT_BAG_0,i), pVictim, damageInfo->attackType); } @@ -1588,7 +1588,7 @@ void Unit::CalcAbsorbResist(Unit *pVictim,SpellSchoolMask schoolMask, DamageEffe uint32 faq[4] = {24,6,4,6}; uint8 m = 0; float Binom = 0.0f; - for (uint8 i = 0; i < 4; i++) + for (uint8 i = 0; i < 4; ++i) { Binom += 2400 *( powf(tmpvalue2, i) * powf( (1-tmpvalue2), (4-i)))/faq[i]; if (ran > Binom ) @@ -2618,7 +2618,7 @@ float Unit::MeleeMissChanceCalc(const Unit *pVictim, WeaponAttackType attType) c if (haveOffhandWeapon() && attType != RANGED_ATTACK) { bool isNormal = false; - for (uint32 i = CURRENT_FIRST_NON_MELEE_SPELL; i < CURRENT_MAX_SPELL; i++) + for (uint32 i = CURRENT_FIRST_NON_MELEE_SPELL; i < CURRENT_MAX_SPELL; ++i) { if( m_currentSpells[i] && (GetSpellSchoolMask(m_currentSpells[i]->m_spellInfo) & SPELL_SCHOOL_MASK_NORMAL) ) { @@ -2874,7 +2874,7 @@ void Unit::_UpdateSpells( uint32 time ) _UpdateAutoRepeatSpell(); // remove finished spells from current pointers - for (uint32 i = 0; i < CURRENT_MAX_SPELL; i++) + for (uint32 i = 0; i < CURRENT_MAX_SPELL; ++i) { if (m_currentSpells[i] && m_currentSpells[i]->getState() == SPELL_STATE_FINISHED) { @@ -3119,7 +3119,7 @@ void Unit::InterruptNonMeleeSpells(bool withDelayed, uint32 spell_id) Spell* Unit::FindCurrentSpellBySpellId(uint32 spell_id) const { - for (uint32 i = 0; i < CURRENT_MAX_SPELL; i++) + for (uint32 i = 0; i < CURRENT_MAX_SPELL; ++i) if(m_currentSpells[i] && m_currentSpells[i]->m_spellInfo->Id==spell_id) return m_currentSpells[i]; return NULL; @@ -3420,7 +3420,7 @@ bool Unit::AddAura(Aura *Aur) bool restart = false; AuraList& scAuras = caster->GetSingleCastAuras(); - for(AuraList::iterator itr = scAuras.begin(); itr != scAuras.end(); ++itr) + for(AuraList::const_iterator itr = scAuras.begin(); itr != scAuras.end(); ++itr) { if( (*itr)->GetTarget() != Aur->GetTarget() && IsSingleTargetSpells((*itr)->GetSpellProto(),aurSpellInfo) ) @@ -3463,7 +3463,7 @@ void Unit::RemoveRankAurasDueToSpell(uint32 spellId) SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId); if(!spellInfo) return; - AuraMap::iterator i,next; + AuraMap::const_iterator i,next; for (i = m_Auras.begin(); i != m_Auras.end(); i = next) { next = i; @@ -3922,7 +3922,7 @@ void Unit::RemoveAllAurasOnDeath() void Unit::DelayAura(uint32 spellId, uint32 effindex, int32 delaytime) { - AuraMap::iterator iter = m_Auras.find(spellEffectPair(spellId, effindex)); + AuraMap::const_iterator iter = m_Auras.find(spellEffectPair(spellId, effindex)); if (iter != m_Auras.end()) { if (iter->second->GetAuraDuration() < delaytime) @@ -3936,7 +3936,7 @@ void Unit::DelayAura(uint32 spellId, uint32 effindex, int32 delaytime) void Unit::_RemoveAllAuraMods() { - for (AuraMap::iterator i = m_Auras.begin(); i != m_Auras.end(); ++i) + for (AuraMap::const_iterator i = m_Auras.begin(); i != m_Auras.end(); ++i) { (*i).second->ApplyModifier(false); } @@ -3944,7 +3944,7 @@ void Unit::_RemoveAllAuraMods() void Unit::_ApplyAllAuraMods() { - for (AuraMap::iterator i = m_Auras.begin(); i != m_Auras.end(); ++i) + for (AuraMap::const_iterator i = m_Auras.begin(); i != m_Auras.end(); ++i) { (*i).second->ApplyModifier(true); } @@ -3952,7 +3952,7 @@ void Unit::_ApplyAllAuraMods() Aura* Unit::GetAura(uint32 spellId, uint32 effindex) { - AuraMap::iterator iter = m_Auras.find(spellEffectPair(spellId, effindex)); + AuraMap::const_iterator iter = m_Auras.find(spellEffectPair(spellId, effindex)); if (iter != m_Auras.end()) return iter->second; return NULL; @@ -4776,7 +4776,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu // Remove any stun effect on target AuraMap& Auras = pVictim->GetAuras(); - for(AuraMap::iterator iter = Auras.begin(); iter != Auras.end();) + for(AuraMap::const_iterator iter = Auras.begin(); iter != Auras.end();) { SpellEntry const *spell = iter->second->GetSpellProto(); if( spell->Mechanic == MECHANIC_STUN || @@ -5539,7 +5539,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu case 54939: { // Lookup base amount mana restore - for (int i=0; i<3;i++) + for (int i=0; i<3;++i) if (procSpell->Effect[i] == SPELL_EFFECT_ENERGIZE) { int32 mana = procSpell->EffectBasePoints[i]; @@ -7267,7 +7267,7 @@ bool Unit::isAttackingPlayer() const if(charmed && charmed->isAttackingPlayer()) return true; - for (int8 i = 0; i < MAX_TOTEM; i++) + for (int8 i = 0; i < MAX_TOTEM; ++i) { if(m_TotemSlot[i]) { @@ -7284,7 +7284,7 @@ void Unit::RemoveAllAttackers() { while (!m_attackers.empty()) { - AttackerSet::iterator iter = m_attackers.begin(); + AttackerSet::const_iterator iter = m_attackers.begin(); if(!(*iter)->AttackStop()) { sLog.outError("WORLD: Unit has an attacker that isn't attacking it!"); @@ -8458,7 +8458,7 @@ void Unit::MeleeDamageBonus(Unit *pVictim, uint32 *pdamage,WeaponAttackType attT bool normalized = false; if(spellProto) { - for (uint8 i = 0; i<3;i++) + for (uint8 i = 0; i<3;++i) { if (spellProto->Effect[i] == SPELL_EFFECT_NORMALIZED_WEAPON_DMG) { @@ -10222,7 +10222,7 @@ CharmInfo::CharmInfo(Unit* unit) void CharmInfo::InitPetActionBar() { // the first 3 SpellOrActions are attack, follow and stay - for(uint32 i = 0; i < 3; i++) + for(uint32 i = 0; i < 3; ++i) { PetActionBar[i].Type = ACT_COMMAND; PetActionBar[i].SpellOrAction = COMMAND_ATTACK - i; @@ -10230,7 +10230,7 @@ void CharmInfo::InitPetActionBar() PetActionBar[i + 7].Type = ACT_REACTION; PetActionBar[i + 7].SpellOrAction = COMMAND_ATTACK - i; } - for(uint32 i=0; i < 4; i++) + for(uint32 i=0; i < 4; ++i) { PetActionBar[i + 3].Type = ACT_DISABLED; PetActionBar[i + 3].SpellOrAction = 0; @@ -10312,7 +10312,7 @@ void CharmInfo::InitCharmCreateSpells() bool CharmInfo::AddSpellToAB(uint32 oldid, uint32 newid, ActiveStates newstate) { - for(uint8 i = 0; i < 10; i++) + for(uint8 i = 0; i < 10; ++i) { if((PetActionBar[i].Type == ACT_DISABLED || PetActionBar[i].Type == ACT_ENABLED || PetActionBar[i].Type == ACT_PASSIVE) && PetActionBar[i].SpellOrAction == oldid) { @@ -10379,7 +10379,7 @@ typedef std::list< uint32> RemoveSpellList; // for example SPELL_AURA_MECHANIC_IMMUNITY - need check for mechanic bool InitTriggerAuraData() { - for (int i=0;itriggeredByAura->GetModifier()->m_auraname, i->triggeredByAura_SpellPair.first, i->triggeredByAura_SpellPair.second); // sLog.outDebug("It can be deleted one from early proccesed auras:"); -// for(ProcTriggeredList::iterator i2 = procTriggered.begin(); i != i2; ++i2) +// for(ProcTriggeredList::const_iterator i2 = procTriggered.begin(); i != i2; ++i2) // sLog.outDebug(" Spell aura %u (id:%u effect:%u)", i->triggeredByAura->GetModifier()->m_auraname,i2->triggeredByAura_SpellPair.first,i2->triggeredByAura_SpellPair.second); // sLog.outDebug(" "); continue; @@ -10699,7 +10699,7 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag removedSpells.sort(); removedSpells.unique(); // Remove auras from removedAuras - for(RemoveSpellList::const_iterator i = removedSpells.begin(); i != removedSpells.end();i++) + for(RemoveSpellList::const_iterator i = removedSpells.begin(); i != removedSpells.end();++i) RemoveAurasDueToSpell(*i); } } @@ -11060,7 +11060,7 @@ Unit* Unit::SelectNearbyTarget() const bool Unit::hasNegativeAuraWithInterruptFlag(uint32 flag) { - for (AuraMap::iterator iter = m_Auras.begin(); iter != m_Auras.end(); ++iter) + for (AuraMap::const_iterator iter = m_Auras.begin(); iter != m_Auras.end(); ++iter) { if (!iter->second->IsPositive() && iter->second->GetSpellProto()->AuraInterruptFlags & flag) return true; @@ -11107,7 +11107,7 @@ uint32 Unit::GetCastingTimeForBonus( SpellEntry const *spellProto, DamageEffectT bool DirectDamage = false; bool AreaEffect = false; - for ( uint32 i=0; i<3;i++) + for ( uint32 i=0; i<3;++i) { switch ( spellProto->Effect[i] ) { diff --git a/src/game/Unit.h b/src/game/Unit.h index 2b9b14352..5fae823cf 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -830,7 +830,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject void _addAttacker(Unit *pAttacker) // must be called only from Unit::Attack(Unit*) { - AttackerSet::iterator itr = m_attackers.find(pAttacker); + AttackerSet::const_iterator itr = m_attackers.find(pAttacker); if(itr == m_attackers.end()) m_attackers.insert(pAttacker); } @@ -1275,7 +1275,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject uint32 GetVisibleAura(uint8 slot) { - VisibleAuraMap::iterator itr = m_visibleAuras.find(slot); + VisibleAuraMap::const_iterator itr = m_visibleAuras.find(slot); if(itr != m_visibleAuras.end()) return itr->second; return 0; diff --git a/src/game/UpdateData.cpp b/src/game/UpdateData.cpp index 7d668299f..240ac7ff7 100644 --- a/src/game/UpdateData.cpp +++ b/src/game/UpdateData.cpp @@ -114,7 +114,7 @@ bool UpdateData::BuildPacket(WorldPacket *packet, bool hasTransport) buf << (uint32) m_outOfRangeGUIDs.size(); for(std::set::const_iterator i = m_outOfRangeGUIDs.begin(); - i != m_outOfRangeGUIDs.end(); i++) + i != m_outOfRangeGUIDs.end(); ++i) { //buf.appendPackGUID(*i); buf << (uint8)0xFF; diff --git a/src/game/UpdateMask.h b/src/game/UpdateMask.h index 5b844ad54..17b7fa1cf 100644 --- a/src/game/UpdateMask.h +++ b/src/game/UpdateMask.h @@ -83,14 +83,14 @@ class UpdateMask void operator &= ( const UpdateMask& mask ) { ASSERT(mask.mCount <= mCount); - for (uint32 i = 0; i < mBlocks; i++) + for (uint32 i = 0; i < mBlocks; ++i) mUpdateMask[i] &= mask.mUpdateMask[i]; } void operator |= ( const UpdateMask& mask ) { ASSERT(mask.mCount <= mCount); - for (uint32 i = 0; i < mBlocks; i++) + for (uint32 i = 0; i < mBlocks; ++i) mUpdateMask[i] |= mask.mUpdateMask[i]; } diff --git a/src/game/WaypointManager.cpp b/src/game/WaypointManager.cpp index 043d6fc91..cfb12eab1 100644 --- a/src/game/WaypointManager.cpp +++ b/src/game/WaypointManager.cpp @@ -189,7 +189,7 @@ void WaypointManager::Unload() void WaypointManager::_clearPath(WaypointPath &path) { - for(WaypointPath::iterator itr = path.begin(); itr != path.end(); ++itr) + for(WaypointPath::const_iterator itr = path.begin(); itr != path.end(); ++itr) if(itr->behavior) delete itr->behavior; path.clear(); @@ -230,7 +230,7 @@ uint32 WaypointManager::GetLastPoint(uint32 id, uint32 default_notfound) point = (*result)[0].GetUInt32()+1; delete result; }*/ - WaypointPathMap::iterator itr = m_pathMap.find(id); + WaypointPathMap::const_iterator itr = m_pathMap.find(id); if(itr != m_pathMap.end() && itr->second.size() != 0) point = itr->second.size(); return point; @@ -309,7 +309,7 @@ void WaypointManager::SetNodeText(uint32 id, uint32 point, const char *text_fiel void WaypointManager::CheckTextsExistance(std::set& ids) { - WaypointPathMap::iterator pmItr = m_pathMap.begin(); + WaypointPathMap::const_iterator pmItr = m_pathMap.begin(); for ( ; pmItr != m_pathMap.end(); ++pmItr) { for (int i = 0; i < pmItr->second.size(); ++i) diff --git a/src/game/WaypointMovementGenerator.cpp b/src/game/WaypointMovementGenerator.cpp index d3df843ac..38cf80dde 100644 --- a/src/game/WaypointMovementGenerator.cpp +++ b/src/game/WaypointMovementGenerator.cpp @@ -56,7 +56,7 @@ void WaypointMovementGenerator::LoadPath(Creature &c) uint32 node_count = i_path->size(); i_hasDone.resize(node_count); - for(uint32 i = 0; i < node_count-1; i++) + for(uint32 i = 0; i < node_count-1; ++i) i_hasDone[i] = false; // to prevent a misbehavior inside "update" @@ -470,7 +470,7 @@ int CreatePathAStar(gentity_t *bot, int from, int to, short int *pathlist) break; } - for (i = 0; i < nodes[atNode].enodenum; i++) //loop through all the links for this node + for (i = 0; i < nodes[atNode].enodenum; ++i) //loop through all the links for this node { newnode = nodes[atNode].links[i].targetNode; @@ -528,7 +528,7 @@ int CreatePathAStar(gentity_t *bot, int from, int to, short int *pathlist) parent[newnode] = atNode; //set the new parent for this node gcost[newnode] = gc; //and the new g cost - for (i = 1; i < numOpen; i++) //loop through all the items on the open list + for (i = 1; i < numOpen; ++i) //loop through all the items on the open list { if (openlist[i] == newnode) //find this node in the list { diff --git a/src/game/World.cpp b/src/game/World.cpp index 45c5c093c..3542d68ac 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -114,7 +114,7 @@ World::~World() } ///- Empty the WeatherMap - for (WeatherMap::iterator itr = m_weathers.begin(); itr != m_weathers.end(); ++itr) + for (WeatherMap::const_iterator itr = m_weathers.begin(); itr != m_weathers.end(); ++itr) delete itr->second; m_weathers.clear(); @@ -133,7 +133,7 @@ World::~World() Player* World::FindPlayerInZone(uint32 zone) { ///- circle through active sessions and return the first player found in the zone - SessionMap::iterator itr; + SessionMap::const_iterator itr; for (itr = m_sessions.begin(); itr != m_sessions.end(); ++itr) { if(!itr->second) @@ -165,7 +165,7 @@ WorldSession* World::FindSession(uint32 id) const bool World::RemoveSession(uint32 id) { ///- Find the session, kick the user, but we can't delete session at this moment to prevent iterator invalidation - SessionMap::iterator itr = m_sessions.find(id); + SessionMap::const_iterator itr = m_sessions.find(id); if(itr != m_sessions.end() && itr->second) { @@ -261,7 +261,7 @@ int32 World::GetQueuePos(WorldSession* sess) { uint32 position = 1; - for(Queue::iterator iter = m_QueuedPlayer.begin(); iter != m_QueuedPlayer.end(); ++iter, ++position) + for(Queue::const_iterator iter = m_QueuedPlayer.begin(); iter != m_QueuedPlayer.end(); ++iter, ++position) if((*iter) == sess) return position; @@ -1469,7 +1469,7 @@ void World::DetectDBCLang() void World::Update(uint32 diff) { ///- Update the different timers - for(int i = 0; i < WUPDATE_COUNT; i++) + for(int i = 0; i < WUPDATE_COUNT; ++i) if(m_timers[i].GetCurrent()>=0) m_timers[i].Update(diff); else m_timers[i].SetCurrent(0); @@ -2296,7 +2296,7 @@ void World::ScriptsProcess() /// Send a packet to all players (except self if mentioned) void World::SendGlobalMessage(WorldPacket *packet, WorldSession *self, uint32 team) { - SessionMap::iterator itr; + SessionMap::const_iterator itr; for (itr = m_sessions.begin(); itr != m_sessions.end(); ++itr) { if (itr->second && @@ -2375,7 +2375,7 @@ void World::SendWorldText(int32 string_id, ...) MaNGOS::WorldWorldTextBuilder wt_builder(string_id, &ap); MaNGOS::LocalizedPacketListDo wt_do(wt_builder); - for(SessionMap::iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr) + for(SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr) { if(!itr->second || !itr->second->GetPlayer() || !itr->second->GetPlayer()->IsInWorld() ) continue; @@ -2407,7 +2407,7 @@ void World::SendGlobalText(const char* text, WorldSession *self) /// Send a packet to all players (or players selected team) in the zone (except self if mentioned) void World::SendZoneMessage(uint32 zone, WorldPacket *packet, WorldSession *self, uint32 team) { - SessionMap::iterator itr; + SessionMap::const_iterator itr; for (itr = m_sessions.begin(); itr != m_sessions.end(); ++itr) { if (itr->second && @@ -2436,7 +2436,7 @@ void World::KickAll() m_QueuedPlayer.clear(); // prevent send queue update packet and login queued sessions // session not removed at kick and will removed in next update tick - for (SessionMap::iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr) + for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr) itr->second->KickPlayer(); } @@ -2444,7 +2444,7 @@ void World::KickAll() void World::KickAllLess(AccountTypes sec) { // session not removed at kick and will removed in next update tick - for (SessionMap::iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr) + for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr) if(itr->second->GetSecurity() < sec) itr->second->KickPlayer(); } @@ -2452,7 +2452,7 @@ void World::KickAllLess(AccountTypes sec) /// Kick (and save) the designated player bool World::KickPlayer(const std::string& playerName) { - SessionMap::iterator itr; + SessionMap::const_iterator itr; // session not removed at kick and will removed in next update tick for (itr = m_sessions.begin(); itr != m_sessions.end(); ++itr) @@ -2801,7 +2801,7 @@ void World::ResetDailyQuests() { sLog.outDetail("Daily quests reset for all characters."); CharacterDatabase.Execute("DELETE FROM character_queststatus_daily"); - for(SessionMap::iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr) + for(SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr) if(itr->second->GetPlayer()) itr->second->GetPlayer()->ResetDailyQuestStatus(); } diff --git a/src/game/WorldSession.cpp b/src/game/WorldSession.cpp index da88c8e7e..eac9679d6 100644 --- a/src/game/WorldSession.cpp +++ b/src/game/WorldSession.cpp @@ -307,7 +307,7 @@ void WorldSession::LogoutPlayer(bool Save) if(!_player->m_InstanceValid && !_player->isGameMaster()) _player->TeleportTo(_player->m_homebindMapId, _player->m_homebindX, _player->m_homebindY, _player->m_homebindZ, _player->GetOrientation()); - for (int i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; i++) + for (int i=0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i) { if(BattleGroundQueueTypeId bgQueueTypeId = _player->GetBattleGroundQueueTypeId(i)) { diff --git a/src/game/WorldSocketMgr.cpp b/src/game/WorldSocketMgr.cpp index 8c5883926..876862937 100644 --- a/src/game/WorldSocketMgr.cpp +++ b/src/game/WorldSocketMgr.cpp @@ -132,7 +132,7 @@ class ReactorRunnable : protected ACE_Task_Base if (m_NewSockets.empty ()) return; - for (SocketSet::iterator i = m_NewSockets.begin (); i != m_NewSockets.end (); ++i) + for (SocketSet::const_iterator i = m_NewSockets.begin (); i != m_NewSockets.end (); ++i) { WorldSocket* sock = (*i); @@ -156,7 +156,7 @@ class ReactorRunnable : protected ACE_Task_Base ACE_ASSERT (m_Reactor); - SocketSet::iterator i, t; + SocketSet::const_iterator i, t; while (!m_Reactor->reactor_event_loop_done ()) { @@ -174,14 +174,14 @@ class ReactorRunnable : protected ACE_Task_Base if ((*i)->Update () == -1) { t = i; - i++; + ++i; (*t)->CloseSocket (); (*t)->RemoveReference (); --m_Connections; m_Sockets.erase (t); } else - i++; + ++i; } } diff --git a/src/game/debugcmds.cpp b/src/game/debugcmds.cpp index a6ac22fdf..b09e90256 100644 --- a/src/game/debugcmds.cpp +++ b/src/game/debugcmds.cpp @@ -378,7 +378,7 @@ bool ChatHandler::HandleDebugGetItemState(const char* args) { state_str = "The player has the following " + state_str + " items: "; SendSysMessage(state_str.c_str()); - for (uint8 i = PLAYER_SLOT_START; i < PLAYER_SLOT_END; i++) + for (uint8 i = PLAYER_SLOT_START; i < PLAYER_SLOT_END; ++i) { if(i >= BUYBACK_SLOT_START && i < BUYBACK_SLOT_END) continue; @@ -406,7 +406,7 @@ bool ChatHandler::HandleDebugGetItemState(const char* args) if (list_queue) { std::vector &updateQueue = player->GetItemUpdateQueue(); - for(size_t i = 0; i < updateQueue.size(); i++) + for(size_t i = 0; i < updateQueue.size(); ++i) { Item *item = updateQueue[i]; if(!item) continue; @@ -433,7 +433,7 @@ bool ChatHandler::HandleDebugGetItemState(const char* args) { bool error = false; std::vector &updateQueue = player->GetItemUpdateQueue(); - for (uint8 i = PLAYER_SLOT_START; i < PLAYER_SLOT_END; i++) + for (uint8 i = PLAYER_SLOT_START; i < PLAYER_SLOT_END; ++i) { if(i >= BUYBACK_SLOT_START && i < BUYBACK_SLOT_END) continue; @@ -549,7 +549,7 @@ bool ChatHandler::HandleDebugGetItemState(const char* args) } } - for(size_t i = 0; i < updateQueue.size(); i++) + for(size_t i = 0; i < updateQueue.size(); ++i) { Item *item = updateQueue[i]; if(!item) continue; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 49ad20f0e..821681a07 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "7729" + #define REVISION_NR "7730" #endif // __REVISION_NR_H__