diff --git a/src/game/BattleGround/BattleGround.cpp b/src/game/BattleGround/BattleGround.cpp index 34b82f5b3..54537eaaa 100644 --- a/src/game/BattleGround/BattleGround.cpp +++ b/src/game/BattleGround/BattleGround.cpp @@ -1530,10 +1530,12 @@ void BattleGround::StartBattleGround() void BattleGround::StartTimedAchievement(AchievementCriteriaTypes type, uint32 entry) { for (BattleGroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr) + { if (Player* pPlayer = GetBgMap()->GetPlayer(itr->first)) { pPlayer->GetAchievementMgr().StartTimedAchievementCriteria(type, entry); } + } } /// diff --git a/src/game/BattleGround/BattleGroundAB.cpp b/src/game/BattleGround/BattleGroundAB.cpp index 9a3c3ff41..21b77c185 100644 --- a/src/game/BattleGround/BattleGroundAB.cpp +++ b/src/game/BattleGround/BattleGroundAB.cpp @@ -140,10 +140,12 @@ void BattleGroundAB::Update(uint32 diff) } for (uint8 team = 0; team < PVP_TEAM_COUNT; ++team) + { if (m_Nodes[node] == team + BG_AB_NODE_TYPE_OCCUPIED) { ++team_points[team]; } + } } // Accumulate points @@ -379,14 +381,17 @@ void BattleGroundAB::FillInitialWorldStates(WorldPacket& data, uint32& count) // Node occupied states for (uint8 node = 0; node < BG_AB_NODES_MAX; ++node) + { for (uint8 i = 1; i < BG_AB_NODES_MAX; ++i) { FillInitialWorldState(data, count, BG_AB_OP_NODESTATES[node] + plusArray[i], m_Nodes[node] == i); } + } // How many bases each team owns uint8 ally = 0, horde = 0; for (uint8 node = 0; node < BG_AB_NODES_MAX; ++node) + { if (m_Nodes[node] == BG_AB_NODE_STATUS_ALLY_OCCUPIED) { ++ally; @@ -395,6 +400,7 @@ void BattleGroundAB::FillInitialWorldStates(WorldPacket& data, uint32& count) { ++horde; } + } FillInitialWorldState(data, count, BG_AB_OP_OCCUPIED_BASES_ALLY, ally); FillInitialWorldState(data, count, BG_AB_OP_OCCUPIED_BASES_HORDE, horde); @@ -432,6 +438,7 @@ void BattleGroundAB::_SendNodeUpdate(uint8 node) // How many bases each team owns uint8 ally = 0, horde = 0; for (uint8 i = 0; i < BG_AB_NODES_MAX; ++i) + { if (m_Nodes[i] == BG_AB_NODE_STATUS_ALLY_OCCUPIED) { ++ally; @@ -440,6 +447,7 @@ void BattleGroundAB::_SendNodeUpdate(uint8 node) { ++horde; } + } UpdateWorldState(BG_AB_OP_OCCUPIED_BASES_ALLY, ally); UpdateWorldState(BG_AB_OP_OCCUPIED_BASES_HORDE, horde); @@ -692,10 +700,12 @@ WorldSafeLocsEntry const* BattleGroundAB::GetClosestGraveYard(Player* player) // Is there any occupied node for this team? std::vector nodes; for (uint8 i = 0; i < BG_AB_NODES_MAX; ++i) + { if (m_Nodes[i] == teamIndex + 3) { nodes.push_back(i); } + } WorldSafeLocsEntry const* good_entry = NULL; // If so, select the closest node to place ghost on @@ -765,9 +775,11 @@ void BattleGroundAB::UpdatePlayerScore(Player* source, uint32 type, uint32 value bool BattleGroundAB::IsAllNodesControlledByTeam(Team team) const { for (uint8 i = 0; i < BG_AB_NODES_MAX; ++i) + { if ((team == ALLIANCE && m_Nodes[i] != BG_AB_NODE_STATUS_ALLY_OCCUPIED) || (team == HORDE && m_Nodes[i] != BG_AB_NODE_STATUS_HORDE_OCCUPIED)) return false; + } return true; } diff --git a/src/game/BattleGround/BattleGroundAV.cpp b/src/game/BattleGround/BattleGroundAV.cpp index fcbdc0263..6e0786008 100644 --- a/src/game/BattleGround/BattleGroundAV.cpp +++ b/src/game/BattleGround/BattleGroundAV.cpp @@ -193,10 +193,12 @@ void BattleGroundAV::HandleQuestComplete(uint32 questid, Player* player) { DEBUG_LOG("BattleGroundAV: Quest %i completed starting with unit upgrading..", questid); for (BG_AV_Nodes i = BG_AV_NODES_FIRSTAID_STATION; i <= BG_AV_NODES_FROSTWOLF_HUT; ++i) + { if (m_Nodes[i].Owner == teamIdx && m_Nodes[i].State == POINT_CONTROLLED) { PopulateNode(i); } + } } break; case BG_AV_QUEST_A_COMMANDER1: @@ -450,30 +452,38 @@ void BattleGroundAV::EndBattleGround(Team winner) uint32 mines_owned[PVP_TEAM_COUNT] = {0, 0}; // towers all not destroyed: for (BG_AV_Nodes i = BG_AV_NODES_DUNBALDAR_SOUTH; i <= BG_AV_NODES_STONEHEART_BUNKER; ++i) + { if (m_Nodes[i].State == POINT_CONTROLLED) if (m_Nodes[i].TotalOwner == BG_AV_TEAM_ALLIANCE) { ++tower_survived[TEAM_INDEX_ALLIANCE]; } + } for (BG_AV_Nodes i = BG_AV_NODES_ICEBLOOD_TOWER; i <= BG_AV_NODES_FROSTWOLF_WTOWER; ++i) + { if (m_Nodes[i].State == POINT_CONTROLLED) if (m_Nodes[i].TotalOwner == BG_AV_TEAM_HORDE) { ++tower_survived[TEAM_INDEX_HORDE]; } + } // graves all controlled for (BG_AV_Nodes i = BG_AV_NODES_FIRSTAID_STATION; i < BG_AV_NODES_MAX; ++i) + { if (m_Nodes[i].State == POINT_CONTROLLED && m_Nodes[i].Owner != BG_AV_TEAM_NEUTRAL) { ++graves_owned[m_Nodes[i].Owner]; } + } for (uint8 i = 0; i < BG_AV_MAX_MINES; ++i) + { if (m_Mine_Owner[i] != BG_AV_TEAM_NEUTRAL) { ++mines_owned[m_Mine_Owner[i]]; } + } // now we have the values give the honor/reputation to the teams: Team team[PVP_TEAM_COUNT] = { ALLIANCE, HORDE }; diff --git a/src/game/BattleGround/BattleGroundEY.cpp b/src/game/BattleGround/BattleGroundEY.cpp index 16be331d0..0f9e9c218 100644 --- a/src/game/BattleGround/BattleGroundEY.cpp +++ b/src/game/BattleGround/BattleGroundEY.cpp @@ -663,10 +663,12 @@ WorldSafeLocsEntry const* BattleGroundEY::GetClosestGraveYard(Player* player) bool BattleGroundEY::IsAllNodesControlledByTeam(Team team) const { for (uint8 i = 0; i < EY_NODES_MAX; ++i) + { if (m_towerOwner[i] != team) { return false; } + } return true; } diff --git a/src/game/BattleGround/BattleGroundMgr.cpp b/src/game/BattleGround/BattleGroundMgr.cpp index 01080601a..27d96caca 100644 --- a/src/game/BattleGround/BattleGroundMgr.cpp +++ b/src/game/BattleGround/BattleGroundMgr.cpp @@ -311,15 +311,19 @@ GroupQueueInfo* BattleGroundQueue::AddGroup(Player* leader, Group* grp, BattleGr uint32 q_max_level = bracketEntry->maxLevel; GroupsQueueType::const_iterator itr; for (itr = m_QueuedGroups[bracketId][BG_QUEUE_NORMAL_ALLIANCE].begin(); itr != m_QueuedGroups[bracketId][BG_QUEUE_NORMAL_ALLIANCE].end(); ++itr) + { if (!(*itr)->IsInvitedToBGInstanceGUID) { qAlliance += (*itr)->Players.size(); } + } for (itr = m_QueuedGroups[bracketId][BG_QUEUE_NORMAL_HORDE].begin(); itr != m_QueuedGroups[bracketId][BG_QUEUE_NORMAL_HORDE].end(); ++itr) + { if (!(*itr)->IsInvitedToBGInstanceGUID) { qHorde += (*itr)->Players.size(); } + } // Show queue status to player only (when joining queue) if (sWorld.getConfig(CONFIG_UINT32_BATTLEGROUND_QUEUE_ANNOUNCER_JOIN) == 1) @@ -809,15 +813,19 @@ bool BattleGroundQueue::CheckPremadeMatch(BattleGroundBracketId bracket_id, uint // if groups aren't invited GroupsQueueType::const_iterator ali_group, horde_group; for (ali_group = m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].begin(); ali_group != m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].end(); ++ali_group) + { if (!(*ali_group)->IsInvitedToBGInstanceGUID) { break; } + } for (horde_group = m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].begin(); horde_group != m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].end(); ++horde_group) + { if (!(*horde_group)->IsInvitedToBGInstanceGUID) { break; } + } if (ali_group != m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].end() && horde_group != m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].end()) { @@ -1125,10 +1133,12 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BattleGroundBracketI } // invite those selection pools for (uint8 i = 0; i < PVP_TEAM_COUNT; ++i) + { for (GroupsQueueType::const_iterator citr = m_SelectionPools[TEAM_INDEX_ALLIANCE + i].SelectedGroups.begin(); citr != m_SelectionPools[TEAM_INDEX_ALLIANCE + i].SelectedGroups.end(); ++citr) { InviteGroupToBG((*citr), bg2, (*citr)->GroupTeam); } + } // start bg bg2->StartBattleGround(); // clear structures @@ -1154,10 +1164,12 @@ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BattleGroundBracketI // invite those selection pools for (uint8 i = 0; i < PVP_TEAM_COUNT; ++i) + { for (GroupsQueueType::const_iterator citr = m_SelectionPools[TEAM_INDEX_ALLIANCE + i].SelectedGroups.begin(); citr != m_SelectionPools[TEAM_INDEX_ALLIANCE + i].SelectedGroups.end(); ++citr) { InviteGroupToBG((*citr), bg2, (*citr)->GroupTeam); } + } // start bg bg2->StartBattleGround(); } diff --git a/src/game/ChatCommands/AHBotCommands.cpp b/src/game/ChatCommands/AHBotCommands.cpp index fbd3357f1..35b0ccdec 100644 --- a/src/game/ChatCommands/AHBotCommands.cpp +++ b/src/game/ChatCommands/AHBotCommands.cpp @@ -156,11 +156,13 @@ bool ChatHandler::HandleAHBotStatusCommand(char* args) } for (int i = 0; i < MAX_AUCTION_QUALITY; ++i) + { PSendSysMessage(fmtId, GetMangosString(ahbotQualityIds[i]), statusInfo[AUCTION_HOUSE_ALLIANCE].QualityInfo[i], statusInfo[AUCTION_HOUSE_HORDE].QualityInfo[i], statusInfo[AUCTION_HOUSE_NEUTRAL].QualityInfo[i], sAuctionBotConfig.getConfigItemQualityAmount(AuctionQuality(i))); + } } if (!m_session) @@ -181,10 +183,12 @@ bool ChatHandler::HandleAHBotItemsAmountCommand(char* args) { uint32 qVals[MAX_AUCTION_QUALITY]; for (int i = 0; i < MAX_AUCTION_QUALITY; ++i) + { if (!ExtractUInt32(&args, qVals[i])) { return false; } + } sAuctionBot.SetItemsAmount(qVals); @@ -242,10 +246,12 @@ bool ChatHandler::HandleAHBotItemsRatioCommand(char* args) { uint32 rVal[MAX_AUCTION_HOUSE_TYPE]; for (int i = 0; i < MAX_AUCTION_HOUSE_TYPE; ++i) + { if (!ExtractUInt32(&args, rVal[i])) { return false; } + } sAuctionBot.SetItemsRatio(rVal[0], rVal[1], rVal[2]); diff --git a/src/game/ChatCommands/GameObjectCommands.cpp b/src/game/ChatCommands/GameObjectCommands.cpp index 8dc80fe8c..f0eb44f17 100644 --- a/src/game/ChatCommands/GameObjectCommands.cpp +++ b/src/game/ChatCommands/GameObjectCommands.cpp @@ -75,10 +75,12 @@ void ChatHandler::ShowAchievementListHelper(AchievementEntry const* achEntry, Lo if (AchievementMgr const* mgr = target ? &target->GetAchievementMgr() : NULL) if (AchievementCriteriaEntryList const* criteriaList = sAchievementMgr.GetAchievementCriteriaByAchievement(achEntry->ID)) for (AchievementCriteriaEntryList::const_iterator itr = criteriaList->begin(); itr != criteriaList->end(); ++itr) + { if (mgr->IsCompletedCriteria(*itr, achEntry)) { criteriaMask[((*itr)->showOrder - 1) / 32] |= (1 << (((*itr)->showOrder - 1) % 32)); } + } for (int i = 0; i < 4; ++i) { diff --git a/src/game/ChatCommands/PoolCommands.cpp b/src/game/ChatCommands/PoolCommands.cpp index 854011fbc..06bbd9568 100644 --- a/src/game/ChatCommands/PoolCommands.cpp +++ b/src/game/ChatCommands/PoolCommands.cpp @@ -117,19 +117,23 @@ bool ChatHandler::HandlePoolSpawnsCommand(char* args) SpawnedPoolObjects const& crSpawns = spawns.GetSpawnedCreatures(); for (SpawnedPoolObjects::const_iterator itr = crSpawns.begin(); itr != crSpawns.end(); ++itr) + { if (!pool_id || pool_id == sPoolMgr.IsPartOfAPool(*itr)) if (CreatureData const* data = sObjectMgr.GetCreatureData(*itr)) if (CreatureInfo const* info = ObjectMgr::GetCreatureTemplate(data->id)) PSendSysMessage(LANG_CREATURE_LIST_CHAT, *itr, PrepareStringNpcOrGoSpawnInformation(*itr).c_str(), *itr, info->Name, data->posX, data->posY, data->posZ, data->mapid); + } SpawnedPoolObjects const& goSpawns = spawns.GetSpawnedGameobjects(); for (SpawnedPoolObjects::const_iterator itr = goSpawns.begin(); itr != goSpawns.end(); ++itr) + { if (!pool_id || pool_id == sPoolMgr.IsPartOfAPool(*itr)) if (GameObjectData const* data = sObjectMgr.GetGOData(*itr)) if (GameObjectInfo const* info = ObjectMgr::GetGameObjectInfo(data->id)) PSendSysMessage(LANG_GO_LIST_CHAT, *itr, PrepareStringNpcOrGoSpawnInformation(*itr).c_str(), *itr, info->name, data->posX, data->posY, data->posZ, data->mapid); + } return true; } diff --git a/src/game/ChatCommands/ServerCommands.cpp b/src/game/ChatCommands/ServerCommands.cpp index 05361404e..dc19074f2 100644 --- a/src/game/ChatCommands/ServerCommands.cpp +++ b/src/game/ChatCommands/ServerCommands.cpp @@ -268,10 +268,12 @@ bool ChatHandler::HandleServerLogFilterCommand(char* args) { SendSysMessage(LANG_LOG_FILTERS_STATE_HEADER); for (int i = 0; i < LOG_FILTER_COUNT; ++i) + { if (*logFilterData[i].name) { PSendSysMessage(" %-20s = %s", logFilterData[i].name, GetOnOffStr(sLog.HasLogFilter(1 << i))); } + } return true; } diff --git a/src/game/Object/ArenaTeam.cpp b/src/game/Object/ArenaTeam.cpp index c5e1568ba..e699cb9aa 100644 --- a/src/game/Object/ArenaTeam.cpp +++ b/src/game/Object/ArenaTeam.cpp @@ -607,10 +607,12 @@ uint8 ArenaTeam::GetSlotByType(ArenaType type) bool ArenaTeam::HaveMember(ObjectGuid guid) const { for (MemberList::const_iterator itr = m_members.begin(); itr != m_members.end(); ++itr) + { if (itr->guid == guid) { return true; } + } return false; } diff --git a/src/game/Object/ArenaTeam.h b/src/game/Object/ArenaTeam.h index c513a4c4e..88197249a 100644 --- a/src/game/Object/ArenaTeam.h +++ b/src/game/Object/ArenaTeam.h @@ -162,10 +162,12 @@ class ArenaTeam ArenaTeamMember* GetMember(ObjectGuid guid) { for (MemberList::iterator itr = m_members.begin(); itr != m_members.end(); ++itr) + { if (itr->guid == guid) { return &(*itr); } + } return NULL; } @@ -173,10 +175,12 @@ class ArenaTeam ArenaTeamMember* GetMember(const std::string& name) { for (MemberList::iterator itr = m_members.begin(); itr != m_members.end(); ++itr) + { if (itr->name == name) { return &(*itr); } + } return NULL; } diff --git a/src/game/Object/Bag.cpp b/src/game/Object/Bag.cpp index d365378a0..edaf2e44c 100644 --- a/src/game/Object/Bag.cpp +++ b/src/game/Object/Bag.cpp @@ -60,10 +60,12 @@ void Bag::AddToWorld() Item::AddToWorld(); for (uint32 i = 0; i < GetBagSize(); ++i) + { if (m_bagslot[i]) { m_bagslot[i]->AddToWorld(); } + } } /** @@ -72,10 +74,12 @@ void Bag::AddToWorld() void Bag::RemoveFromWorld() { for (uint32 i = 0; i < GetBagSize(); ++i) + { if (m_bagslot[i]) { m_bagslot[i]->RemoveFromWorld(); } + } Item::RemoveFromWorld(); } @@ -167,10 +171,12 @@ bool Bag::LoadFromDB(uint32 guidLow, Field* fields, ObjectGuid ownerGuid) void Bag::DeleteFromDB() { for (int i = 0; i < MAX_BAG_SIZE; ++i) + { if (m_bagslot[i]) { m_bagslot[i]->DeleteFromDB(); } + } Item::DeleteFromDB(); } @@ -184,10 +190,12 @@ uint32 Bag::GetFreeSlots() const { uint32 slots = 0; for (uint32 i = 0; i < GetBagSize(); ++i) + { if (!m_bagslot[i]) { ++slots; } + } return slots; } @@ -242,10 +250,12 @@ void Bag::BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) cons Item::BuildCreateUpdateBlockForPlayer(data, target); for (uint32 i = 0; i < GetBagSize(); ++i) + { if (m_bagslot[i]) { m_bagslot[i]->BuildCreateUpdateBlockForPlayer(data, target); } + } } /** @@ -256,10 +266,12 @@ void Bag::BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) cons bool Bag::IsEmpty() const { for (uint32 i = 0; i < GetBagSize(); ++i) + { if (m_bagslot[i]) { return false; } + } return true; } @@ -273,10 +285,12 @@ bool Bag::IsEmpty() const Item* Bag::GetItemByEntry(uint32 item) const { for (uint32 i = 0; i < GetBagSize(); ++i) + { if (m_bagslot[i] && m_bagslot[i]->GetEntry() == item) { return m_bagslot[i]; } + } return NULL; } @@ -284,10 +298,12 @@ Item* Bag::GetItemByEntry(uint32 item) const Item* Bag::GetItemByLimitedCategory(uint32 limitedCategory) const { for (uint32 i = 0; i < GetBagSize(); ++i) + { if (m_bagslot[i] && m_bagslot[i]->GetProto()->ItemLimitCategory == limitedCategory) { return m_bagslot[i]; } + } return NULL; } @@ -304,19 +320,23 @@ uint32 Bag::GetItemCount(uint32 item, Item* eItem) const uint32 count = 0; for (uint32 i = 0; i < GetBagSize(); ++i) + { if (m_bagslot[i]) if (m_bagslot[i] != eItem && m_bagslot[i]->GetEntry() == item) { count += m_bagslot[i]->GetCount(); } + } if (eItem && eItem->GetProto()->GemProperties) for (uint32 i = 0; i < GetBagSize(); ++i) + { if (m_bagslot[i]) if (m_bagslot[i] != eItem && m_bagslot[i]->GetProto()->Socket[0].Color) { count += m_bagslot[i]->GetGemCountWithID(item); } + } return count; } @@ -326,11 +346,13 @@ uint32 Bag::GetItemCountWithLimitCategory(uint32 limitCategory, Item* eItem) con uint32 count = 0; for (uint32 i = 0; i < GetBagSize(); ++i) + { if (m_bagslot[i]) if (m_bagslot[i] != eItem && m_bagslot[i]->GetProto()->ItemLimitCategory == limitCategory) { count += m_bagslot[i]->GetCount(); } + } return count; } @@ -344,11 +366,13 @@ uint32 Bag::GetItemCountWithLimitCategory(uint32 limitCategory, Item* eItem) con uint8 Bag::GetSlotByItemGUID(ObjectGuid guid) const { for (uint32 i = 0; i < GetBagSize(); ++i) + { if (m_bagslot[i] != 0) if (m_bagslot[i]->GetObjectGuid() == guid) { return i; } + } return NULL_SLOT; } diff --git a/src/game/Object/Calendar.cpp b/src/game/Object/Calendar.cpp index 5ff12d91a..49cfc4a70 100644 --- a/src/game/Object/Calendar.cpp +++ b/src/game/Object/Calendar.cpp @@ -733,10 +733,12 @@ bool CalendarMgr::CanAddEvent(ObjectGuid const& guid) uint32 totalEvents = 0; // count all event created by guid for (CalendarEventStore::iterator itr = m_EventStore.begin(); itr != m_EventStore.end(); ++itr) + { if ((itr->second.CreatorGuid == guid) && (++totalEvents >= CALENDAR_MAX_EVENTS)) { return false; } + } return true; } @@ -751,10 +753,12 @@ bool CalendarMgr::CanAddGuildEvent(uint32 guildId) uint32 totalEvents = 0; // count all guild events in a guild for (CalendarEventStore::iterator itr = m_EventStore.begin(); itr != m_EventStore.end(); ++itr) + { if ((itr->second.GuildId == guildId) && (++totalEvents >= CALENDAR_MAX_GUILD_EVENTS)) { return false; } + } return true; } diff --git a/src/game/Object/Creature.cpp b/src/game/Object/Creature.cpp index 420fdea9b..358b3269f 100644 --- a/src/game/Object/Creature.cpp +++ b/src/game/Object/Creature.cpp @@ -1420,10 +1420,12 @@ Player* Creature::GetLootRecipient() const // find any in group for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) + { if (Player* p = itr->getSource()) { return p; } + } return NULL; } @@ -3003,11 +3005,13 @@ Unit* Creature::SelectAttackingTarget(AttackingTarget target, uint32 position, S suitableUnits.reserve(threatlist.size() - position); advance(itr, position); for (; itr != threatlist.end(); ++itr) + { if (Unit* pTarget = GetMap()->GetUnit((*itr)->getUnitGuid())) if (!selectFlags || MeetsSelectAttackingRequirement(pTarget, pSpellInfo, selectFlags)) { suitableUnits.push_back(pTarget); } + } if (!suitableUnits.empty()) { @@ -3020,11 +3024,13 @@ Unit* Creature::SelectAttackingTarget(AttackingTarget target, uint32 position, S { advance(itr, position); for (; itr != threatlist.end(); ++itr) + { if (Unit* pTarget = GetMap()->GetUnit((*itr)->getUnitGuid())) if (!selectFlags || MeetsSelectAttackingRequirement(pTarget, pSpellInfo, selectFlags)) { return pTarget; } + } break; } @@ -3032,11 +3038,13 @@ Unit* Creature::SelectAttackingTarget(AttackingTarget target, uint32 position, S { advance(ritr, position); for (; ritr != threatlist.rend(); ++ritr) + { if (Unit* pTarget = GetMap()->GetUnit((*itr)->getUnitGuid())) if (!selectFlags || MeetsSelectAttackingRequirement(pTarget, pSpellInfo, selectFlags)) { return pTarget; } + } break; } @@ -3207,10 +3215,12 @@ bool Creature::HasSpell(uint32 spellID) const { uint8 i; for (i = 0; i < CREATURE_MAX_SPELLS; ++i) + { if (spellID == m_spells[i]) { break; } + } return i < CREATURE_MAX_SPELLS; // break before end of iteration of known spells } @@ -3431,10 +3441,12 @@ uint32 Creature::GetVendorItemCurrentCount(VendorItem const* vItem) VendorItemCounts::iterator itr = m_vendorItemCounts.begin(); for (; itr != m_vendorItemCounts.end(); ++itr) + { if (itr->itemId == vItem->item) { break; } + } if (itr == m_vendorItemCounts.end()) { @@ -3479,10 +3491,12 @@ uint32 Creature::UpdateVendorItemCurrentCount(VendorItem const* vItem, uint32 us VendorItemCounts::iterator itr = m_vendorItemCounts.begin(); for (; itr != m_vendorItemCounts.end(); ++itr) + { if (itr->itemId == vItem->item) { break; } + } if (itr == m_vendorItemCounts.end()) { diff --git a/src/game/Object/CreatureEventAI.cpp b/src/game/Object/CreatureEventAI.cpp index ed8f13f7d..0a2e0fd1d 100644 --- a/src/game/Object/CreatureEventAI.cpp +++ b/src/game/Object/CreatureEventAI.cpp @@ -605,10 +605,12 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction // amount of real actions uint32 count = 0; for (uint32 j = 0; j < MAX_ACTIONS; ++j) + { if (pHolder.Event.action[j].type != ACTION_T_NONE) { ++count; } + } if (count) { @@ -887,10 +889,12 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 { ThreatList const& threatList = m_creature->GetThreatManager().getThreatList(); for (ThreatList::const_iterator i = threatList.begin(); i != threatList.end(); ++i) + { if (Unit* Temp = m_creature->GetMap()->GetUnit((*i)->getUnitGuid())) { m_creature->GetThreatManager().modifyThreatPercent(Temp, action.threat_all_pct.percent); } + } break; } case ACTION_T_QUEST_EVENT: //15 @@ -1022,10 +1026,12 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32 { ThreatList const& threatList = m_creature->GetThreatManager().getThreatList(); for (ThreatList::const_iterator i = threatList.begin(); i != threatList.end(); ++i) + { if (Player* temp = m_creature->GetMap()->GetPlayer((*i)->getUnitGuid())) { temp->CastedCreatureOrGO(action.cast_event_all.creatureId, m_creature->GetObjectGuid(), action.cast_event_all.spellId); } + } break; } case ACTION_T_REMOVEAURASFROMSPELL: //28 diff --git a/src/game/Object/CreatureEventAIMgr.cpp b/src/game/Object/CreatureEventAIMgr.cpp index f54305e80..b792a3c17 100644 --- a/src/game/Object/CreatureEventAIMgr.cpp +++ b/src/game/Object/CreatureEventAIMgr.cpp @@ -68,10 +68,12 @@ void CreatureEventAIMgr::CheckUnusedAITexts() std::set idx_set; for (int32 i = MAX_CREATURE_AI_TEXT_STRING_ID + 1; i <= MIN_CREATURE_AI_TEXT_STRING_ID; ++i) + { if (sObjectMgr.GetMangosStringLocale(i)) { idx_set.insert(i); } + } for (CreatureEventAI_Event_Map::const_iterator itr = m_CreatureEventAI_Event_Map.begin(); itr != m_CreatureEventAI_Event_Map.end(); ++itr) { @@ -90,10 +92,12 @@ void CreatureEventAIMgr::CheckUnusedAITexts() // ACTION_T_CHANCED_TEXT contains a chance value in first param int k = action.type == ACTION_T_TEXT ? 0 : 1; for (; k < 3; ++k) + { if (action.text.TextId[k]) { idx_set.erase(action.text.TextId[k]); } + } break; } default: break; diff --git a/src/game/Object/GameObject.cpp b/src/game/Object/GameObject.cpp index 75e4da59d..0ec33f741 100644 --- a/src/game/Object/GameObject.cpp +++ b/src/game/Object/GameObject.cpp @@ -2620,10 +2620,12 @@ Player* GameObject::GetLootRecipient() const // find any in group for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) + { if (Player* newPlayer = itr->getSource()) { return newPlayer; } + } return NULL; } diff --git a/src/game/Object/Guild.cpp b/src/game/Object/Guild.cpp index daae26125..2ca01a147 100644 --- a/src/game/Object/Guild.cpp +++ b/src/game/Object/Guild.cpp @@ -1857,11 +1857,13 @@ void Guild::SetBankRightsAndSlots(uint32 rankId, uint8 TabId, uint32 right, uint if (db) { for (MemberList::iterator itr = members.begin(); itr != members.end(); ++itr) + { if (itr->second.RankId == rankId) for (int i = 0; i < GUILD_BANK_MAX_TABS; ++i) { itr->second.BankResetTimeTab[i] = 0; } + } CharacterDatabase.PExecute("DELETE FROM `guild_bank_right` WHERE `guildid`='%u' AND `TabId`='%u' AND `rid`='%u'", m_Id, uint32(TabId), rankId); CharacterDatabase.PExecute("INSERT INTO `guild_bank_right` (`guildid`,`TabId`,`rid`,`gbright`,`SlotPerDay`) VALUES " @@ -3069,10 +3071,12 @@ void Guild::DeleteGuildBankItems(bool alsoInDB /*= false*/) bool GuildItemPosCount::isContainedIn(GuildItemPosCountVec const& vec) const { for (GuildItemPosCountVec::const_iterator itr = vec.begin(); itr != vec.end(); ++itr) + { if (itr->Slot == this->Slot) { return true; } + } return false; } diff --git a/src/game/Object/Guild.h b/src/game/Object/Guild.h index 87f921be9..94238a05b 100644 --- a/src/game/Object/Guild.h +++ b/src/game/Object/Guild.h @@ -364,11 +364,13 @@ class Guild void BroadcastWorker(Do& _do, Player* except = NULL) { for (MemberList::iterator itr = members.begin(); itr != members.end(); ++itr) + { if (Player* player = sObjectAccessor.FindPlayer(ObjectGuid(HIGHGUID_PLAYER, itr->first))) if (player != except) { _do(player); } + } } void CreateRank(std::string name, uint32 rights); @@ -399,10 +401,12 @@ class Guild MemberSlot* GetMemberSlot(const std::string& name) { for (MemberList::iterator itr = members.begin(); itr != members.end(); ++itr) + { if (itr->second.Name == name) { return &itr->second; } + } return NULL; } diff --git a/src/game/Object/Item.cpp b/src/game/Object/Item.cpp index 45c365937..ee8107a92 100644 --- a/src/game/Object/Item.cpp +++ b/src/game/Object/Item.cpp @@ -76,10 +76,12 @@ void AddItemsSetItem(Player* player, Item* item) size_t x = 0; for (; x < player->ItemSetEff.size(); ++x) + { if (!player->ItemSetEff[x]) { break; } + } if (x < player->ItemSetEff.size()) { @@ -107,10 +109,12 @@ void AddItemsSetItem(Player* player, Item* item) uint32 z = 0; for (; z < 8; ++z) + { if (eff->spells[z] && eff->spells[z]->Id == set->spells[x]) { break; } + } if (z < 8) { @@ -1240,10 +1244,12 @@ bool Item::IsTargetValidForItemUse(Unit* pUnitTarget) } for (ItemRequiredTargetMap::const_iterator itr = bounds.first; itr != bounds.second; ++itr) + { if (itr->second.IsFitToRequirements(pUnitTarget)) { return true; } + } return false; } @@ -1670,10 +1676,12 @@ bool Item::HasMaxCharges() const ItemPrototype const* itemProto = GetProto(); for (int i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i) + { if (GetSpellCharges(i) != itemProto->Spells[i].SpellCharges) { return false; } + } return true; } diff --git a/src/game/Object/LootMgr.cpp b/src/game/Object/LootMgr.cpp index aefae4a18..66caf7f9e 100644 --- a/src/game/Object/LootMgr.cpp +++ b/src/game/Object/LootMgr.cpp @@ -593,10 +593,12 @@ bool Loot::FillLoot(uint32 loot_id, LootStore const& store, Player* loot_owner, if (!personal && pGroup) { for (GroupReference* itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) + { if (Player* pl = itr->getSource()) { FillNotNormalLootFor(pl); } + } } // ... for personal loot else @@ -821,10 +823,12 @@ void Loot::NotifyQuestItemRemoved(uint8 questIndex) uint8 j; for (j = 0; j < pql.size(); ++j) + { if (pql[j].index == questIndex) { break; } + } if (j < pql.size()) { @@ -903,6 +907,7 @@ LootItem* Loot::LootItemInSlot(uint32 lootSlot, Player* player, QuestItem** qite if (itr != m_playerFFAItems.end()) { for (QuestItemList::const_iterator iter = itr->second->begin(); iter != itr->second->end(); ++iter) + { if (iter->index == lootSlot) { QuestItem* ffaitem2 = (QuestItem*) & (*iter); @@ -913,6 +918,7 @@ LootItem* Loot::LootItemInSlot(uint32 lootSlot, Player* player, QuestItem** qite is_looted = ffaitem2->is_looted; break; } + } } } else if (item->conditionId) @@ -1150,15 +1156,19 @@ LootStoreItem const* LootTemplate::LootGroup::Roll() const bool LootTemplate::LootGroup::HasQuestDrop() const { for (LootStoreItemList::const_iterator i = ExplicitlyChanced.begin(); i != ExplicitlyChanced.end(); ++i) + { if (i->needs_quest) { return true; } + } for (LootStoreItemList::const_iterator i = EqualChanced.begin(); i != EqualChanced.end(); ++i) + { if (i->needs_quest) { return true; } + } return false; } @@ -1172,15 +1182,19 @@ bool LootTemplate::LootGroup::HasQuestDrop() const bool LootTemplate::LootGroup::HasQuestDropForPlayer(Player const* player) const { for (LootStoreItemList::const_iterator i = ExplicitlyChanced.begin(); i != ExplicitlyChanced.end(); ++i) + { if (player->HasQuestForItem(i->itemid)) { return true; } + } for (LootStoreItemList::const_iterator i = EqualChanced.begin(); i != EqualChanced.end(); ++i) + { if (player->HasQuestForItem(i->itemid)) { return true; } + } return false; } @@ -1210,10 +1224,12 @@ float LootTemplate::LootGroup::RawTotalChance() const float result = 0; for (LootStoreItemList::const_iterator i = ExplicitlyChanced.begin(); i != ExplicitlyChanced.end(); ++i) + { if (!i->needs_quest) { result += i->chance; } + } return result; } @@ -1425,10 +1441,12 @@ bool LootTemplate::HasQuestDrop(LootTemplateMap const& store, uint8 groupId) con // Now processing groups for (LootGroups::const_iterator i = Groups.begin() ; i != Groups.end() ; ++i) + { if (i->HasQuestDrop()) { return true; } + } return false; } @@ -1476,10 +1494,12 @@ bool LootTemplate::HasQuestDropForPlayer(LootTemplateMap const& store, Player co // Now checking groups for (LootGroups::const_iterator i = Groups.begin(); i != Groups.end(); ++i) + { if (i->HasQuestDropForPlayer(player)) { return true; } + } return false; } @@ -1802,11 +1822,13 @@ void LoadLootTemplates_Mail() // remove real entries and check existence loot for (uint32 i = 1; i < sMailTemplateStore.GetNumRows(); ++i) + { if (sMailTemplateStore.LookupEntry(i)) if (ids_set.find(i) != ids_set.end()) { ids_set.erase(i); } + } // output error for any still listed (not referenced from appropriate table) ids LootTemplates_Mail.ReportUnusedIds(ids_set); diff --git a/src/game/Object/Object.cpp b/src/game/Object/Object.cpp index 3b94254a6..3dfc6bbe8 100644 --- a/src/game/Object/Object.cpp +++ b/src/game/Object/Object.cpp @@ -900,10 +900,12 @@ bool Object::LoadValues(const char* data) void Object::_SetUpdateBits(UpdateMask* updateMask, Player* /*target*/) const { for (uint16 index = 0; index < m_valuesCount; ++index) + { if (m_changedValues[index]) { updateMask->SetBit(index); } + } } /** @@ -917,10 +919,12 @@ void Object::_SetUpdateBits(UpdateMask* updateMask, Player* /*target*/) const void Object::_SetCreateBits(UpdateMask* updateMask, Player* /*target*/) const { for (uint16 index = 0; index < m_valuesCount; ++index) + { if (GetUInt32Value(index) != 0) { updateMask->SetBit(index); } + } } /** @@ -2463,10 +2467,12 @@ void WorldObject::MonsterText(MangosStringLocale const* textData, Unit const* ta uint32 zoneid = GetZoneId(); Map::PlayerList const& pList = GetMap()->GetPlayers(); for (Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr) + { if (itr->getSource()->GetZoneId() == zoneid) { say_do(itr->getSource()); } + } break; } } diff --git a/src/game/Object/ObjectMgr.cpp b/src/game/Object/ObjectMgr.cpp index 45e76a4ae..b5b538d0e 100644 --- a/src/game/Object/ObjectMgr.cpp +++ b/src/game/Object/ObjectMgr.cpp @@ -302,10 +302,12 @@ ArenaTeam* ObjectMgr::GetArenaTeamById(uint32 arenateamid) const ArenaTeam* ObjectMgr::GetArenaTeamByName(const std::string& arenateamname) const { for (ArenaTeamMap::const_iterator itr = mArenaTeamMap.begin(); itr != mArenaTeamMap.end(); ++itr) + { if (itr->second->GetName() == arenateamname) { return itr->second; } + } return NULL; } @@ -313,10 +315,12 @@ ArenaTeam* ObjectMgr::GetArenaTeamByName(const std::string& arenateamname) const ArenaTeam* ObjectMgr::GetArenaTeamByCaptain(ObjectGuid guid) const { for (ArenaTeamMap::const_iterator itr = mArenaTeamMap.begin(); itr != mArenaTeamMap.end(); ++itr) + { if (itr->second->GetCaptainGuid() == guid) { return itr->second; } + } return NULL; } @@ -1603,22 +1607,30 @@ void ObjectMgr::LoadCreatures() // build single time for check creature data std::set difficultyCreatures[MAX_DIFFICULTY - 1]; for (uint32 i = 0; i < sCreatureStorage.GetMaxEntry(); ++i) + { if (CreatureInfo const* cInfo = sCreatureStorage.LookupEntry(i)) for (uint32 diff = 0; diff < MAX_DIFFICULTY - 1; ++diff) + { if (cInfo->DifficultyEntry[diff]) { difficultyCreatures[diff].insert(cInfo->DifficultyEntry[diff]); } + } + } // build single time for check spawnmask std::map spawnMasks; for (uint32 i = 0; i < sMapStore.GetNumRows(); ++i) + { if (sMapStore.LookupEntry(i)) for (int k = 0; k < MAX_DIFFICULTY; ++k) + { if (GetMapDifficultyData(i, Difficulty(k))) { spawnMasks[i] |= (1 << k); } + } + } BarGoLink bar(result->GetRowCount()); @@ -1859,12 +1871,16 @@ void ObjectMgr::LoadGameObjects() // build single time for check spawnmask std::map spawnMasks; for (uint32 i = 0; i < sMapStore.GetNumRows(); ++i) + { if (sMapStore.LookupEntry(i)) for (int k = 0; k < MAX_DIFFICULTY; ++k) + { if (GetMapDifficultyData(i, Difficulty(k))) { spawnMasks[i] |= (1 << k); } + } + } BarGoLink bar(result->GetRowCount()); @@ -8595,10 +8611,12 @@ int ObjectMgr::GetIndexForLocale(LocaleConstant loc) } for (size_t i = 0; i < m_LocalForIndex.size(); ++i) + { if (m_LocalForIndex[i] == loc) { return i; } + } return -1; } @@ -8633,10 +8651,12 @@ int ObjectMgr::GetOrNewIndexForLocale(LocaleConstant loc) } for (size_t i = 0; i < m_LocalForIndex.size(); ++i) + { if (m_LocalForIndex[i] == loc) { return i; } + } m_LocalForIndex.push_back(loc); return m_LocalForIndex.size() - 1; @@ -9124,10 +9144,12 @@ bool PlayerCondition::Meets(Player const* player, Map const* map, WorldObject co { Unit::SpellAuraHolderMap const& auras = player->GetSpellAuraHolderMap(); for (Unit::SpellAuraHolderMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr) + { if ((itr->second->GetSpellProto()->HasAttribute(SPELL_ATTR_CASTABLE_WHILE_MOUNTED) || itr->second->GetSpellProto()->HasAttribute(SPELL_ATTR_ABILITY)) && itr->second->GetSpellProto()->SpellVisual[0] == 3580) { return true; } + } return false; } case CONDITION_NO_AURA: @@ -10118,6 +10140,7 @@ GameTele const* ObjectMgr::GetGameTele(const std::string& name) const // Alternative first GameTele what contains wnameLow as substring in case no GameTele location found const GameTele* alt = NULL; for (GameTeleMap::const_iterator itr = m_GameTeleMap.begin(); itr != m_GameTeleMap.end(); ++itr) + { if (itr->second.wnameLow == wname) { return &itr->second; @@ -10126,6 +10149,7 @@ GameTele const* ObjectMgr::GetGameTele(const std::string& name) const { alt = &itr->second; } + } return alt; } @@ -10141,10 +10165,12 @@ bool ObjectMgr::AddGameTele(GameTele& tele) // find max id uint32 new_id = 0; for (GameTeleMap::const_iterator itr = m_GameTeleMap.begin(); itr != m_GameTeleMap.end(); ++itr) + { if (itr->first > new_id) { new_id = itr->first; } + } // use next ++new_id; @@ -10870,16 +10896,20 @@ void ObjectMgr::LoadGossipMenuItems(std::set& gossipScriptSet) if (!sLog.HasLogFilter(LOG_FILTER_DB_STRICTED_CHECK)) // check unused menu ids only in strict mode { for (GossipMenusMap::const_iterator itr = m_mGossipMenusMap.begin(); itr != m_mGossipMenusMap.end(); ++itr) + { if (itr->first) { menu_ids.insert(itr->first); } + } for (SQLStorageBase::SQLSIterator itr = sGOStorage.getDataBegin(); itr < sGOStorage.getDataEnd(); ++itr) + { if (uint32 menuid = itr->GetGossipMenuId()) { menu_ids.erase(menuid); } + } } // loading @@ -10891,6 +10921,7 @@ void ObjectMgr::LoadGossipMenuItems(std::set& gossipScriptSet) typedef std::multimap Menu2CInfoMap; Menu2CInfoMap menu2CInfoMap; for (uint32 i = 1; i < sCreatureStorage.GetMaxEntry(); ++i) + { if (CreatureInfo const* cInfo = sCreatureStorage.LookupEntry(i)) if (cInfo->GossipMenuId) { @@ -10902,6 +10933,7 @@ void ObjectMgr::LoadGossipMenuItems(std::set& gossipScriptSet) menu_ids.erase(cInfo->GossipMenuId); } } + } do { @@ -11396,17 +11428,21 @@ void ObjectMgr::GetNpcTextLocaleStringsAll(uint32 entry, int32 loc_idx, ObjectMg { if (text0_Ptr) for (int i = 0; i < MAX_GOSSIP_TEXT_OPTIONS; ++i) + { if (nl->Text_0[i].size() > (size_t)loc_idx && !nl->Text_0[i][loc_idx].empty()) { (*text0_Ptr)[i] = nl->Text_0[i][loc_idx]; } + } if (text1_Ptr) for (int i = 0; i < MAX_GOSSIP_TEXT_OPTIONS; ++i) + { if (nl->Text_1[i].size() > (size_t)loc_idx && !nl->Text_1[i][loc_idx].empty()) { (*text1_Ptr)[i] = nl->Text_1[i][loc_idx]; } + } } } } diff --git a/src/game/Object/ObjectMgr.h b/src/game/Object/ObjectMgr.h index b72334b4b..7488f0ab5 100644 --- a/src/game/Object/ObjectMgr.h +++ b/src/game/Object/ObjectMgr.h @@ -211,7 +211,10 @@ struct PetLevelInfo { PetLevelInfo() : health(0), mana(0), armor(0) { - for (int i = 0; i < MAX_STATS; ++i) stats[i] = 0; + for (int i = 0; i < MAX_STATS; ++i) + { + stats[i] = 0; + } } uint16 stats[MAX_STATS]; @@ -976,10 +979,12 @@ class ObjectMgr } for (MailLevelRewardList::const_iterator set_itr = map_itr->second.begin(); set_itr != map_itr->second.end(); ++set_itr) + { if (set_itr->raceMask & raceMask) { return &*set_itr; } + } return NULL; } @@ -1010,10 +1015,12 @@ class ObjectMgr void DoCreatureData(Worker& worker) const { for (CreatureDataMap::const_iterator itr = mCreatureDataMap.begin(); itr != mCreatureDataMap.end(); ++itr) + { if (worker(*itr)) { break; } + } } CreatureLocale const* GetCreatureLocale(uint32 entry) const @@ -1132,10 +1139,12 @@ class ObjectMgr void DoGOData(Worker& worker) const { for (GameObjectDataMap::const_iterator itr = mGameObjectDataMap.begin(); itr != mGameObjectDataMap.end(); ++itr) + { if (worker(*itr)) // arg = GameObjectDataPair { break; } + } } MangosStringLocale const* GetMangosStringLocale(int32 entry) const diff --git a/src/game/Object/Pet.cpp b/src/game/Object/Pet.cpp index dee86b38a..633a8f340 100644 --- a/src/game/Object/Pet.cpp +++ b/src/game/Object/Pet.cpp @@ -2052,12 +2052,14 @@ bool Pet::removeSpell(uint32 spell_id, bool learn_prev, bool clear_ab) void Pet::CleanupActionBar() { for (int i = 0; i < MAX_UNIT_ACTION_BAR_INDEX; ++i) + { if (UnitActionBarEntry const* ab = m_charmInfo->GetActionBarEntry(i)) if (uint32 action = ab->GetAction()) if (ab->IsActionBarForSpell() && !HasSpell(action)) { m_charmInfo->SetActionBar(i, 0, ACT_DISABLED); } + } } /** @@ -2140,10 +2142,12 @@ bool Pet::resetTalents(bool no_cost) } for (int j = 0; j < MAX_TALENT_RANK; ++j) + { if (talentInfo->RankID[j]) { removeSpell(talentInfo->RankID[j], !IsPassiveSpell(talentInfo->RankID[j]), false); } + } } UpdateFreeTalentPoints(false); @@ -2728,10 +2732,12 @@ void Pet::UpdateSpeed(UnitMoveType mtype, bool forced, float ratio) { AuraList const& auras = GetAurasByType(SPELL_AURA_MOD_INCREASE_SPEED); for (AuraList::const_iterator it = auras.begin(); it != auras.end(); ++it) + { if ((*it)->GetId() != 19582) // exclude the aura influenced by Bestial Swiftness { main_speed_mod = std::max((*it)->GetBasePoints(), main_speed_mod); } + } } else { diff --git a/src/game/Object/Player.cpp b/src/game/Object/Player.cpp index ebb034254..eeda848f6 100644 --- a/src/game/Object/Player.cpp +++ b/src/game/Object/Player.cpp @@ -381,10 +381,12 @@ Item* TradeData::GetItem(TradeSlots slot) const bool TradeData::HasItem(ObjectGuid item_guid) const { for (int i = 0; i < TRADE_SLOT_COUNT; ++i) + { if (m_items[i] == item_guid) { return true; } + } return false; } @@ -811,10 +813,12 @@ Player::~Player() // clean up player-instance binds, may unload some instance saves for (uint8 i = 0; i < MAX_DIFFICULTY; ++i) + { for (BoundInstancesMap::iterator itr = m_boundInstances[i].begin(); itr != m_boundInstances[i].end(); ++itr) { itr->second.state->RemovePlayer(this); } + } delete m_declinedname; delete m_runes; @@ -1484,11 +1488,13 @@ void Player::HandleDrowning(uint32 time_diff) // Recheck timers flag m_MirrorTimerFlags &= ~UNDERWATER_EXIST_TIMERS; for (int i = 0; i < MAX_TIMERS; ++i) + { if (m_MirrorTimer[i] != DISABLED_MIRROR_TIMER) { m_MirrorTimerFlags |= UNDERWATER_EXIST_TIMERS; break; } + } m_MirrorTimerFlagsLast = m_MirrorTimerFlags; } @@ -2754,10 +2760,12 @@ void Player::Regenerate(Powers power, uint32 diff) uint32 cd_diff = diff; AuraList const& ModPowerRegenPCTAuras = GetAurasByType(SPELL_AURA_MOD_POWER_REGEN_PERCENT); for (AuraList::const_iterator i = ModPowerRegenPCTAuras.begin(); i != ModPowerRegenPCTAuras.end(); ++i) + { if ((*i)->GetModifier()->m_miscvalue == int32(power) && (*i)->GetMiscBValue() == GetCurrentRune(rune)) { cd_diff = cd_diff * ((*i)->GetModifier()->m_amount + 100) / 100; } + } SetRuneCooldown(rune, (cd < cd_diff) ? 0 : cd - cd_diff); } @@ -2778,10 +2786,12 @@ void Player::Regenerate(Powers power, uint32 diff) { AuraList const& ModPowerRegenPCTAuras = GetAurasByType(SPELL_AURA_MOD_POWER_REGEN_PERCENT); for (AuraList::const_iterator i = ModPowerRegenPCTAuras.begin(); i != ModPowerRegenPCTAuras.end(); ++i) + { if ((*i)->GetModifier()->m_miscvalue == int32(power)) { addvalue *= ((*i)->GetModifier()->m_amount + 100) / 100.0f; } + } } // addvalue computed on a 2sec basis. => update to diff time @@ -4435,10 +4445,12 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool learn_low_rank, bo // unlearn non talent higher ranks (recursive) SpellChainMapNext const& nextMap = sSpellMgr.GetSpellChainNext(); for (SpellChainMapNext::const_iterator itr2 = nextMap.lower_bound(spell_id); itr2 != nextMap.upper_bound(spell_id); ++itr2) + { if (HasSpell(itr2->second) && !GetTalentSpellPos(itr2->second)) { removeSpell(itr2->second, disabled, false); } + } // re-search, it can be corrupted in prev loop itr = m_spells.find(spell_id); @@ -4973,10 +4985,12 @@ bool Player::resetTalents(bool no_cost, bool all_specs) } for (int j = 0; j < MAX_TALENT_RANK; ++j) + { if (talentInfo->RankID[j]) { removeSpell(talentInfo->RankID[j], !IsPassiveSpell(talentInfo->RankID[j]), false); } + } iter = m_talents[m_activeSpec].begin(); } @@ -6110,10 +6124,12 @@ Corpse* Player::GetCorpse() const void Player::DurabilityLossAll(double percent, bool inventory) { 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) { @@ -6121,21 +6137,27 @@ void Player::DurabilityLossAll(double percent, bool inventory) // 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) + { 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 = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i) + { if (Bag* pBag = reinterpret_cast(GetItemByPos(INVENTORY_SLOT_BAG_0, i))) for (uint32 j = 0; j < pBag->GetBagSize(); ++j) + { if (Item* pItem = GetItemByPos(i, j)) { DurabilityLoss(pItem, percent); } + } + } } } @@ -6190,21 +6212,27 @@ void Player::DurabilityPointsLossAll(int32 points, bool inventory) // 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) + { 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 = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i) + { if (Bag* pBag = reinterpret_cast(GetItemByPos(INVENTORY_SLOT_BAG_0, i))) for (uint32 j = 0; j < pBag->GetBagSize(); ++j) + { if (Item* pItem = GetItemByPos(i, j)) { DurabilityPointsLoss(pItem, points); } + } + } } } @@ -6282,10 +6310,12 @@ uint32 Player::DurabilityRepairAll(bool cost, float discountMod, bool guildBank) // items in inventory bags for (int j = INVENTORY_SLOT_BAG_START; j < INVENTORY_SLOT_BAG_END; ++j) + { for (int i = 0; i < MAX_BAG_SIZE; ++i) { TotalCost += DurabilityRepair(((j << 8) | i), cost, discountMod, guildBank); } + } return TotalCost; } @@ -6934,10 +6964,12 @@ void Player::UpdateRating(CombatRating cr) // stat used stored in miscValueB for this aura AuraList const& modRatingFromStat = GetAurasByType(SPELL_AURA_MOD_RATING_FROM_STAT); for (AuraList::const_iterator i = modRatingFromStat.begin(); i != modRatingFromStat.end(); ++i) + { if ((*i)->GetMiscValue() & (1 << cr)) { amount += int32(GetStat(Stats((*i)->GetMiscBValue())) * (*i)->GetModifier()->m_amount / 100.0f); } + } if (amount < 0) { amount = 0; @@ -7602,11 +7634,13 @@ void Player::SetSkill(uint16 id, uint16 currVal, uint16 maxVal, uint16 step /*=0 // remove all spells that related to this skill for (uint32 j = 0; j < sSkillLineAbilityStore.GetNumRows(); ++j) + { if (SkillLineAbilityEntry const* pAbility = sSkillLineAbilityStore.LookupEntry(j)) if (pAbility->skillId == id) { removeSpell(sSpellMgr.GetFirstSpellInChain(pAbility->spellId)); } + } } } else if (currVal) // add @@ -7644,18 +7678,22 @@ void Player::SetSkill(uint16 id, uint16 currVal, uint16 maxVal, uint16 step /*=0 // temporary bonuses AuraList const& mModSkill = GetAurasByType(SPELL_AURA_MOD_SKILL); for (AuraList::const_iterator j = mModSkill.begin(); j != mModSkill.end(); ++j) + { if ((*j)->GetModifier()->m_miscvalue == int32(id)) { (*j)->ApplyModifier(true); } + } // permanent bonuses AuraList const& mModSkillTalent = GetAurasByType(SPELL_AURA_MOD_SKILL_TALENT); for (AuraList::const_iterator j = mModSkillTalent.begin(); j != mModSkillTalent.end(); ++j) + { if ((*j)->GetModifier()->m_miscvalue == int32(id)) { (*j)->ApplyModifier(true); } + } // Learn all spells for skill learnSkillRewardedSpells(id, currVal); @@ -11831,37 +11869,47 @@ uint32 Player::GetItemCountWithLimitCategory(uint32 limitCategory, Item* skipIte { uint32 count = 0; for (int i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_ITEM_END; ++i) + { if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) if (pItem->GetProto()->ItemLimitCategory == limitCategory && pItem != skipItem) { count += pItem->GetCount(); } + } for (int i = KEYRING_SLOT_START; i < CURRENCYTOKEN_SLOT_END; ++i) + { if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) if (pItem->GetProto()->ItemLimitCategory == limitCategory && pItem != skipItem) { count += pItem->GetCount(); } + } for (int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i) + { if (Bag* pBag = reinterpret_cast(GetItemByPos(INVENTORY_SLOT_BAG_0, i))) { count += pBag->GetItemCountWithLimitCategory(limitCategory, skipItem); } + } for (int i = BANK_SLOT_ITEM_START; i < BANK_SLOT_ITEM_END; ++i) + { if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) if (pItem->GetProto()->ItemLimitCategory == limitCategory && pItem != skipItem) { count += pItem->GetCount(); } + } for (int i = BANK_SLOT_BAG_START; i < BANK_SLOT_BAG_END; ++i) + { if (Bag* pBag = reinterpret_cast(GetItemByPos(INVENTORY_SLOT_BAG_0, i))) { count += pBag->GetItemCountWithLimitCategory(limitCategory, skipItem); } + } return count; } @@ -11875,25 +11923,31 @@ uint32 Player::GetItemCountWithLimitCategory(uint32 limitCategory, Item* skipIte Item* Player::GetItemByEntry(uint32 item) const { for (int i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_ITEM_END; ++i) + { if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) if (pItem->GetEntry() == item) { return pItem; } + } for (int i = KEYRING_SLOT_START; i < CURRENCYTOKEN_SLOT_END; ++i) + { if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) if (pItem->GetEntry() == item) { return pItem; } + } for (int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i) + { if (Bag* pBag = reinterpret_cast(GetItemByPos(INVENTORY_SLOT_BAG_0, i))) if (Item* itemPtr = pBag->GetItemByEntry(item)) { return itemPtr; } + } return NULL; } @@ -11901,25 +11955,31 @@ Item* Player::GetItemByEntry(uint32 item) const Item* Player::GetItemByLimitedCategory(uint32 limitedCategory) const { for (int i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_ITEM_END; ++i) + { if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) if (pItem->GetProto()->ItemLimitCategory == limitedCategory) { return pItem; } + } for (int i = KEYRING_SLOT_START; i < CURRENCYTOKEN_SLOT_END; ++i) + { if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) if (pItem->GetProto()->ItemLimitCategory == limitedCategory) { return pItem; } + } for (int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i) + { if (Bag* pBag = reinterpret_cast(GetItemByPos(INVENTORY_SLOT_BAG_0, i))) if (Item* itemPtr = pBag->GetItemByLimitedCategory(limitedCategory)) { return itemPtr; } + } return NULL; } @@ -11933,43 +11993,57 @@ Item* Player::GetItemByLimitedCategory(uint32 limitedCategory) const Item* Player::GetItemByGuid(ObjectGuid guid) const { for (int i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_ITEM_END; ++i) + { if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) if (pItem->GetObjectGuid() == guid) { return pItem; } + } for (int i = KEYRING_SLOT_START; i < CURRENCYTOKEN_SLOT_END; ++i) + { if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) if (pItem->GetObjectGuid() == guid) { return pItem; } + } for (int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i) + { if (Bag* pBag = reinterpret_cast(GetItemByPos(INVENTORY_SLOT_BAG_0, i))) for (uint32 j = 0; j < pBag->GetBagSize(); ++j) + { if (Item* pItem = pBag->GetItemByPos(j)) if (pItem->GetObjectGuid() == guid) { return pItem; } + } + } for (int i = BANK_SLOT_ITEM_START; i < BANK_SLOT_ITEM_END; ++i) + { if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) if (pItem->GetObjectGuid() == guid) { return pItem; } + } for (int i = BANK_SLOT_BAG_START; i < BANK_SLOT_BAG_END; ++i) + { if (Bag* pBag = reinterpret_cast(GetItemByPos(INVENTORY_SLOT_BAG_0, i))) for (uint32 j = 0; j < pBag->GetBagSize(); ++j) + { if (Item* pItem = pBag->GetItemByPos(j)) if (pItem->GetObjectGuid() == guid) { return pItem; } + } + } return NULL; } @@ -15425,36 +15499,46 @@ void Player::DestroyZoneLimitedItem(bool update, uint32 new_zone) // in inventory 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 < CURRENCYTOKEN_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) + { if (Bag* pBag = reinterpret_cast(GetItemByPos(INVENTORY_SLOT_BAG_0, i))) 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) + { if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) if (pItem->IsLimitedToAnotherMapOrZone(GetMapId(), new_zone)) { DestroyItem(INVENTORY_SLOT_BAG_0, i, update); } + } } /** @@ -15470,29 +15554,37 @@ void Player::DestroyConjuredItems(bool update) // in inventory 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) + { if (Bag* pBag = reinterpret_cast(GetItemByPos(INVENTORY_SLOT_BAG_0, i))) 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) + { if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) if (pItem->IsConjuredConsumable()) { DestroyItem(INVENTORY_SLOT_BAG_0, i, update); } + } } /** @@ -16358,21 +16450,27 @@ void Player::RemoveAllEnchantments(EnchantmentSlot slot) // 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) + { if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) if (pItem->GetEnchantmentId(slot)) { pItem->ClearEnchantment(slot); } + } // in inventory bags for (int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i) + { if (Bag* pBag = reinterpret_cast(GetItemByPos(INVENTORY_SLOT_BAG_0, i))) for (uint32 j = 0; j < pBag->GetBagSize(); ++j) + { if (Item* pItem = pBag->GetItemByPos(j)) if (pItem->GetEnchantmentId(slot)) { pItem->ClearEnchantment(slot); } + } + } } // duration == 0 will remove item enchant @@ -19203,10 +19301,12 @@ uint32 Player::GetReqKillOrCastCurrentCount(uint32 quest_id, int32 entry) } for (int j = 0; j < QUEST_OBJECTIVES_COUNT; ++j) + { if (qInfo->ReqCreatureOrGOId[j] == entry) { return mQuestStatus[quest_id].m_creatureOrGOcount[j]; } + } return 0; } @@ -19247,10 +19347,12 @@ void Player::AdjustQuestReqItemCount(Quest const* pQuest, QuestStatusData& quest uint16 Player::FindQuestSlot(uint32 quest_id) const { for (uint16 i = 0; i < MAX_QUEST_LOG_SIZE; ++i) + { if (GetQuestSlotQuestId(i) == quest_id) { return i; } + } return MAX_QUEST_LOG_SIZE; } @@ -19448,10 +19550,12 @@ void Player::KilledMonster(CreatureInfo const* cInfo, ObjectGuid guid) } for (int i = 0; i < MAX_KILL_CREDIT; ++i) + { if (cInfo->KillCredit[i]) { KilledMonsterCredit(cInfo->KillCredit[i], guid); } + } } /** @@ -21627,10 +21731,12 @@ void Player::_LoadQuestStatus(QueryResult* result) } for (uint8 idx = 0; idx < QUEST_OBJECTIVES_COUNT; ++idx) + { if (questStatusData.m_creatureOrGOcount[idx]) { SetQuestSlotCounter(slot, idx, questStatusData.m_creatureOrGOcount[idx]); } + } ++slot; } @@ -23066,10 +23172,12 @@ void Player::_SaveDailyQuestStatus() stmtDel.PExecute(GetGUIDLow()); for (uint32 quest_daily_idx = 0; quest_daily_idx < PLAYER_MAX_DAILY_QUESTS; ++quest_daily_idx) + { if (GetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1 + quest_daily_idx)) { stmtIns.PExecute(GetGUIDLow(), GetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1 + quest_daily_idx)); } + } m_DailyQuestChanged = false; } @@ -25284,11 +25392,13 @@ void Player::UpdatePotionCooldown(Spell* spell) // spell/item pair let set proper cooldown (except nonexistent charged spell cooldown spellmods for potions) if (ItemPrototype const* proto = ObjectMgr::GetItemPrototype(m_lastPotionId)) for (int idx = 0; idx < 5; ++idx) + { if (proto->Spells[idx].SpellId && proto->Spells[idx].SpellTrigger == ITEM_SPELLTRIGGER_ON_USE) if (SpellEntry const* spellInfo = sSpellStore.LookupEntry(proto->Spells[idx].SpellId)) { SendCooldownEvent(spellInfo, m_lastPotionId); } + } } // from spell cases (m_lastPotionId set in Spell::SendSpellCooldown) else @@ -26951,22 +27061,26 @@ bool Player::HasItemFitToSpellReqirements(SpellEntry const* spellInfo, Item cons case ITEM_CLASS_WEAPON: { for (int i = EQUIPMENT_SLOT_MAINHAND; i < EQUIPMENT_SLOT_TABARD; ++i) + { if (Item* item = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) if (item != ignoreItem && item->IsFitToSpellRequirements(spellInfo)) { return true; } + } break; } case ITEM_CLASS_ARMOR: { // tabard not have dependent spells for (int i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_MAINHAND; ++i) + { if (Item* item = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) if (item != ignoreItem && item->IsFitToSpellRequirements(spellInfo)) { return true; } + } // shields can be equipped to offhand slot if (Item* item = GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND)) @@ -27051,11 +27165,13 @@ void Player::RemoveItemDependentAurasAndCasts(Item* pItem) // currently casted spells can be dependent from item for (uint32 i = 0; i < CURRENT_MAX_SPELL; ++i) + { if (Spell* spell = GetCurrentSpell(CurrentSpellTypes(i))) if (spell->getState() != SPELL_STATE_DELAYED && !HasItemFitToSpellReqirements(spell->m_spellInfo, pItem)) { InterruptSpell(CurrentSpellTypes(i)); } + } } /** @@ -27815,10 +27931,12 @@ void Player::SetCanBlock(bool value) bool ItemPosCount::isContainedIn(ItemPosCountVec const& vec) const { for (ItemPosCountVec::const_iterator itr = vec.begin(); itr != vec.end(); ++itr) + { if (itr->pos == pos) { return true; } + } return false; } @@ -27894,11 +28012,13 @@ uint32 Player::GetBarberShopCost(uint8 newhairstyle, uint8 newhaircolor, uint8 n void Player::InitGlyphsForLevel() { for (uint32 i = 0; i < sGlyphSlotStore.GetNumRows(); ++i) + { if (GlyphSlotEntry const* gs = sGlyphSlotStore.LookupEntry(i)) if (gs->Order) { SetGlyphSlot(gs->Order - 1, gs->Id); } + } uint32 level = getLevel(); uint32 value = 0; @@ -28102,10 +28222,12 @@ void Player::InitRunes() bool Player::IsBaseRuneSlotsOnCooldown(RuneType runeType) const { for (uint32 i = 0; i < MAX_RUNES; ++i) + { if (GetBaseRune(i) == runeType && GetRuneCooldown(i) == 0) { return false; } + } return true; } @@ -28728,10 +28850,12 @@ void Player::LearnTalent(uint32 talentId, uint32 talentRank) if (talentInfo->Row > 0) { for (PlayerTalentMap::const_iterator iter = m_talents[m_activeSpec].begin(); iter != m_talents[m_activeSpec].end(); ++iter) + { if (iter->second.state != PLAYERSPELL_REMOVED && iter->second.talentEntry->TalentTab == tTab) { spentPoints += iter->second.currentRank + 1; } + } } // not have required min points spent in talent tree @@ -29022,10 +29146,12 @@ bool Player::canSeeSpellClickOn(Creature const* c) const SpellClickInfoMapBounds clickPair = sObjectMgr.GetSpellClickInfoMapBounds(c->GetEntry()); for (SpellClickInfoMap::const_iterator itr = clickPair.first; itr != clickPair.second; ++itr) + { if (itr->second.IsFitToRequirements(this, c)) { return true; } + } return false; } @@ -29489,10 +29615,12 @@ void Player::ActivateSpec(uint8 specNum) TalentEntry const* talentInfo = talent.talentEntry; for (int r = 0; r < MAX_TALENT_RANK; ++r) + { if (talentInfo->RankID[r]) { removeSpell(talentInfo->RankID[r], !IsPassiveSpell(talentInfo->RankID[r]), false); } + } specIter = m_talents[m_activeSpec].begin(); } diff --git a/src/game/Object/Player.h b/src/game/Object/Player.h index 0cbdb7974..e01abdb30 100644 --- a/src/game/Object/Player.h +++ b/src/game/Object/Player.h @@ -3381,10 +3381,12 @@ class Player : public Unit bool InBattleGroundQueue() const { for (int i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i) + { if (m_bgBattleGroundQueueID[i].bgQueueTypeId != BATTLEGROUND_QUEUE_NONE) { return true; } + } return false; } @@ -3395,10 +3397,12 @@ class Player : public Unit uint32 GetBattleGroundQueueIndex(BattleGroundQueueTypeId bgQueueTypeId) const { for (int i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i) + { if (m_bgBattleGroundQueueID[i].bgQueueTypeId == bgQueueTypeId) { return i; } + } return PLAYER_MAX_BATTLEGROUND_QUEUES; } @@ -3406,10 +3410,12 @@ class Player : public Unit bool IsInvitedForBattleGroundQueueType(BattleGroundQueueTypeId bgQueueTypeId) const { for (int i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i) + { if (m_bgBattleGroundQueueID[i].bgQueueTypeId == bgQueueTypeId) { return m_bgBattleGroundQueueID[i].invitedToInstance != 0; } + } return false; } @@ -3446,10 +3452,12 @@ class Player : public Unit bool HasFreeBattleGroundQueueId() { for (int i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i) + { if (m_bgBattleGroundQueueID[i].bgQueueTypeId == BATTLEGROUND_QUEUE_NONE) { return true; } + } return false; } @@ -3471,20 +3479,24 @@ class Player : public Unit void SetInviteForBattleGroundQueueType(BattleGroundQueueTypeId bgQueueTypeId, uint32 instanceId) { for (int i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i) + { if (m_bgBattleGroundQueueID[i].bgQueueTypeId == bgQueueTypeId) { m_bgBattleGroundQueueID[i].invitedToInstance = instanceId; } + } } // Check if the player is invited for a specific battleground instance bool IsInvitedForBattleGroundInstance(uint32 instanceId) const { 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/Object/SpellMgr.cpp b/src/game/Object/SpellMgr.cpp index ee655354d..66fb20b27 100644 --- a/src/game/Object/SpellMgr.cpp +++ b/src/game/Object/SpellMgr.cpp @@ -252,10 +252,12 @@ uint32 GetSpellCastTimeForBonus(SpellEntry const* spellProto, DamageEffectType d bool AreaEffect = false; for (uint32 i = 0; i < MAX_EFFECT_INDEX; ++i) + { if (IsAreaEffectTarget(Targets(spellProto->EffectImplicitTargetA[i])) || IsAreaEffectTarget(Targets(spellProto->EffectImplicitTargetB[i]))) { AreaEffect = true; } + } for (uint32 i = 0; i < MAX_EFFECT_INDEX; ++i) { @@ -1300,10 +1302,12 @@ bool IsPositiveSpell(SpellEntry const* spellproto) // spells with at least 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 < MAX_EFFECT_INDEX; ++i) + { if (spellproto->Effect[i] && !IsPositiveEffect(spellproto, SpellEffectIndex(i))) { return false; } + } return true; } @@ -1566,10 +1570,12 @@ struct SpellRankHelper { // check that first rank added for custom ranks for (std::set::const_iterator itr = firstRankSpellsWithCustomRanks.begin(); itr != firstRankSpellsWithCustomRanks.end(); ++itr) + { if (!worker.HasEntry(*itr)) { sLog.outErrorDb("Spell %u must be listed in `%s` as first rank for listed custom ranks of spell but not found!", *itr, worker.TableName()); } + } // fill absent non first ranks data base at first rank data for (std::set::const_iterator itr = firstRankSpells.begin(); itr != firstRankSpells.end(); ++itr) @@ -1903,10 +1909,12 @@ bool IsCastEndProcModifierAura(SpellEntry const* spellInfo, SpellEffectIndex eff case SPELL_AURA_MOD_DAMAGE_PERCENT_DONE: { for (int32 i = 0; i < MAX_EFFECT_INDEX; ++i) + { if (IsEffectHandledOnDelayedSpellLaunch(procSpell, SpellEffectIndex(i))) { return true; } + } return false; } @@ -4935,10 +4943,12 @@ SpellCastResult SpellMgr::GetSpellAllowedInLocationError(SpellEntry const* spell while (groupEntry) { for (uint32 i = 0; i < 6; ++i) + { if (groupEntry->AreaId[i] == zone_id || groupEntry->AreaId[i] == area_id) { found = true; } + } if (found || !groupEntry->nextGroup) { break; diff --git a/src/game/Object/SpellMgr.h b/src/game/Object/SpellMgr.h index b03035f98..efe4903a2 100644 --- a/src/game/Object/SpellMgr.h +++ b/src/game/Object/SpellMgr.h @@ -153,10 +153,12 @@ WeaponAttackType GetWeaponAttackType(SpellEntry const* spellInfo); inline bool IsSpellHaveEffect(SpellEntry const* spellInfo, SpellEffects effect) { for (int i = 0; i < MAX_EFFECT_INDEX; ++i) + { if (SpellEffects(spellInfo->Effect[i]) == effect) { return true; } + } return false; } @@ -179,11 +181,13 @@ inline bool IsAuraApplyEffect(SpellEntry const* spellInfo, SpellEffectIndex effe inline bool IsSpellAppliesAura(SpellEntry const* spellInfo, uint32 effectMask = ((1 << EFFECT_INDEX_0) | (1 << EFFECT_INDEX_1) | (1 << EFFECT_INDEX_2))) { for (int i = 0; i < MAX_EFFECT_INDEX; ++i) + { if (effectMask & (1 << i)) if (IsAuraApplyEffect(spellInfo, SpellEffectIndex(i))) { return true; } + } return false; } @@ -221,21 +225,25 @@ bool IsCastEndProcModifierAura(SpellEntry const* spellInfo, SpellEffectIndex eff inline bool IsSpellHaveAura(SpellEntry const* spellInfo, AuraType aura, uint32 effectMask = (1 << EFFECT_INDEX_0) | (1 << EFFECT_INDEX_1) | (1 << EFFECT_INDEX_2)) { for (int i = 0; i < MAX_EFFECT_INDEX; ++i) + { if (effectMask & (1 << i)) if (AuraType(spellInfo->EffectApplyAuraName[i]) == aura) { return true; } + } return false; } inline bool IsSpellLastAuraEffect(SpellEntry const* spellInfo, SpellEffectIndex effecIdx) { for (int i = effecIdx + 1; i < MAX_EFFECT_INDEX; ++i) + { if (spellInfo->EffectApplyAuraName[i]) { return false; } + } return true; } @@ -539,10 +547,12 @@ inline bool IsAreaAuraEffect(uint32 effect) inline bool HasAreaAuraEffect(SpellEntry const* spellInfo) { for (int32 i = 0; i < MAX_EFFECT_INDEX; ++i) + { if (IsAreaAuraEffect(spellInfo->Effect[i])) { return true; } + } return false; } @@ -681,10 +691,12 @@ inline uint32 GetAllSpellMechanicMask(SpellEntry const* spellInfo) mask |= 1 << (spellInfo->Mechanic - 1); } for (int i = 0; i < MAX_EFFECT_INDEX; ++i) + { if (spellInfo->EffectMechanic[i]) { mask |= 1 << (spellInfo->EffectMechanic[i] - 1); } + } return mask; } @@ -1260,10 +1272,12 @@ class SpellMgr // check present in same rank chain for (; itr != mSpellChains.end(); itr = mSpellChains.find(itr->second.prev)) + { if (itr->second.prev == spell2) { return true; } + } return false; } @@ -1306,10 +1320,12 @@ class SpellMgr { SpellLearnSpellMapBounds bounds = GetSpellLearnSpellMapBounds(spell_id1); for (SpellLearnSpellMap::const_iterator i = bounds.first; i != bounds.second; ++i) + { if (i->second.spell == spell_id2) { return true; } + } return false; } diff --git a/src/game/Object/StatSystem.cpp b/src/game/Object/StatSystem.cpp index 3bbaa768c..e6826ee54 100644 --- a/src/game/Object/StatSystem.cpp +++ b/src/game/Object/StatSystem.cpp @@ -96,17 +96,21 @@ bool Player::UpdateStats(Stats stat) uint32 mask = 0; AuraList const& modRatingFromStat = GetAurasByType(SPELL_AURA_MOD_RATING_FROM_STAT); for (AuraList::const_iterator i = modRatingFromStat.begin(); i != modRatingFromStat.end(); ++i) + { if (Stats((*i)->GetMiscBValue()) == stat) { mask |= (*i)->GetMiscValue(); } + } if (mask) { for (uint32 rating = 0; rating < MAX_COMBAT_RATING; ++rating) + { if (mask & (1 << rating)) { ApplyRatingMod(CombatRating(rating), 0, true); } + } } return true; } @@ -454,8 +458,10 @@ void Player::UpdateAttackPowerAndDamage(bool ranged) AuraList const& mAPbyArmor = GetAurasByType(SPELL_AURA_MOD_ATTACK_POWER_OF_ARMOR); for (AuraList::const_iterator iter = mAPbyArmor.begin(); iter != mAPbyArmor.end(); ++iter) + { // always: ((*i)->GetModifier()->m_miscvalue == 1 == SPELL_SCHOOL_MASK_NORMAL) attPowerMod += int32(GetArmor() / (*iter)->GetModifier()->m_amount); + } } float attPowerMultiplier = GetModifierValue(unitMod, TOTAL_PCT) - 1.0f; diff --git a/src/game/Object/Unit.cpp b/src/game/Object/Unit.cpp index 7819388c9..cbf05a762 100644 --- a/src/game/Object/Unit.cpp +++ b/src/game/Object/Unit.cpp @@ -1441,10 +1441,12 @@ void Unit::PetOwnerKilledUnit(Unit* pVictim) void Unit::CastStop(uint32 except_spellid) { 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(CurrentSpellTypes(i), false); } + } } /** @@ -2430,19 +2432,23 @@ uint32 Unit::CalcNotIgnoreAbsorbDamage(uint32 damage, SpellSchoolMask damageScho float absorb_affected_rate = 1.0f; Unit::AuraList const& ignoreAbsorbSchool = GetAurasByType(SPELL_AURA_MOD_IGNORE_ABSORB_SCHOOL); for (Unit::AuraList::const_iterator i = ignoreAbsorbSchool.begin(); i != ignoreAbsorbSchool.end(); ++i) + { if ((*i)->GetMiscValue() & damageSchoolMask) { absorb_affected_rate *= (100.0f - (*i)->GetModifier()->m_amount) / 100.0f; } + } if (spellInfo) { Unit::AuraList const& ignoreAbsorbForSpell = GetAurasByType(SPELL_AURA_MOD_IGNORE_ABSORB_FOR_SPELL); for (Unit::AuraList::const_iterator citr = ignoreAbsorbForSpell.begin(); citr != ignoreAbsorbForSpell.end(); ++citr) + { if ((*citr)->isAffectedOnSpell(spellInfo)) { absorb_affected_rate *= (100.0f - (*citr)->GetModifier()->m_amount) / 100.0f; } + } } return absorb_affected_rate <= 0.0f ? 0 : (absorb_affected_rate < 1.0f ? uint32(damage * absorb_affected_rate) : damage); @@ -2453,10 +2459,12 @@ uint32 Unit::CalcNotIgnoreDamageReduction(uint32 damage, SpellSchoolMask damageS float absorb_affected_rate = 1.0f; Unit::AuraList const& ignoreAbsorb = GetAurasByType(SPELL_AURA_MOD_IGNORE_DAMAGE_REDUCTION_SCHOOL); for (Unit::AuraList::const_iterator i = ignoreAbsorb.begin(); i != ignoreAbsorb.end(); ++i) + { if ((*i)->GetMiscValue() & damageSchoolMask) { absorb_affected_rate *= (100.0f - (*i)->GetModifier()->m_amount) / 100.0f; } + } return absorb_affected_rate <= 0.0f ? 0 : (absorb_affected_rate < 1.0f ? uint32(damage * absorb_affected_rate) : damage); } @@ -4145,10 +4153,12 @@ SpellMissInfo Unit::SpellHitResult(Unit* pVictim, SpellEntry const* spell, bool int32 reflectchance = pVictim->GetTotalAuraModifier(SPELL_AURA_REFLECT_SPELLS); Unit::AuraList const& mReflectSpellsSchool = pVictim->GetAurasByType(SPELL_AURA_REFLECT_SPELLS_SCHOOL); for (Unit::AuraList::const_iterator i = mReflectSpellsSchool.begin(); i != mReflectSpellsSchool.end(); ++i) + { if ((*i)->GetModifier()->m_miscvalue & GetSpellSchoolMask(spell)) { reflectchance += (*i)->GetModifier()->m_amount; } + } if (reflectchance > 0 && roll_chance_i(reflectchance)) { // Start triggers for remove charges if need (trigger only for victim, and mark as active spell) @@ -4867,10 +4877,12 @@ void Unit::InterruptNonMeleeSpells(bool withDelayed, uint32 spell_id) Spell* Unit::FindCurrentSpellBySpellId(uint32 spell_id) const { 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; } @@ -5009,10 +5021,12 @@ int32 Unit::GetMaxPositiveAuraModifier(AuraType auratype) const AuraList const& mTotalAuraList = GetAurasByType(auratype); for (AuraList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i) + { if ((*i)->GetModifier()->m_amount > modifier) { modifier = (*i)->GetModifier()->m_amount; } + } return modifier; } @@ -5029,10 +5043,12 @@ int32 Unit::GetMaxNegativeAuraModifier(AuraType auratype) const AuraList const& mTotalAuraList = GetAurasByType(auratype); for (AuraList::const_iterator i = mTotalAuraList.begin(); i != mTotalAuraList.end(); ++i) + { if ((*i)->GetModifier()->m_amount < modifier) { modifier = (*i)->GetModifier()->m_amount; } + } return modifier; } @@ -5451,10 +5467,12 @@ bool Unit::AddSpellAuraHolder(SpellAuraHolder* holder) // find minimal effect-index that applies an aura uint8 i = EFFECT_INDEX_0; for (; i < MAX_EFFECT_INDEX; ++i) + { if (IsAuraApplyEffect(aurSpellInfo, SpellEffectIndex(i))) { break; } + } // Remove auras when first holder is applied if ((1 << i) & holder->GetAuraFlags()) @@ -5508,10 +5526,12 @@ bool Unit::AddSpellAuraHolder(SpellAuraHolder* holder) m_spellAuraHolders.insert(SpellAuraHolderMap::value_type(holder->GetId(), holder)); for (int32 i = 0; i < MAX_EFFECT_INDEX; ++i) + { if (Aura* aur = holder->GetAuraByEffectIndex(SpellEffectIndex(i))) { AddAuraToModList(aur); } + } holder->ApplyAuraModifiers(true, true); // This is the place where auras are actually applied onto the target DEBUG_LOG("Holder of spell %u now is in use", holder->GetId()); @@ -5653,17 +5673,21 @@ bool Unit::RemoveNoStackAurasDueToAuraHolder(SpellAuraHolder* holder) bool is_triggered_by_spell = false; // prevent triggering aura of removing aura that triggered it for (int j = 0; j < MAX_EFFECT_INDEX; ++j) + { if (i_spellProto->EffectTriggerSpell[j] == spellId) { is_triggered_by_spell = true; } + } // prevent triggered aura of removing aura that triggering it (triggered effect early some aura of parent spell for (int j = 0; j < MAX_EFFECT_INDEX; ++j) + { if (spellProto->EffectTriggerSpell[j] == i_spellId) { is_triggered_by_spell = true; } + } if (is_triggered_by_spell) { @@ -6631,11 +6655,13 @@ Aura* Unit::GetAura(AuraType type, SpellFamily family, uint64 familyFlag, uint32 { AuraList const& auras = GetAurasByType(type); for (AuraList::const_iterator i = auras.begin(); i != auras.end(); ++i) + { if ((*i)->GetSpellProto()->IsFitToFamily(family, familyFlag, familyFlag2) && (!casterGuid || (*i)->GetCasterGuid() == casterGuid)) { return *i; } + } return NULL; } @@ -6675,10 +6701,12 @@ bool Unit::HasAura(uint32 spellId, SpellEffectIndex effIndex) const //Find all auras with corresponding spellid, can be more than one SpellAuraHolderConstBounds spair = GetSpellAuraHolderBounds(spellId); for (SpellAuraHolderMap::const_iterator i_holder = spair.first; i_holder != spair.second; ++i_holder) + { if (i_holder->second->GetAuraByEffectIndex(effIndex)) { return true; } + } return false; } @@ -6812,10 +6840,12 @@ DynamicObject* Unit::GetDynObject(uint32 spellId) GameObject* Unit::GetGameObject(uint32 spellId) const { for (GameObjectList::const_iterator i = m_gameObj.begin(); i != m_gameObj.end(); ++i) + { if ((*i)->GetSpellId() == spellId) { return *i; } + } WildGameObjectMap::const_iterator find = m_wildGameObjs.find(spellId); if (find != m_wildGameObjs.end()) @@ -8282,11 +8312,13 @@ void Unit::RemoveGuardians() Pet* Unit::FindGuardianWithEntry(uint32 entry) { for (GuidSet::const_iterator itr = m_guardianPets.begin(); itr != m_guardianPets.end(); ++itr) + { if (Pet* pet = GetMap()->GetPet(*itr)) if (pet->GetEntry() == entry) { return pet; } + } return NULL; } @@ -8294,11 +8326,13 @@ Pet* Unit::FindGuardianWithEntry(uint32 entry) Pet* Unit::GetProtectorPet() { for (GuidSet::const_iterator itr = m_guardianPets.begin(); itr != m_guardianPets.end(); ++itr) + { if (Pet* pet = GetMap()->GetPet(*itr)) if (pet->getPetType() == PROTECTOR_PET) { return pet; } + } return NULL; } @@ -8339,10 +8373,12 @@ Totem* Unit::GetTotem(TotemSlot slot) const bool Unit::IsAllTotemSlotsUsed() const { for (int i = 0; i < MAX_TOTEM_SLOT; ++i) + { if (!m_TotemSlot[i]) { return false; } + } return true; } @@ -8380,10 +8416,12 @@ void Unit::_RemoveTotem(Totem* totem) void Unit::UnsummonAllTotems() { for (int i = 0; i < MAX_TOTEM_SLOT; ++i) + { if (Totem* totem = GetTotem(TotemSlot(i))) { totem->UnSummon(); } + } } /** @@ -9557,9 +9595,11 @@ uint32 Unit::SpellHealingBonusDone(Unit* pVictim, SpellEntry const* spellProto, Unit::AuraList const& RejorRegr = pVictim->GetAurasByType(SPELL_AURA_PERIODIC_HEAL); for (Unit::AuraList::const_iterator i = RejorRegr.begin(); i != RejorRegr.end(); ++i) + { if ((*i)->GetSpellProto()->SpellFamilyName == SPELLFAMILY_DRUID && (*i)->GetCasterGuid() == GetObjectGuid()) ++ownHotCount; + } if (ownHotCount) { @@ -9588,9 +9628,11 @@ uint32 Unit::SpellHealingBonusDone(Unit* pVictim, SpellEntry const* spellProto, int ownHotCount = 0; // counted HoT types amount, not stacks Unit::AuraList const& RejorRegr = pVictim->GetAurasByType(SPELL_AURA_PERIODIC_HEAL); for (Unit::AuraList::const_iterator i = RejorRegr.begin(); i != RejorRegr.end(); ++i) + { if ((*i)->GetSpellProto()->SpellFamilyName == SPELLFAMILY_DRUID && (*i)->GetCasterGuid() == GetObjectGuid()) ++ownHotCount; + } if (ownHotCount) { @@ -9683,10 +9725,12 @@ uint32 Unit::SpellHealingBonusTaken(Unit* pCaster, SpellEntry const* spellProto, AuraList const& mHealingGet = GetAurasByType(SPELL_AURA_MOD_HEALING_RECEIVED); for (AuraList::const_iterator i = mHealingGet.begin(); i != mHealingGet.end(); ++i) + { if ((*i)->isAffectedOnSpell(spellProto)) { TakenTotalMod *= ((*i)->GetModifier()->m_amount + 100.0f) / 100.0f; } + } // use float as more appropriate for negative values and percent applying float heal = (healamount + TakenTotal * int32(stack)) * TakenTotalMod; @@ -9706,10 +9750,12 @@ int32 Unit::SpellBaseHealingBonusDone(SpellSchoolMask schoolMask) AuraList const& mHealingDone = GetAurasByType(SPELL_AURA_MOD_HEALING_DONE); for (AuraList::const_iterator i = mHealingDone.begin(); i != mHealingDone.end(); ++i) + { if (!(*i)->GetModifier()->m_miscvalue || ((*i)->GetModifier()->m_miscvalue & schoolMask) != 0) { AdvertisedBenefit += (*i)->GetModifier()->m_amount; } + } // Healing bonus of spirit, intellect and strength if (GetTypeId() == TYPEID_PLAYER) @@ -9729,10 +9775,12 @@ int32 Unit::SpellBaseHealingBonusDone(SpellSchoolMask schoolMask) // ... and attack power AuraList const& mHealingDonebyAP = GetAurasByType(SPELL_AURA_MOD_SPELL_HEALING_OF_ATTACK_POWER); for (AuraList::const_iterator i = mHealingDonebyAP.begin(); i != mHealingDonebyAP.end(); ++i) + { if ((*i)->GetModifier()->m_miscvalue & schoolMask) { AdvertisedBenefit += int32(GetTotalAttackPowerValue(BASE_ATTACK) * (*i)->GetModifier()->m_amount / 100.0f); } + } } return AdvertisedBenefit; } @@ -9748,10 +9796,12 @@ int32 Unit::SpellBaseHealingBonusTaken(SpellSchoolMask schoolMask) int32 AdvertisedBenefit = 0; AuraList const& mDamageTaken = GetAurasByType(SPELL_AURA_MOD_HEALING); for (AuraList::const_iterator i = mDamageTaken.begin(); i != mDamageTaken.end(); ++i) + { if ((*i)->GetModifier()->m_miscvalue & schoolMask) { AdvertisedBenefit += (*i)->GetModifier()->m_amount; } + } return AdvertisedBenefit; } @@ -9767,18 +9817,22 @@ bool Unit::IsImmuneToDamage(SpellSchoolMask shoolMask) // If m_immuneToSchool type contain this school type, IMMUNE damage. SpellImmuneList const& schoolList = m_spellImmune[IMMUNITY_SCHOOL]; for (SpellImmuneList::const_iterator itr = schoolList.begin(); itr != schoolList.end(); ++itr) + { if (itr->type & shoolMask) { return true; } + } // If m_immuneToDamage type contain magic, IMMUNE damage. SpellImmuneList const& damageList = m_spellImmune[IMMUNITY_DAMAGE]; for (SpellImmuneList::const_iterator itr = damageList.begin(); itr != damageList.end(); ++itr) + { if (itr->type & shoolMask) { return true; } + } return false; } @@ -9802,38 +9856,46 @@ bool Unit::IsImmuneToSpell(SpellEntry const* spellInfo, bool castOnSelf) SpellImmuneList const& dispelList = m_spellImmune[IMMUNITY_DISPEL]; for (SpellImmuneList::const_iterator itr = dispelList.begin(); itr != dispelList.end(); ++itr) + { if (itr->type == spellInfo->Dispel) { return true; } + } if (!spellInfo->HasAttribute(SPELL_ATTR_EX_UNAFFECTED_BY_SCHOOL_IMMUNE) && // unaffected by school immunity !spellInfo->HasAttribute(SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY)) // can remove immune (by dispell or immune it) { SpellImmuneList const& schoolList = m_spellImmune[IMMUNITY_SCHOOL]; for (SpellImmuneList::const_iterator itr = schoolList.begin(); itr != schoolList.end(); ++itr) + { if (!(IsPositiveSpell(itr->spellId) && IsPositiveSpell(spellInfo->Id)) && (itr->type & GetSpellSchoolMask(spellInfo))) { return true; } + } } if (uint32 mechanic = spellInfo->Mechanic) { SpellImmuneList const& mechanicList = m_spellImmune[IMMUNITY_MECHANIC]; for (SpellImmuneList::const_iterator itr = mechanicList.begin(); itr != mechanicList.end(); ++itr) + { if (itr->type == mechanic) { return true; } + } AuraList const& immuneAuraApply = GetAurasByType(SPELL_AURA_MECHANIC_IMMUNITY_MASK); for (AuraList::const_iterator iter = immuneAuraApply.begin(); iter != immuneAuraApply.end(); ++iter) + { if ((*iter)->GetModifier()->m_miscvalue & (1 << (mechanic - 1))) { return true; } + } } return false; @@ -9853,36 +9915,44 @@ bool Unit::IsImmuneToSpellEffect(SpellEntry const* spellInfo, SpellEffectIndex i uint32 effect = spellInfo->Effect[index]; SpellImmuneList const& effectList = m_spellImmune[IMMUNITY_EFFECT]; for (SpellImmuneList::const_iterator itr = effectList.begin(); itr != effectList.end(); ++itr) + { if (itr->type == effect) { return true; } + } if (uint32 mechanic = spellInfo->EffectMechanic[index]) { SpellImmuneList const& mechanicList = m_spellImmune[IMMUNITY_MECHANIC]; for (SpellImmuneList::const_iterator itr = mechanicList.begin(); itr != mechanicList.end(); ++itr) + { if (itr->type == mechanic) { return true; } + } AuraList const& immuneAuraApply = GetAurasByType(SPELL_AURA_MECHANIC_IMMUNITY_MASK); for (AuraList::const_iterator iter = immuneAuraApply.begin(); iter != immuneAuraApply.end(); ++iter) + { if ((*iter)->GetModifier()->m_miscvalue & (1 << (mechanic - 1))) { return true; } + } } if (uint32 aura = spellInfo->EffectApplyAuraName[index]) { SpellImmuneList const& list = m_spellImmune[IMMUNITY_STATE]; for (SpellImmuneList::const_iterator itr = list.begin(); itr != list.end(); ++itr) + { if (itr->type == aura) { return true; } + } // Check for immune to application of harmful magical effects AuraList const& immuneAuraApply = GetAurasByType(SPELL_AURA_MOD_IMMUNE_AURA_APPLY_SCHOOL); @@ -9893,10 +9963,12 @@ bool Unit::IsImmuneToSpellEffect(SpellEntry const* spellInfo, SpellEffectIndex i // Check school SpellSchoolMask schoolMask = GetSpellSchoolMask(spellInfo); for (AuraList::const_iterator iter = immuneAuraApply.begin(); iter != immuneAuraApply.end(); ++iter) + { if ((*iter)->GetModifier()->m_miscvalue & schoolMask) { return true; } + } } } return false; @@ -10638,11 +10710,13 @@ void Unit::SetInCombatState(bool PvP, Unit* enemy) // interrupt all delayed non-combat casts for (uint32 i = CURRENT_FIRST_NON_MELEE_SPELL; i < CURRENT_MAX_SPELL; ++i) + { if (Spell* spell = GetCurrentSpell(CurrentSpellTypes(i))) if (IsNonCombatSpell(spell->m_spellInfo)) { InterruptSpell(CurrentSpellTypes(i), false); } + } if (creatureNotInCombat) { @@ -11014,10 +11088,12 @@ bool Unit::IsVisibleForOrDetect(Unit const* u, WorldObject const* viewPoint, boo // Hunter mark functionality AuraList const& auras = GetAurasByType(SPELL_AURA_MOD_STALKED); for (AuraList::const_iterator iter = auras.begin(); iter != auras.end(); ++iter) + { if ((*iter)->GetCasterGuid() == u->GetObjectGuid()) { return true; } + } // else apply detecting check for stealth } @@ -11195,19 +11271,23 @@ bool Unit::CanDetectInvisibilityOf(Unit const* u) const int32 invLevel = 0; Unit::AuraList const& iAuras = u->GetAurasByType(SPELL_AURA_MOD_INVISIBILITY); for (Unit::AuraList::const_iterator itr = iAuras.begin(); itr != iAuras.end(); ++itr) + { if ((*itr)->GetModifier()->m_miscvalue == i && invLevel < (*itr)->GetModifier()->m_amount) { invLevel = (*itr)->GetModifier()->m_amount; } + } // find invisibility detect level int32 detectLevel = 0; Unit::AuraList const& dAuras = GetAurasByType(SPELL_AURA_MOD_INVISIBILITY_DETECTION); for (Unit::AuraList::const_iterator itr = dAuras.begin(); itr != dAuras.end(); ++itr) + { if ((*itr)->GetModifier()->m_miscvalue == i && detectLevel < (*itr)->GetModifier()->m_amount) { detectLevel = (*itr)->GetModifier()->m_amount; } + } if (i == 6 && GetTypeId() == TYPEID_PLAYER) // special drunk detection case { @@ -13128,10 +13208,12 @@ void CharmInfo::ToggleCreatureAutocast(uint32 spellid, bool apply) } for (uint32 x = 0; x < CREATURE_MAX_SPELLS; ++x) + { if (spellid == m_charmspells[x].GetAction()) { m_charmspells[x].SetType(apply ? ACT_ENABLED : ACT_DISABLED); } + } } /** @@ -14289,10 +14371,12 @@ Aura* Unit::GetDummyAura(uint32 spell_id) const { Unit::AuraList const& mDummy = GetAurasByType(SPELL_AURA_DUMMY); for (Unit::AuraList::const_iterator itr = mDummy.begin(); itr != mDummy.end(); ++itr) + { if ((*itr)->GetId() == spell_id) { return *itr; } + } return NULL; } @@ -14808,10 +14892,12 @@ SpellAuraHolder* Unit::GetSpellAuraHolder(uint32 spellid, ObjectGuid casterGuid) { SpellAuraHolderConstBounds bounds = GetSpellAuraHolderBounds(spellid); for (SpellAuraHolderMap::const_iterator iter = bounds.first; iter != bounds.second; ++iter) + { if (iter->second->GetCasterGuid() == casterGuid) { return iter->second; } + } return NULL; } diff --git a/src/game/Object/Unit.h b/src/game/Object/Unit.h index 793692b1e..c72b35397 100644 --- a/src/game/Object/Unit.h +++ b/src/game/Object/Unit.h @@ -3622,8 +3622,14 @@ uint32 GetPower(Powers power) const { return GetUInt32Value(UNIT_FIELD_POWER1 + void ApplyResistanceBuffModsPercentMod(SpellSchools school, bool positive, float val, bool apply) { ApplyPercentModFloatValue(positive ? UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE + school : UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE + school, val, apply); } void InitStatBuffMods() { - for (int i = STAT_STRENGTH; i < MAX_STATS; ++i) SetFloatValue(UNIT_FIELD_POSSTAT0 + i, 0); - for (int i = STAT_STRENGTH; i < MAX_STATS; ++i) SetFloatValue(UNIT_FIELD_NEGSTAT0 + i, 0); + for (int i = STAT_STRENGTH; i < MAX_STATS; ++i) + { + SetFloatValue(UNIT_FIELD_POSSTAT0 + i, 0); + } + for (int i = STAT_STRENGTH; i < MAX_STATS; ++i) + { + SetFloatValue(UNIT_FIELD_NEGSTAT0 + i, 0); + } } void ApplyStatBuffMod(Stats stat, float val, bool apply) { ApplyModSignedFloatValue((val > 0 ? UNIT_FIELD_POSSTAT0 + stat : UNIT_FIELD_NEGSTAT0 + stat), val, apply); } void ApplyStatPercentBuffMod(Stats stat, float val, bool apply) @@ -4130,19 +4136,23 @@ void Unit::CallForAllControlledUnits(Func const& func, uint32 controlledMask) if (controlledMask & CONTROLLED_GUARDIANS) { for (GuidSet::const_iterator itr = m_guardianPets.begin(); itr != m_guardianPets.end();) + { if (Pet* guardian = _GetPet(*(itr++))) { func(guardian); } + } } if (controlledMask & CONTROLLED_TOTEMS) { for (int i = 0; i < MAX_TOTEM_SLOT; ++i) + { if (Unit* totem = _GetTotem(TotemSlot(i))) { func(totem); } + } } if (controlledMask & CONTROLLED_CHARM) @@ -4173,21 +4183,25 @@ bool Unit::CheckAllControlledUnits(Func const& func, uint32 controlledMask) cons if (controlledMask & CONTROLLED_GUARDIANS) { for (GuidSet::const_iterator itr = m_guardianPets.begin(); itr != m_guardianPets.end();) + { if (Pet const* guardian = _GetPet(*(itr++))) if (func(guardian)) { return true; } + } } if (controlledMask & CONTROLLED_TOTEMS) { for (int i = 0; i < MAX_TOTEM_SLOT; ++i) + { if (Unit const* totem = _GetTotem(TotemSlot(i))) if (func(totem)) { return true; } + } } if (controlledMask & CONTROLLED_CHARM) diff --git a/src/game/Object/Vehicle.cpp b/src/game/Object/Vehicle.cpp index 127c131ba..2debb0ab9 100644 --- a/src/game/Object/Vehicle.cpp +++ b/src/game/Object/Vehicle.cpp @@ -488,10 +488,12 @@ bool VehicleInfo::CanBoard(Unit* passenger) const Unit* VehicleInfo::GetPassenger(uint8 seat) const { for (PassengerMap::const_iterator itr = m_passengers.begin(); itr != m_passengers.end(); ++itr) + { if (itr->second->GetTransportSeat() == seat) { return (Unit*)itr->first; } + } return NULL; } @@ -554,10 +556,12 @@ bool VehicleInfo::GetUsableSeatFor(Unit* passenger, uint8& seat) const seat = 0; for (uint8 i = 1; seat < MAX_VEHICLE_SEAT; i <<= 1, ++seat) + { if (possibleSeats & i) { return true; } + } return false; } diff --git a/src/game/OutdoorPvP/OutdoorPvPMgr.cpp b/src/game/OutdoorPvP/OutdoorPvPMgr.cpp index bcccad608..48191c9ce 100644 --- a/src/game/OutdoorPvP/OutdoorPvPMgr.cpp +++ b/src/game/OutdoorPvP/OutdoorPvPMgr.cpp @@ -195,10 +195,12 @@ void OutdoorPvPMgr::Update(uint32 diff) } for (uint8 i = 0; i < MAX_OPVP_ID; ++i) + { if (m_scripts[i]) { m_scripts[i]->Update(m_updateTimer.GetCurrent()); } + } m_updateTimer.Reset(); } diff --git a/src/game/Server/DBCStores.cpp b/src/game/Server/DBCStores.cpp index 639e6e279..f141e44f5 100644 --- a/src/game/Server/DBCStores.cpp +++ b/src/game/Server/DBCStores.cpp @@ -211,10 +211,12 @@ bool IsAcceptableClientBuild(uint32 build) { int accepted_versions[] = EXPECTED_MANGOSD_CLIENT_BUILD; for (int i = 0; accepted_versions[i]; ++i) + { if (int(build) == accepted_versions[i]) { return true; } + } return false; } @@ -532,10 +534,12 @@ void LoadDBCStores(const std::string& dataPath) LoadDBC(availableDbcLocales, bar, bad_dbc_files, sMapDifficultyStore, dbcPath, "MapDifficulty.dbc"); // fill data for (uint32 i = 1; i < sMapDifficultyStore.GetNumRows(); ++i) + { if (MapDifficultyEntry const* entry = sMapDifficultyStore.LookupEntry(i)) { sMapDifficultyMap[MAKE_PAIR32(entry->MapId, entry->Difficulty)] = entry; } + } LoadDBC(availableDbcLocales, bar, bad_dbc_files, sMovieStore, dbcPath, "Movie.dbc"); LoadDBC(availableDbcLocales, bar, bad_dbc_files, sOverrideSpellDataStore, dbcPath, "OverrideSpellData.dbc"); @@ -545,11 +549,13 @@ void LoadDBCStores(const std::string& dataPath) LoadDBC(availableDbcLocales, bar, bad_dbc_files, sPowerDisplayStore, dbcPath, "PowerDisplay.dbc"); LoadDBC(availableDbcLocales, bar, bad_dbc_files, sPvPDifficultyStore, dbcPath, "PvpDifficulty.dbc"); for (uint32 i = 0; i < sPvPDifficultyStore.GetNumRows(); ++i) + { if (PvPDifficultyEntry const* entry = sPvPDifficultyStore.LookupEntry(i)) if (entry->bracketId > MAX_BATTLEGROUND_BRACKETS) { MANGOS_ASSERT(false && "Need update MAX_BATTLEGROUND_BRACKETS by DBC data"); } + } LoadDBC(availableDbcLocales, bar, bad_dbc_files, sRandomPropertiesPointsStore, dbcPath, "RandPropPoints.dbc"); LoadDBC(availableDbcLocales, bar, bad_dbc_files, sScalingStatDistributionStore, dbcPath, "ScalingStatDistribution.dbc"); @@ -627,10 +633,12 @@ void LoadDBCStores(const std::string& dataPath) continue; } for (int j = 0; j < MAX_TALENT_RANK; ++j) + { if (talentInfo->RankID[j]) { sTalentSpellPosMap[talentInfo->RankID[j]] = TalentSpellPos(i, j); } + } } LoadDBC(availableDbcLocales, bar, bad_dbc_files, sTalentTabStore, dbcPath, "TalentTab.dbc"); @@ -667,10 +675,12 @@ void LoadDBCStores(const std::string& dataPath) LoadDBC(availableDbcLocales, bar, bad_dbc_files, sTaxiPathStore, dbcPath, "TaxiPath.dbc"); for (uint32 i = 1; i < sTaxiPathStore.GetNumRows(); ++i) + { if (TaxiPathEntry const* entry = sTaxiPathStore.LookupEntry(i)) { sTaxiPathSetBySource[entry->from][entry->to] = TaxiPathBySourceAndDestination(entry->ID, entry->price); } + } uint32 pathCount = sTaxiPathStore.GetNumRows(); //## TaxiPathNode.dbc ## Loaded only for initialization different structures @@ -679,6 +689,7 @@ void LoadDBCStores(const std::string& dataPath) std::vector pathLength; pathLength.resize(pathCount); // 0 and some other indexes not used for (uint32 i = 1; i < sTaxiPathNodeStore.GetNumRows(); ++i) + { if (TaxiPathNodeEntry const* entry = sTaxiPathNodeStore.LookupEntry(i)) { if (pathLength[entry->path] < entry->index + 1) @@ -686,6 +697,7 @@ void LoadDBCStores(const std::string& dataPath) pathLength[entry->path] = entry->index + 1; } } + } // Set path length sTaxiPathNodesByPath.resize(pathCount); // 0 and some other indexes not used for (uint32 i = 1; i < sTaxiPathNodesByPath.size(); ++i) @@ -694,22 +706,28 @@ void LoadDBCStores(const std::string& dataPath) } // fill data (pointers to sTaxiPathNodeStore elements for (uint32 i = 1; i < sTaxiPathNodeStore.GetNumRows(); ++i) + { if (TaxiPathNodeEntry const* entry = sTaxiPathNodeStore.LookupEntry(i)) { sTaxiPathNodesByPath[entry->path].set(entry->index, entry); } + } // Initialize global taxinodes mask // include existing nodes that have at least single not spell base (scripted) path { std::set spellPaths; for (uint32 i = 1; i < sSpellStore.GetNumRows(); ++i) + { if (SpellEntry const* sInfo = sSpellStore.LookupEntry(i)) for (int j = 0; j < MAX_EFFECT_INDEX; ++j) + { if (sInfo->Effect[j] == 123 /*SPELL_EFFECT_SEND_TAXI*/) { spellPaths.insert(sInfo->EffectMiscValue[j]); } + } + } memset(sTaxiNodesMask, 0, sizeof(sTaxiNodesMask)); memset(sOldContinentsNodesMask, 0, sizeof(sTaxiNodesMask)); diff --git a/src/game/Server/DBCStructure.h b/src/game/Server/DBCStructure.h index 1a27e1f35..5d1786520 100644 --- a/src/game/Server/DBCStructure.h +++ b/src/game/Server/DBCStructure.h @@ -1030,15 +1030,19 @@ struct FactionTemplateEntry if (entry.faction) { for (int i = 0; i < 4; ++i) + { if (enemyFaction[i] == entry.faction) { return false; } + } for (int i = 0; i < 4; ++i) + { if (friendFaction[i] == entry.faction) { return true; } + } } return (friendlyMask & entry.ourMask) || (ourMask & entry.friendlyMask); } @@ -1047,15 +1051,19 @@ struct FactionTemplateEntry if (entry.faction) { for (int i = 0; i < 4; ++i) + { if (enemyFaction[i] == entry.faction) { return true; } + } for (int i = 0; i < 4; ++i) + { if (friendFaction[i] == entry.faction) { return false; } + } } return (hostileMask & entry.ourMask) != 0; } @@ -1063,10 +1071,12 @@ struct FactionTemplateEntry bool IsNeutralToAll() const { for (int i = 0; i < 4; ++i) + { if (enemyFaction[i] != 0) { return false; } + } return hostileMask == 0 && friendlyMask == 0; } bool IsContestedGuardFaction() const { return (factionFlags & FACTION_TEMPLATE_FLAG_CONTESTED_GUARD) != 0; } diff --git a/src/game/Server/SharedDefines.h b/src/game/Server/SharedDefines.h index d9ab120aa..1b8a064b3 100644 --- a/src/game/Server/SharedDefines.h +++ b/src/game/Server/SharedDefines.h @@ -229,10 +229,12 @@ enum SpellSchoolMask inline SpellSchools GetFirstSchoolInMask(SpellSchoolMask mask) { for (int i = 0; i < MAX_SPELL_SCHOOL; ++i) + { if (mask & (1 << i)) { return SpellSchools(i); } + } return SPELL_SCHOOL_NORMAL; } diff --git a/src/game/Server/WorldSession.cpp b/src/game/Server/WorldSession.cpp index 94c016357..7a2c34a9c 100644 --- a/src/game/Server/WorldSession.cpp +++ b/src/game/Server/WorldSession.cpp @@ -825,10 +825,12 @@ void WorldSession::LoadGlobalAccountData() void WorldSession::LoadAccountData(QueryResult* result, uint32 mask) { for (uint32 i = 0; i < NUM_ACCOUNT_DATA_TYPES; ++i) + { if (mask & (1 << i)) { m_accountData[i] = AccountData(); } + } if (!result) { diff --git a/src/game/Tools/PlayerDump.cpp b/src/game/Tools/PlayerDump.cpp index 36a8a1f46..7185bc3bb 100644 --- a/src/game/Tools/PlayerDump.cpp +++ b/src/game/Tools/PlayerDump.cpp @@ -120,10 +120,13 @@ static bool findtoknth(std::string& str, int n, std::string::size_type& s, std:: { int i; s = e = 0; std::string::size_type size = str.size(); - for (i = 1; s < size && i < n; ++s) if (str[s] == ' ') + for (i = 1; s < size && i < n; ++s) + { + if (str[s] == ' ') { ++i; } + } if (i < n) { return false; @@ -1086,10 +1089,12 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s ROLLBACK(DUMP_FILE_BROKEN); // character_equipmentsets.setguid } for (int i = 0; i < 19; ++i) // character_equipmentsets.item0..item18 + { if (!changeGuid(line, 6 + i, items, sObjectMgr.m_ItemGuids.GetNextAfterMaxUsed())) { ROLLBACK(DUMP_FILE_BROKEN); } + } break; } default: diff --git a/src/game/WorldHandlers/AchievementMgr.cpp b/src/game/WorldHandlers/AchievementMgr.cpp index c8d10c6c2..324f43205 100644 --- a/src/game/WorldHandlers/AchievementMgr.cpp +++ b/src/game/WorldHandlers/AchievementMgr.cpp @@ -412,10 +412,12 @@ bool AchievementCriteriaRequirement::Meets(uint32 criteria_id, Player const* sou bool AchievementCriteriaRequirementSet::Meets(Player const* source, Unit const* target, uint32 miscvalue /*= 0*/) const { for (Storage::const_iterator itr = storage.begin(); itr != storage.end(); ++itr) + { if (!itr->Meets(criteria_id, source, target, miscvalue)) { return false; } + } return true; } @@ -1121,10 +1123,12 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui { uint32 counter = 0; for (QuestStatusMap::const_iterator itr = GetPlayer()->getQuestStatusMap().begin(); itr != GetPlayer()->getQuestStatusMap().end(); ++itr) + { if (itr->second.m_rewarded) { ++counter; } + } change = counter; progressType = PROGRESS_HIGHEST; break; @@ -2426,10 +2430,12 @@ void AchievementMgr::SetCriteriaProgress(AchievementCriteriaEntry const* criteri if (AchievementEntryList const* achRefList = sAchievementMgr.GetAchievementByReferencedId(achievement->ID)) { for (AchievementEntryList::const_iterator itr = achRefList->begin(); itr != achRefList->end(); ++itr) + { if (IsCompletedAchievement(*itr)) { CompletedAchievement(*itr); } + } } } // update dependent achievements state at criteria incomplete @@ -2450,11 +2456,13 @@ void AchievementMgr::SetCriteriaProgress(AchievementCriteriaEntry const* criteri if (AchievementEntryList const* achRefList = sAchievementMgr.GetAchievementByReferencedId(achievement->ID)) for (AchievementEntryList::const_iterator itr = achRefList->begin(); itr != achRefList->end(); ++itr) + { if (HasAchievement((*itr)->ID)) if (!IsCompletedAchievement(*itr)) { IncompletedAchievement(*itr); } + } } } @@ -2649,10 +2657,12 @@ AchievementReward const* AchievementGlobalMgr::GetAchievementReward(AchievementE { AchievementRewardsMapBounds bounds = m_achievementRewards.equal_range(achievement->ID); for (AchievementRewardsMap::const_iterator iter = bounds.first; iter != bounds.second; ++iter) + { if (iter->second.gender == GENDER_NONE || uint8(iter->second.gender) == gender) { return &iter->second; } + } return NULL; } @@ -2661,10 +2671,12 @@ AchievementRewardLocale const* AchievementGlobalMgr::GetAchievementRewardLocale( { AchievementRewardLocalesMapBounds bounds = m_achievementRewardLocales.equal_range(achievement->ID); for (AchievementRewardLocalesMap::const_iterator iter = bounds.first; iter != bounds.second; ++iter) + { if (iter->second.gender == GENDER_NONE || uint8(iter->second.gender) == gender) { return &iter->second; } + } return NULL; } diff --git a/src/game/WorldHandlers/CalendarHandler.cpp b/src/game/WorldHandlers/CalendarHandler.cpp index 85ed0a8ca..4af96d28d 100644 --- a/src/game/WorldHandlers/CalendarHandler.cpp +++ b/src/game/WorldHandlers/CalendarHandler.cpp @@ -1103,11 +1103,13 @@ void CalendarMgr::SendPacketToAllEventRelatives(WorldPacket packet, CalendarEven // Send packet to all invitees if event is non-guild, in other case only to non-guild invitees (packet was broadcasted for them) CalendarInviteMap const* cInvMap = event->GetInviteMap(); for (CalendarInviteMap::const_iterator itr = cInvMap->begin(); itr != cInvMap->end(); ++itr) + { if (Player* player = sObjectMgr.GetPlayer(itr->second->InviteeGuid)) if (!event->IsGuildEvent() || (event->IsGuildEvent() && player->GetGuildId() != event->GuildId)) { player->SendDirectMessage(&packet); } + } } void CalendarMgr::SendCalendarRaidLockoutRemove(Player* player, DungeonPersistentState const* save) diff --git a/src/game/WorldHandlers/CreatureLinkingMgr.cpp b/src/game/WorldHandlers/CreatureLinkingMgr.cpp index e73ccca72..76a7d2402 100644 --- a/src/game/WorldHandlers/CreatureLinkingMgr.cpp +++ b/src/game/WorldHandlers/CreatureLinkingMgr.cpp @@ -442,10 +442,12 @@ void CreatureLinkingHolder::AddMasterToHolder(Creature* pCreature) // Check, if already stored BossGuidMapBounds bounds = m_masterGuid.equal_range(pCreature->GetEntry()); for (BossGuidMap::const_iterator itr = bounds.first; itr != bounds.second; ++itr) + { if (itr->second == pCreature->GetObjectGuid()) { return; // Already added } + } m_masterGuid.insert(BossGuidMap::value_type(pCreature->GetEntry(), pCreature->GetObjectGuid())); } diff --git a/src/game/WorldHandlers/GameEventMgr.cpp b/src/game/WorldHandlers/GameEventMgr.cpp index 8b231cef6..3dafa64cb 100644 --- a/src/game/WorldHandlers/GameEventMgr.cpp +++ b/src/game/WorldHandlers/GameEventMgr.cpp @@ -704,10 +704,12 @@ void GameEventMgr::Initialize(MapPersistentState* state) // At map persistent state creating need only apply pool spawn modifications // other data is global and will be auto-apply for (GameEventMgr::ActiveEvents::const_iterator event_itr = m_ActiveEvents.begin(); event_itr != m_ActiveEvents.end(); ++event_itr) + { for (IdList::iterator pool_itr = mGameEventSpawnPoolIds[*event_itr].begin(); pool_itr != mGameEventSpawnPoolIds[*event_itr].end(); ++pool_itr) { sPoolMgr.InitSpawnPool(*state, *pool_itr); } + } } // return the next event delay in ms @@ -1010,10 +1012,12 @@ GameEventCreatureData const* GameEventMgr::GetCreatureUpdateDataForActiveEvent(u } for (GameEventCreatureDataList::const_iterator itr = mGameEventCreatureData[event_id].begin(); itr != mGameEventCreatureData[event_id].end(); ++itr) + { if (itr->first == lowguid) { return &itr->second; } + } return NULL; } @@ -1150,11 +1154,15 @@ template <> int16 GameEventMgr::GetGameEventId(uint32 guid_or_poolid) { for (uint16 i = 0; i < mGameEventCreatureGuids.size(); ++i) // 0 <= i <= 2*(S := mGameEvent.size()) - 2 + { for (GuidList::const_iterator itr = mGameEventCreatureGuids[i].begin(); itr != mGameEventCreatureGuids[i].end(); ++itr) + { if (*itr == guid_or_poolid) { return i + 1 - mGameEvent.size(); // -S *1 + 1 <= . <= 1*S - 1 } + } + } return 0; } @@ -1169,11 +1177,15 @@ template <> int16 GameEventMgr::GetGameEventId(uint32 guid_or_poolid) { for (uint16 i = 0; i < mGameEventGameobjectGuids.size(); ++i) + { for (GuidList::const_iterator itr = mGameEventGameobjectGuids[i].begin(); itr != mGameEventGameobjectGuids[i].end(); ++itr) + { if (*itr == guid_or_poolid) { return i + 1 - mGameEvent.size(); // -S *1 + 1 <= . <= 1*S - 1 } + } + } return 0; } @@ -1188,11 +1200,15 @@ template <> int16 GameEventMgr::GetGameEventId(uint32 guid_or_poolid) { for (uint16 i = 0; i < mGameEventSpawnPoolIds.size(); ++i) + { for (IdList::const_iterator itr = mGameEventSpawnPoolIds[i].begin(); itr != mGameEventSpawnPoolIds[i].end(); ++itr) + { if (*itr == guid_or_poolid) { return i; } + } + } return 0; } @@ -1215,10 +1231,12 @@ bool GameEventMgr::IsActiveHoliday(HolidayIds id) } for (GameEventMgr::ActiveEvents::const_iterator itr = m_ActiveEvents.begin(); itr != m_ActiveEvents.end(); ++itr) + { if (mGameEvent[*itr].holiday_id == id) { return true; } + } return false; } diff --git a/src/game/WorldHandlers/GridMap.cpp b/src/game/WorldHandlers/GridMap.cpp index 91fc950c3..bb493168c 100644 --- a/src/game/WorldHandlers/GridMap.cpp +++ b/src/game/WorldHandlers/GridMap.cpp @@ -964,10 +964,12 @@ TerrainInfo::TerrainInfo(uint32 mapid) : m_mapId(mapid), m_refMutex(), m_mutex() TerrainInfo::~TerrainInfo() { for (int k = 0; k < MAX_NUMBER_OF_GRIDS; ++k) + { for (int i = 0; i < MAX_NUMBER_OF_GRIDS; ++i) { delete m_GridMaps[i][k]; } + } VMAP::VMapFactory::createOrGetVMapManager()->unloadMap(m_mapId); MMAP::MMapFactory::createOrGetMMapManager()->unloadMap(m_mapId); diff --git a/src/game/WorldHandlers/GridNotifiers.h b/src/game/WorldHandlers/GridNotifiers.h index 394c99b93..6cb82b86a 100644 --- a/src/game/WorldHandlers/GridNotifiers.h +++ b/src/game/WorldHandlers/GridNotifiers.h @@ -277,45 +277,55 @@ namespace MaNGOS void Visit(GameObjectMapType& m) { for (GameObjectMapType::iterator itr = m.begin(); itr != m.end(); ++itr) + { if (itr->getSource()->InSamePhase(i_phaseMask)) { i_do(itr->getSource()); } + } } void Visit(PlayerMapType& m) { for (PlayerMapType::iterator itr = m.begin(); itr != m.end(); ++itr) + { if (itr->getSource()->InSamePhase(i_phaseMask)) { i_do(itr->getSource()); } + } } void Visit(CreatureMapType& m) { for (CreatureMapType::iterator itr = m.begin(); itr != m.end(); ++itr) + { if (itr->getSource()->InSamePhase(i_phaseMask)) { i_do(itr->getSource()); } + } } void Visit(CorpseMapType& m) { for (CorpseMapType::iterator itr = m.begin(); itr != m.end(); ++itr) + { if (itr->getSource()->InSamePhase(i_phaseMask)) { i_do(itr->getSource()); } + } } void Visit(DynamicObjectMapType& m) { for (DynamicObjectMapType::iterator itr = m.begin(); itr != m.end(); ++itr) + { if (itr->getSource()->InSamePhase(i_phaseMask)) { i_do(itr->getSource()); } + } } template void Visit(GridRefManager&) {} @@ -482,10 +492,12 @@ namespace MaNGOS void Visit(CreatureMapType& m) { for (CreatureMapType::iterator itr = m.begin(); itr != m.end(); ++itr) + { if (itr->getSource()->InSamePhase(i_phaseMask)) { i_do(itr->getSource()); } + } } template void Visit(GridRefManager&) {} @@ -535,10 +547,12 @@ namespace MaNGOS void Visit(PlayerMapType& m) { for (PlayerMapType::iterator itr = m.begin(); itr != m.end(); ++itr) + { if (itr->getSource()->InSamePhase(i_phaseMask)) { i_do(itr->getSource()); } + } } template void Visit(GridRefManager&) {} @@ -1357,10 +1371,12 @@ namespace MaNGOS ~LocalizedPacketListDo() { for (size_t i = 0; i < i_data_cache.size(); ++i) + { for (size_t j = 0; j < i_data_cache[i].size(); ++j) { delete i_data_cache[i][j]; } + } } void operator()(Player* p); diff --git a/src/game/WorldHandlers/GridNotifiersImpl.h b/src/game/WorldHandlers/GridNotifiersImpl.h index 9053957da..2552464f5 100644 --- a/src/game/WorldHandlers/GridNotifiersImpl.h +++ b/src/game/WorldHandlers/GridNotifiersImpl.h @@ -471,55 +471,65 @@ template void MaNGOS::WorldObjectListSearcher::Visit(PlayerMapType& m) { for (PlayerMapType::iterator itr = m.begin(); itr != m.end(); ++itr) + { if (itr->getSource()->InSamePhase(i_phaseMask)) if (i_check(itr->getSource())) { i_objects.push_back(itr->getSource()); } + } } template void MaNGOS::WorldObjectListSearcher::Visit(CreatureMapType& m) { for (CreatureMapType::iterator itr = m.begin(); itr != m.end(); ++itr) + { if (itr->getSource()->InSamePhase(i_phaseMask)) if (i_check(itr->getSource())) { i_objects.push_back(itr->getSource()); } + } } template void MaNGOS::WorldObjectListSearcher::Visit(CorpseMapType& m) { for (CorpseMapType::iterator itr = m.begin(); itr != m.end(); ++itr) + { if (itr->getSource()->InSamePhase(i_phaseMask)) if (i_check(itr->getSource())) { i_objects.push_back(itr->getSource()); } + } } template void MaNGOS::WorldObjectListSearcher::Visit(GameObjectMapType& m) { for (GameObjectMapType::iterator itr = m.begin(); itr != m.end(); ++itr) + { if (itr->getSource()->InSamePhase(i_phaseMask)) if (i_check(itr->getSource())) { i_objects.push_back(itr->getSource()); } + } } template void MaNGOS::WorldObjectListSearcher::Visit(DynamicObjectMapType& m) { for (DynamicObjectMapType::iterator itr = m.begin(); itr != m.end(); ++itr) + { if (itr->getSource()->InSamePhase(i_phaseMask)) if (i_check(itr->getSource())) { i_objects.push_back(itr->getSource()); } + } } // Gameobject searchers @@ -569,11 +579,13 @@ template void MaNGOS::GameObjectListSearcher::Visit(GameObjectMapType& m) { for (GameObjectMapType::iterator itr = m.begin(); itr != m.end(); ++itr) + { if (itr->getSource()->InSamePhase(i_phaseMask)) if (i_check(itr->getSource())) { i_objects.push_back(itr->getSource()); } + } } // Unit searchers @@ -664,22 +676,26 @@ template void MaNGOS::UnitListSearcher::Visit(PlayerMapType& m) { for (PlayerMapType::iterator itr = m.begin(); itr != m.end(); ++itr) + { if (itr->getSource()->InSamePhase(i_phaseMask)) if (i_check(itr->getSource())) { i_objects.push_back(itr->getSource()); } + } } template void MaNGOS::UnitListSearcher::Visit(CreatureMapType& m) { for (CreatureMapType::iterator itr = m.begin(); itr != m.end(); ++itr) + { if (itr->getSource()->InSamePhase(i_phaseMask)) if (i_check(itr->getSource())) { i_objects.push_back(itr->getSource()); } + } } // Creature searchers @@ -729,11 +745,13 @@ template void MaNGOS::CreatureListSearcher::Visit(CreatureMapType& m) { for (CreatureMapType::iterator itr = m.begin(); itr != m.end(); ++itr) + { if (itr->getSource()->InSamePhase(i_phaseMask)) if (i_check(itr->getSource())) { i_objects.push_back(itr->getSource()); } + } } template @@ -764,11 +782,13 @@ template void MaNGOS::PlayerListSearcher::Visit(PlayerMapType& m) { for (PlayerMapType::iterator itr = m.begin(); itr != m.end(); ++itr) + { if (itr->getSource()->InSamePhase(i_phaseMask)) if (i_check(itr->getSource())) { i_objects.push_back(itr->getSource()); } + } } template diff --git a/src/game/WorldHandlers/Group.cpp b/src/game/WorldHandlers/Group.cpp index 9b4303f56..2c156cf8f 100644 --- a/src/game/WorldHandlers/Group.cpp +++ b/src/game/WorldHandlers/Group.cpp @@ -336,10 +336,12 @@ void Group::ConvertToRaid() // update quest related GO states (quest activity dependent from raid membership) for (member_citerator citr = m_memberSlots.begin(); citr != m_memberSlots.end(); ++citr) + { if (Player* player = sObjectMgr.GetPlayer(citr->guid)) { player->UpdateForQuestWorldObjects(); } + } } /** @@ -435,10 +437,12 @@ void Group::RemoveAllInvites() Player* Group::GetInvited(ObjectGuid guid) const { for (InvitesList::const_iterator itr = m_invitees.begin(); itr != m_invitees.end(); ++itr) + { if ((*itr)->GetObjectGuid() == guid) { return (*itr); } + } return NULL; } @@ -989,10 +993,12 @@ bool Group::CountRollVote(Player* player, ObjectGuid const& lootedTarget, uint32 { Rolls::iterator rollI = RollId.begin(); for (; rollI != RollId.end(); ++rollI) + { if ((*rollI)->isValid() && (*rollI)->lootedTargetGUID == lootedTarget && (*rollI)->itemSlot == itemSlot) { break; } + } if (rollI == RollId.end()) { @@ -1322,10 +1328,12 @@ void Group::SetTargetIcon(uint8 id, ObjectGuid whoGuid, ObjectGuid targetGuid) // clean other icons if (targetGuid) for (int i = 0; i < TARGET_ICON_COUNT; ++i) + { if (m_targetIcons[i] == targetGuid) { SetTargetIcon(i, ObjectGuid(), ObjectGuid()); } + } m_targetIcons[id] = targetGuid; @@ -1515,11 +1523,13 @@ void Group::UpdatePlayerOutOfRange(Player* pPlayer) pPlayer->GetSession()->BuildPartyMemberStatsChangedPacket(pPlayer, &data); for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next()) + { if (Player* player = itr->getSource()) if (player != pPlayer && !player->HaveAtClient(pPlayer)) { player->GetSession()->SendPacket(&data); } + } } /** diff --git a/src/game/WorldHandlers/Group.h b/src/game/WorldHandlers/Group.h index 25fe63284..d75b2148e 100644 --- a/src/game/WorldHandlers/Group.h +++ b/src/game/WorldHandlers/Group.h @@ -351,10 +351,12 @@ class Group ObjectGuid GetMemberGuid(const std::string& name) { for (member_citerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr) + { if (itr->name == name) { return itr->guid; } + } return ObjectGuid(); } @@ -535,10 +537,12 @@ class Group member_citerator _getMemberCSlot(ObjectGuid guid) const { for (member_citerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr) + { if (itr->guid == guid) { return itr; } + } return m_memberSlots.end(); } @@ -546,10 +550,12 @@ class Group member_witerator _getMemberWSlot(ObjectGuid guid) { for (member_witerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr) + { if (itr->guid == guid) { return itr; } + } return m_memberSlots.end(); } diff --git a/src/game/WorldHandlers/GroupHandler.cpp b/src/game/WorldHandlers/GroupHandler.cpp index 151ff94e1..9324be48b 100644 --- a/src/game/WorldHandlers/GroupHandler.cpp +++ b/src/game/WorldHandlers/GroupHandler.cpp @@ -916,10 +916,12 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player* player, WorldPacke uint32 byteCount = 0; for (int i = 1; i < GROUP_UPDATE_FLAGS_COUNT; ++i) + { if (mask & (1 << i)) { byteCount += GroupUpdateLength[i]; } + } data->Initialize(SMSG_PARTY_MEMBER_STATS, 8 + 4 + byteCount); *data << player->GetPackGUID(); diff --git a/src/game/WorldHandlers/GuildMgr.cpp b/src/game/WorldHandlers/GuildMgr.cpp index f82256375..6ec324985 100644 --- a/src/game/WorldHandlers/GuildMgr.cpp +++ b/src/game/WorldHandlers/GuildMgr.cpp @@ -134,10 +134,12 @@ Guild* GuildMgr::GetGuildByName(std::string const& name) const { std::lock_guard guard(m_GuildMapLock); for (GuildMap::const_iterator itr = m_GuildMap.begin(); itr != m_GuildMap.end(); ++itr) + { if (itr->second->GetName() == name) { return itr->second; } + } return NULL; } @@ -154,10 +156,12 @@ Guild* GuildMgr::GetGuildByLeader(ObjectGuid const& guid) const { std::lock_guard guard(m_GuildMapLock); for (GuildMap::const_iterator itr = m_GuildMap.begin(); itr != m_GuildMap.end(); ++itr) + { if (itr->second->GetLeaderGuid() == guid) { return itr->second; } + } return NULL; } diff --git a/src/game/WorldHandlers/ItemHandler.cpp b/src/game/WorldHandlers/ItemHandler.cpp index 0da768487..0cd5907b5 100644 --- a/src/game/WorldHandlers/ItemHandler.cpp +++ b/src/game/WorldHandlers/ItemHandler.cpp @@ -1481,10 +1481,12 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data) } for (int j = i + 1; j < MAX_GEM_SOCKETS; ++j) + { if (gemGuids[j] == gemGuid) { return; } + } } Item* itemTarget = _player->GetItemByGuid(itemGuid); diff --git a/src/game/WorldHandlers/Map.cpp b/src/game/WorldHandlers/Map.cpp index d6015c45d..c08149fc9 100644 --- a/src/game/WorldHandlers/Map.cpp +++ b/src/game/WorldHandlers/Map.cpp @@ -1468,10 +1468,12 @@ void Map::SendRemoveTransports(Player* player) // except used transport for (MapManager::TransportSet::const_iterator i = tset.begin(); i != tset.end(); ++i) + { if ((*i) != player->GetTransport() && (*i)->GetMapId() != i_id) { (*i)->BuildOutOfRangeUpdateBlock(&transData); } + } WorldPacket packet; transData.BuildPacket(&packet); @@ -1582,10 +1584,12 @@ uint32 Map::GetPlayersCountExceptGMs() const { uint32 count = 0; for (MapRefManager::const_iterator itr = m_mapRefManager.begin(); itr != m_mapRefManager.end(); ++itr) + { if (!itr->getSource()->isGameMaster()) { ++count; } + } return count; } @@ -2771,10 +2775,12 @@ void Map::PlayDirectSoundToMap(uint32 soundId, uint32 zoneId /*=0*/) const Map::PlayerList const& pList = GetPlayers(); for (PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr) + { if (!zoneId || itr->getSource()->GetZoneId() == zoneId) { itr->getSource()->SendDirectMessage(&data); } + } } /** diff --git a/src/game/WorldHandlers/MapPersistentStateMgr.cpp b/src/game/WorldHandlers/MapPersistentStateMgr.cpp index 36bc860b0..5b1ffc31f 100644 --- a/src/game/WorldHandlers/MapPersistentStateMgr.cpp +++ b/src/game/WorldHandlers/MapPersistentStateMgr.cpp @@ -549,10 +549,12 @@ void DungeonResetScheduler::LoadResetTimes() // schedule the reset times for (InstResetTimeMapDiffType::iterator itr = instResetTime.begin(); itr != instResetTime.end(); ++itr) + { if (itr->second.second > now) { ScheduleReset(true, itr->second.second, DungeonResetEvent(RESET_EVENT_NORMAL_DUNGEON, PAIR32_LOPART(itr->second.first), Difficulty(PAIR32_HIPART(itr->second.first)), itr->first)); } + } } // load the global respawn times for raid/heroic instances @@ -639,10 +641,12 @@ void DungeonResetScheduler::LoadResetTimes() // schedule the global reset/warning ResetEventType type = RESET_EVENT_INFORM_1; for (; type < RESET_EVENT_INFORM_LAST; type = ResetEventType(type + 1)) + { if (t > time_t(now + resetEventTypeDelay[type])) { break; } + } ScheduleReset(true, t - resetEventTypeDelay[type], DungeonResetEvent(type, mapid, difficulty, 0)); } @@ -737,10 +741,12 @@ void DungeonResetScheduler::Update() ResetEventType type = RESET_EVENT_INFORM_1; for (; type < RESET_EVENT_INFORM_LAST; type = ResetEventType(type + 1)) + { if (next_reset > time_t(now + resetEventTypeDelay[type])) { break; } + } // add new scheduler event to the queue event.type = type; @@ -1177,10 +1183,12 @@ void MapPersistentStateManager::_ResetOrWarnAll(uint32 mapid, Difficulty difficu // remove all binds for online player for (PersistentStateMap::iterator itr = m_instanceSaveByInstanceId.begin(); itr != m_instanceSaveByInstanceId.end(); ++itr) + { if (itr->second->GetMapId() == mapid && itr->second->GetDifficulty() == difficulty) { ((DungeonPersistentState*)(itr->second))->UnbindThisState(); } + } // reset maps, teleport player automaticaly to their homebinds and unload maps MapPersistantStateResetWorker worker; @@ -1250,11 +1258,13 @@ void MapPersistentStateManager::InitWorldMaps() { MapPersistentState* state = NULL; // need any from created for shared pool state for (uint32 mapid = 0; mapid < sMapStore.GetNumRows(); ++mapid) + { if (MapEntry const* entry = sMapStore.LookupEntry(mapid)) if (!entry->Instanceable()) { state = AddPersistentState(entry, 0, REGULAR_DIFFICULTY, 0, false, true, false); } + } if (state) { diff --git a/src/game/WorldHandlers/PoolManager.cpp b/src/game/WorldHandlers/PoolManager.cpp index f1acf031d..2d1d4bc85 100644 --- a/src/game/WorldHandlers/PoolManager.cpp +++ b/src/game/WorldHandlers/PoolManager.cpp @@ -1338,10 +1338,12 @@ void PoolManager::Initialize(MapPersistentState* state) { // spawn pools for expected map or for not initialized shared pools state for non-instanceable maps for (uint16 pool_entry = 0; pool_entry < mPoolTemplate.size(); ++pool_entry) + { if (mPoolTemplate[pool_entry].AutoSpawn) { InitSpawnPool(*state, pool_entry); } + } } // Call to spawn a pool, if cache if true the method will spawn only if cached entry is different diff --git a/src/game/WorldHandlers/ScriptMgr.cpp b/src/game/WorldHandlers/ScriptMgr.cpp index 8714624e9..3cca8291b 100644 --- a/src/game/WorldHandlers/ScriptMgr.cpp +++ b/src/game/WorldHandlers/ScriptMgr.cpp @@ -1011,10 +1011,12 @@ void ScriptMgr::LoadDbScriptStrings() std::set ids; for (int32 i = MIN_DB_SCRIPT_STRING_ID; i < MAX_DB_SCRIPT_STRING_ID; ++i) + { if (sObjectMgr.GetMangosStringLocale(i)) { ids.insert(i); } + } CheckScriptTexts(ids); sWaypointMgr.CheckTextsExistance(ids); diff --git a/src/game/WorldHandlers/SkillDiscovery.cpp b/src/game/WorldHandlers/SkillDiscovery.cpp index d143c6fa4..a2a4ed60e 100644 --- a/src/game/WorldHandlers/SkillDiscovery.cpp +++ b/src/game/WorldHandlers/SkillDiscovery.cpp @@ -191,11 +191,13 @@ uint32 GetExplicitDiscoverySpell(uint32 spellId, Player* player) float full_chance = 0; 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; } + } float rate = full_chance / 100.0f; float roll = rand_chance_f() * rate; // roll now in range 0..full_chance diff --git a/src/game/WorldHandlers/Spell.cpp b/src/game/WorldHandlers/Spell.cpp index 3780a5f40..07fe27003 100644 --- a/src/game/WorldHandlers/Spell.cpp +++ b/src/game/WorldHandlers/Spell.cpp @@ -1032,10 +1032,12 @@ void Spell::prepareDataForTriggerSystem() // avoid triggering negative hit for only positive targets m_negativeEffectMask = 0x0; for (int i = 0; i < MAX_EFFECT_INDEX; ++i) + { if (!IsPositiveEffect(m_spellInfo, SpellEffectIndex(i))) { m_negativeEffectMask |= (1 << i); } + } // Hunter traps spells (for Entrapment trigger) // Gives your Immolation Trap, Frost Trap, Explosive Trap, and Snake Trap .... diff --git a/src/game/WorldHandlers/SpellAuras.cpp b/src/game/WorldHandlers/SpellAuras.cpp index 07549ae14..e35c079a8 100644 --- a/src/game/WorldHandlers/SpellAuras.cpp +++ b/src/game/WorldHandlers/SpellAuras.cpp @@ -603,10 +603,12 @@ Aura* CreateAura(SpellEntry const* spellproto, SpellEffectIndex eff, int32* curr if (SpellEntry const* triggeredSpellInfo = sSpellStore.LookupEntry(triggeredSpellId)) for (int i = 0; i < MAX_EFFECT_INDEX; ++i) + { if (triggeredSpellInfo->EffectImplicitTargetA[i] == TARGET_SINGLE_ENEMY) { return new SingleEnemyTargetAura(spellproto, eff, currentBasePoints, holder, target, caster, castItem); } + } return new Aura(spellproto, eff, currentBasePoints, holder, target, caster, castItem); } @@ -1218,11 +1220,13 @@ void Aura::ReapplyAffectedPassiveAuras() // re-apply talents/passives/area auras applied to group members (it affected by player spellmods) if (Group* group = ((Player*)GetTarget())->GetGroup()) for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) + { if (Player* member = itr->getSource()) if (member != GetTarget() && member->IsInMap(GetTarget())) { ReapplyAffectedPassiveAuras(member, false); } + } } /*********************************************************/ @@ -1431,10 +1435,12 @@ void Aura::TriggerSpell() Cell::VisitGridObjects(triggerTarget, searcher, 15.0f); for (std::list::const_iterator itr = lList.begin(); itr != lList.end(); ++itr) + { if ((*itr)->IsAlive()) { (*itr)->AddThreat(triggerTarget, float(5000)); } + } return; } @@ -4208,10 +4214,12 @@ void Aura::HandleAuraModShapeshift(bool apply, bool Real) // serverside just needs to register the new spells so that player isn't kicked as cheater if (target->GetTypeId() == TYPEID_PLAYER) for (uint32 i = 0; i < 8; ++i) + { if (ssEntry->spellId[i]) { ((Player*)target)->addSpell(ssEntry->spellId[i], true, false, false, false); } + } } else { @@ -4252,10 +4260,12 @@ void Aura::HandleAuraModShapeshift(bool apply, bool Real) // look at the comment in apply-part if (target->GetTypeId() == TYPEID_PLAYER) for (uint32 i = 0; i < 8; ++i) + { if (ssEntry->spellId[i]) { ((Player*)target)->removeSpell(ssEntry->spellId[i], false, false, false); } + } } // adding/removing linked auras @@ -5819,12 +5829,14 @@ void Aura::HandleAuraModSilence(bool apply, bool Real) target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED); // Stop cast only spells vs PreventionType == SPELL_PREVENTION_TYPE_SILENCE for (uint32 i = CURRENT_MELEE_SPELL; i < CURRENT_MAX_SPELL; ++i) + { if (Spell* spell = target->GetCurrentSpell(CurrentSpellTypes(i))) if (spell->m_spellInfo->PreventionType == SPELL_PREVENTION_TYPE_SILENCE) // Stop spells on prepare or casting state { target->InterruptSpell(CurrentSpellTypes(i), false); } + } } else { @@ -5882,10 +5894,12 @@ void Aura::HandleModThreat(bool apply, bool Real) if (target->GetTypeId() == TYPEID_PLAYER) for (int8 x = 0; x < MAX_SPELL_SCHOOL; ++x) + { if (m_modifier.m_miscvalue & int32(1 << x)) { ApplyPercentModFloatVar(target->m_threatModifier[x], float(m_modifier.m_amount), apply); } + } } /** @@ -7079,10 +7093,12 @@ void Aura::HandleModBaseResistance(bool apply, bool /*Real*/) else { for (int i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i) + { if (m_modifier.m_miscvalue & (1 << i)) { GetTarget()->HandleStatModifier(UnitMods(UNIT_MOD_RESISTANCE_START + i), TOTAL_VALUE, float(m_modifier.m_amount), apply); } + } } } @@ -7674,10 +7690,12 @@ void Aura::HandleAuraModCritPercent(bool apply, bool Real) if (Real) { for (int i = 0; i < MAX_ATTACK; ++i) + { if (Item* pItem = ((Player*)target)->GetWeaponForAttack(WeaponAttackType(i), true, false)) { ((Player*)target)->_ApplyWeaponDependentAuraCritMod(pItem, WeaponAttackType(i), this, apply); } + } } // mods must be applied base at equipped weapon class and subclass comparison @@ -7780,10 +7798,12 @@ void Aura::HandleModSpellCritChanceShool(bool /*apply*/, bool Real) } for (int school = SPELL_SCHOOL_NORMAL; school < MAX_SPELL_SCHOOL; ++school) + { if (m_modifier.m_miscvalue & (1 << school)) { ((Player*)GetTarget())->UpdateSpellCritChance(school); } + } } /********************************/ @@ -7971,10 +7991,12 @@ void Aura::HandleModDamageDone(bool apply, bool Real) if (Real && target->GetTypeId() == TYPEID_PLAYER) { for (int i = 0; i < MAX_ATTACK; ++i) + { if (Item* pItem = ((Player*)target)->GetWeaponForAttack(WeaponAttackType(i), true, false)) { ((Player*)target)->_ApplyWeaponDependentAuraDamageMod(pItem, WeaponAttackType(i), this, apply); } + } } // m_modifier.m_miscvalue is bitmask of spell schools @@ -8075,10 +8097,12 @@ void Aura::HandleModDamagePercentDone(bool apply, bool Real) if (Real && target->GetTypeId() == TYPEID_PLAYER) { for (int i = 0; i < MAX_ATTACK; ++i) + { if (Item* pItem = ((Player*)target)->GetWeaponForAttack(WeaponAttackType(i), true, false)) { ((Player*)target)->_ApplyWeaponDependentAuraDamageMod(pItem, WeaponAttackType(i), this, apply); } + } } // m_modifier.m_miscvalue is bitmask of spell schools @@ -8167,10 +8191,12 @@ void Aura::HandleModPowerCostPCT(bool apply, bool Real) float amount = m_modifier.m_amount / 100.0f; for (int i = 0; i < MAX_SPELL_SCHOOL; ++i) + { if (m_modifier.m_miscvalue & (1 << i)) { GetTarget()->ApplyModSignedFloatValue(UNIT_FIELD_POWER_COST_MULTIPLIER + i, amount, apply); } + } } /** @@ -8188,10 +8214,12 @@ void Aura::HandleModPowerCost(bool apply, bool Real) } for (int i = 0; i < MAX_SPELL_SCHOOL; ++i) + { if (m_modifier.m_miscvalue & (1 << i)) { GetTarget()->ApplyModInt32Value(UNIT_FIELD_POWER_COST_MODIFIER + i, m_modifier.m_amount, apply); } + } } void Aura::HandleNoReagentUseAura(bool /*Apply*/, bool Real) @@ -8637,10 +8665,12 @@ void Aura::HandleModRating(bool apply, bool Real) } for (uint32 rating = 0; rating < MAX_COMBAT_RATING; ++rating) + { if (m_modifier.m_miscvalue & (1 << rating)) { ((Player*)GetTarget())->ApplyRatingMod(CombatRating(rating), m_modifier.m_amount, apply); } + } } void Aura::HandleModRatingFromStat(bool apply, bool Real) @@ -8657,10 +8687,12 @@ void Aura::HandleModRatingFromStat(bool apply, bool Real) } // Just recalculate ratings for (uint32 rating = 0; rating < MAX_COMBAT_RATING; ++rating) + { if (m_modifier.m_miscvalue & (1 << rating)) { ((Player*)GetTarget())->ApplyRatingMod(CombatRating(rating), 0, apply); } + } } void Aura::HandleForceMoveForward(bool apply, bool Real) @@ -9259,11 +9291,13 @@ void Aura::PeriodicTick() if (!target->IsAlive() && pCaster->IsNonMeleeSpellCasted(false)) for (uint32 i = CURRENT_FIRST_NON_MELEE_SPELL; i < CURRENT_MAX_SPELL; ++i) + { if (Spell* spell = pCaster->GetCurrentSpell(CurrentSpellTypes(i))) if (spell->m_spellInfo->Id == GetId()) { spell->cancel(); } + } if (Player* modOwner = pCaster->GetSpellModOwner()) { @@ -10661,10 +10695,12 @@ void Aura::HandleAuraAddMechanicAbilities(bool apply, bool Real) // spell give the player a new castbar with some spells.. this is a clientside process.. // serverside just needs to register the new spells so that player isn't kicked as cheater for (int i = 0; i < MAX_OVERRIDE_SPELLS; ++i) + { if (uint32 spellId = spellSet->Spells[i]) { static_cast(target)->addSpell(spellId, true, false, false, false); } + } target->SetUInt16Value(PLAYER_FIELD_BYTES2, 0, i_OverrideSetId); } @@ -10672,10 +10708,12 @@ void Aura::HandleAuraAddMechanicAbilities(bool apply, bool Real) { target->SetUInt16Value(PLAYER_FIELD_BYTES2, 0, 0); for (int i = 0; i < MAX_OVERRIDE_SPELLS; ++i) + { if (uint32 spellId = spellSet->Spells[i]) { static_cast(target)->removeSpell(spellId, false , false, false); } + } } } @@ -11015,10 +11053,12 @@ void Aura::HandleTriggerLinkedAura(bool apply, bool Real) bool Aura::IsLastAuraOnHolder() { for (int32 i = 0; i < MAX_EFFECT_INDEX; ++i) + { if (i != GetEffIndex() && GetHolder()->m_auras[i]) { return false; } + } return true; } @@ -11137,10 +11177,12 @@ void SpellAuraHolder::RemoveAura(SpellEffectIndex index) void SpellAuraHolder::ApplyAuraModifiers(bool apply, bool real) { for (int32 i = 0; i < MAX_EFFECT_INDEX && !IsDeleted(); ++i) + { if (Aura* aur = GetAuraByEffectIndex(SpellEffectIndex(i))) { aur->ApplyModifier(apply, real); } + } } /** @@ -11925,10 +11967,12 @@ void SpellAuraHolder::HandleSpellSpecificBoosts(bool apply) // If target still has one of Warrior's bleeds, do nothing Unit::AuraList const& PeriodicDamage = m_target->GetAurasByType(SPELL_AURA_PERIODIC_DAMAGE); for (Unit::AuraList::const_iterator i = PeriodicDamage.begin(); i != PeriodicDamage.end(); ++i) + { if ((*i)->GetCasterGuid() == GetCasterGuid() && (*i)->GetSpellProto()->SpellFamilyName == SPELLFAMILY_WARRIOR && (*i)->GetSpellProto()->Mechanic == MECHANIC_BLEED) return; + } spellId1 = 30069; // Blood Frenzy (Rank 1) spellId2 = 30070; // Blood Frenzy (Rank 2) @@ -12601,10 +12645,12 @@ SpellAuraHolder::~SpellAuraHolder() { // note: auras in delete list won't be affected since they clear themselves from holder when adding to deletedAuraslist for (int32 i = 0; i < MAX_EFFECT_INDEX; ++i) + { if (Aura* aur = m_auras[i]) { delete aur; } + } } /** @@ -12648,10 +12694,12 @@ void SpellAuraHolder::Update(uint32 diff) } for (int32 i = 0; i < MAX_EFFECT_INDEX; ++i) + { if (Aura* aura = m_auras[i]) { aura->UpdateAura(diff); } + } // Channeled aura required check distance from caster if (IsChanneledSpell(m_spellProto) && GetCasterGuid() != m_target->GetObjectGuid()) @@ -12731,10 +12779,12 @@ bool SpellAuraHolder::HasMechanic(uint32 mechanic) const } for (int32 i = 0; i < MAX_EFFECT_INDEX; ++i) + { if (m_auras[i] && m_spellProto->EffectMechanic[i] == mechanic) { return true; } + } return false; } @@ -12752,10 +12802,12 @@ bool SpellAuraHolder::HasMechanicMask(uint32 mechanicMask) const } for (int32 i = 0; i < MAX_EFFECT_INDEX; ++i) + { if (m_auras[i] && m_spellProto->EffectMechanic[i] && ((1 << (m_spellProto->EffectMechanic[i] - 1)) & mechanicMask)) { return true; } + } return false; } @@ -12767,11 +12819,13 @@ bool SpellAuraHolder::HasMechanicMask(uint32 mechanicMask) const bool SpellAuraHolder::IsPersistent() const { for (int32 i = 0; i < MAX_EFFECT_INDEX; ++i) + { if (Aura* aur = m_auras[i]) if (aur->IsPersistent()) { return true; } + } return false; } @@ -12783,11 +12837,13 @@ bool SpellAuraHolder::IsPersistent() const bool SpellAuraHolder::IsAreaAura() const { for (int32 i = 0; i < MAX_EFFECT_INDEX; ++i) + { if (Aura* aur = m_auras[i]) if (aur->IsAreaAura()) { return true; } + } return false; } @@ -12799,11 +12855,13 @@ bool SpellAuraHolder::IsAreaAura() const bool SpellAuraHolder::IsPositive() const { for (int32 i = 0; i < MAX_EFFECT_INDEX; ++i) + { if (Aura* aur = m_auras[i]) if (!aur->IsPositive()) { return false; } + } return true; } @@ -12815,10 +12873,12 @@ bool SpellAuraHolder::IsPositive() const bool SpellAuraHolder::IsEmptyHolder() const { for (int32 i = 0; i < MAX_EFFECT_INDEX; ++i) + { if (m_auras[i]) { return false; } + } return true; } diff --git a/src/game/WorldHandlers/SpellEffects.cpp b/src/game/WorldHandlers/SpellEffects.cpp index 3e1d2aa5b..61031ddfc 100644 --- a/src/game/WorldHandlers/SpellEffects.cpp +++ b/src/game/WorldHandlers/SpellEffects.cpp @@ -389,10 +389,12 @@ void Spell::EffectSchoolDMG(SpellEffectIndex effect_idx) { uint32 count = 0; for (TargetList::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) + { if (ihit->effectMask & (1 << effect_idx)) { ++count; } + } damage /= count; // divide to all targets break; @@ -562,10 +564,12 @@ void Spell::EffectSchoolDMG(SpellEffectIndex effect_idx) uint32 counter = 0; Unit::AuraList const& dotAuras = unitTarget->GetAurasByType(SPELL_AURA_PERIODIC_DAMAGE); for (Unit::AuraList::const_iterator itr = dotAuras.begin(); itr != dotAuras.end(); ++itr) + { if ((*itr)->GetCasterGuid() == owner->GetObjectGuid()) { ++counter; } + } if (counter) { @@ -3880,10 +3884,12 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) // Improved Life Tap mod Unit::AuraList const& auraDummy = m_caster->GetAurasByType(SPELL_AURA_DUMMY); for (Unit::AuraList::const_iterator itr = auraDummy.begin(); itr != auraDummy.end(); ++itr) + { if ((*itr)->GetSpellProto()->SpellFamilyName == SPELLFAMILY_WARLOCK && (*itr)->GetSpellProto()->SpellIconID == 208) { mana = ((*itr)->GetModifier()->m_amount + 100) * mana / 100; } + } m_caster->CastCustomSpell(unitTarget, 31818, &mana, NULL, NULL, true); @@ -4350,11 +4356,13 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx) // Restorative Totems Unit::AuraList const& mDummyAuras = owner->GetAurasByType(SPELL_AURA_DUMMY); for (Unit::AuraList::const_iterator i = mDummyAuras.begin(); i != mDummyAuras.end(); ++i) + { // only its have dummy with specific icon if ((*i)->GetSpellProto()->SpellFamilyName == SPELLFAMILY_SHAMAN && (*i)->GetSpellProto()->SpellIconID == 338) { damage += (*i)->GetModifier()->m_amount * damage / 100; } + } // Glyph of Healing Stream Totem if (Aura* dummy = owner->GetDummyAura(55456)) @@ -5561,10 +5569,12 @@ void Spell::EffectHeal(SpellEffectIndex /*eff_idx*/) int damageAmount = 0; Unit::AuraList const& mDummyAuras = m_caster->GetAurasByType(SPELL_AURA_DUMMY); for (Unit::AuraList::const_iterator i = mDummyAuras.begin(); i != mDummyAuras.end(); ++i) + { if ((*i)->GetId() == 45062) { damageAmount += (*i)->GetModifier()->m_amount; } + } if (damageAmount) { m_caster->RemoveAurasDueToSpell(45062); @@ -6702,6 +6712,7 @@ bool Spell::DoSummonWild(CreatureSummonPositions& list, SummonPropertiesEntry co TempSpawnType summonType = (m_duration == 0) ? TEMPSPAWN_DEAD_DESPAWN : TEMPSPAWN_TIMED_OOC_OR_DEAD_DESPAWN; for (CreatureSummonPositions::iterator itr = list.begin(); itr != list.end(); ++itr) + { if (Creature* summon = m_caster->SummonCreature(creature_entry, itr->x, itr->y, itr->z, m_caster->GetOrientation(), summonType, m_duration)) { itr->creature = summon; @@ -6731,6 +6742,7 @@ bool Spell::DoSummonWild(CreatureSummonPositions& list, SummonPropertiesEntry co { return false; } + } return true; } @@ -8345,10 +8357,12 @@ void Spell::EffectWeaponDmg(SpellEffectIndex eff_idx) { uint32 count = 0; for (TargetList::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) + { if (ihit->effectMask & (1 << eff_idx)) { ++count; } + } totalDamagePercentMod /= float(count); // divide to all targets break; @@ -9134,10 +9148,12 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) // check presence for (int j = 0; j < 4; ++j) + { if (unitTarget->HasAura(spells[j], EFFECT_INDEX_0)) { return; } + } // cast unitTarget->CastSpell(unitTarget, spells[urand(0, 3)], true); @@ -11950,10 +11966,12 @@ void Spell::EffectScriptEffect(SpellEffectIndex eff_idx) // don't overwrite an existing aura for (uint8 i = 0; i < 5; ++i) + { if (unitTarget->HasAura(spellid + i, EFFECT_INDEX_0)) { return; } + } unitTarget->CastSpell(unitTarget, spellid + urand(0, 4), true); break; @@ -13420,12 +13438,14 @@ void Spell::EffectSummonAllTotems(SpellEffectIndex eff_idx) int32 amount_buttons = m_spellInfo->EffectMiscValueB[eff_idx]; for (int32 slot = 0; slot < amount_buttons; ++slot) + { if (ActionButton const* actionButton = ((Player*)m_caster)->GetActionButton(start_button + slot)) if (actionButton->GetType() == ACTION_BUTTON_SPELL) if (uint32 spell_id = actionButton->GetAction()) { m_caster->CastSpell(unitTarget, spell_id, true); } + } } /** diff --git a/src/game/WorldHandlers/TransportSystem.cpp b/src/game/WorldHandlers/TransportSystem.cpp index a4267e026..596731e14 100644 --- a/src/game/WorldHandlers/TransportSystem.cpp +++ b/src/game/WorldHandlers/TransportSystem.cpp @@ -90,8 +90,10 @@ void TransportBase::UpdateGlobalPositions() // Update global positions for (PassengerMap::const_iterator itr = m_passengers.begin(); itr != m_passengers.end(); ++itr) + { UpdateGlobalPositionOf(itr->first, itr->second->GetLocalPositionX(), itr->second->GetLocalPositionY(), itr->second->GetLocalPositionZ(), itr->second->GetLocalOrientation()); + } m_lastPosition = pos; } diff --git a/src/game/WorldHandlers/Transports.cpp b/src/game/WorldHandlers/Transports.cpp index 9567f7f58..44bfaf3eb 100644 --- a/src/game/WorldHandlers/Transports.cpp +++ b/src/game/WorldHandlers/Transports.cpp @@ -645,10 +645,12 @@ void Transport::UpdateForMap(Map const* targetMap) transData.BuildPacket(&out_packet); for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr) + { if (this != itr->getSource()->GetTransport()) { itr->getSource()->SendDirectMessage(&out_packet); } + } } } diff --git a/src/game/WorldHandlers/VehicleHandler.cpp b/src/game/WorldHandlers/VehicleHandler.cpp index 11c67c078..c10bc9db0 100644 --- a/src/game/WorldHandlers/VehicleHandler.cpp +++ b/src/game/WorldHandlers/VehicleHandler.cpp @@ -156,10 +156,12 @@ void WorldSession::HandleChangeSeatsOnControlledVehicle(WorldPacket& recvPacket) SpellClickInfoMapBounds clickPair = sObjectMgr.GetSpellClickInfoMapBounds(destVehicle->GetEntry()); for (SpellClickInfoMap::const_iterator itr = clickPair.first; itr != clickPair.second; ++itr) + { if (itr->second.IsFitToRequirements(_player, destVehicle->GetTypeId() == TYPEID_UNIT ? (Creature*)destVehicle : NULL)) { _player->CastSpell(destVehicle, itr->second.spellId, true); } + } } else { diff --git a/src/game/WorldHandlers/WaypointManager.cpp b/src/game/WorldHandlers/WaypointManager.cpp index a26f02bce..4b5a82c9e 100644 --- a/src/game/WorldHandlers/WaypointManager.cpp +++ b/src/game/WorldHandlers/WaypointManager.cpp @@ -47,10 +47,12 @@ bool WaypointBehavior::isEmpty() } for (int i = 0; i < MAX_WAYPOINT_TEXT; ++i) + { if (textid[i]) { return false; } + } return true; } @@ -816,18 +818,22 @@ void WaypointManager::CheckTextsExistance(std::set& ids) for (WaypointPathMap::const_iterator pmItr = m_pathMap.begin(); pmItr != m_pathMap.end(); ++pmItr) { for (WaypointPath::const_iterator pItr = pmItr->second.begin(); pItr != pmItr->second.end(); ++pItr) + { if (pItr->second.behavior) { CheckWPText(false, pmItr->first, pItr->first, pItr->second.behavior, ids); } + } } for (WaypointPathMap::const_iterator pmItr = m_pathTemplateMap.begin(); pmItr != m_pathTemplateMap.end(); ++pmItr) { for (WaypointPath::const_iterator pItr = pmItr->second.begin(); pItr != pmItr->second.end(); ++pItr) + { if (pItr->second.behavior) { CheckWPText(true, pmItr->first, pItr->first, pItr->second.behavior, ids); } + } } } diff --git a/src/game/WorldHandlers/World.cpp b/src/game/WorldHandlers/World.cpp index a156ff13b..6e807e916 100644 --- a/src/game/WorldHandlers/World.cpp +++ b/src/game/WorldHandlers/World.cpp @@ -375,10 +375,12 @@ int32 World::GetQueuedSessionPos(WorldSession* sess) uint32 position = 1; for (Queue::const_iterator iter = m_QueuedSessions.begin(); iter != m_QueuedSessions.end(); ++iter, ++position) + { if ((*iter) == sess) { return position; } + } return 0; } @@ -2184,11 +2186,13 @@ void World::KickAllLess(AccountTypes sec) { // session not removed at kick and will removed in next update tick for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr) + { if (WorldSession* session = itr->second) if (session->GetSecurity() < sec) { session->KickPlayer(); } + } } /// Ban an account or ban an IP address, duration_secs if it is positive used, otherwise permban @@ -2703,10 +2707,12 @@ void World::ResetDailyQuests() DETAIL_LOG("Daily quests reset for all characters."); CharacterDatabase.Execute("DELETE FROM `character_queststatus_daily`"); for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr) + { if (itr->second->GetPlayer()) { itr->second->GetPlayer()->ResetDailyQuestStatus(); } + } m_NextDailyQuestReset = time_t(m_NextDailyQuestReset + DAY); CharacterDatabase.PExecute("UPDATE `saved_variables` SET `NextDailyQuestResetTime` = '" UI64FMTD "'", uint64(m_NextDailyQuestReset)); @@ -2717,10 +2723,12 @@ void World::ResetRandomBG() sLog.outDetail("Random BG status reset for all characters."); CharacterDatabase.Execute("DELETE FROM `character_battleground_random`"); for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr) + { if (itr->second->GetPlayer()) { itr->second->GetPlayer()->SetRandomWinner(false); } + } m_NextRandomBGReset = time_t(m_NextRandomBGReset + DAY); CharacterDatabase.PExecute("UPDATE `saved_variables` SET `NextRandomBGResetTime` = '" UI64FMTD "'", uint64(m_NextRandomBGReset)); @@ -2731,10 +2739,12 @@ void World::ResetWeeklyQuests() DETAIL_LOG("Weekly quests reset for all characters."); CharacterDatabase.Execute("DELETE FROM `character_queststatus_weekly`"); for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr) + { if (itr->second->GetPlayer()) { itr->second->GetPlayer()->ResetWeeklyQuestStatus(); } + } m_NextWeeklyQuestReset = time_t(m_NextWeeklyQuestReset + WEEK); CharacterDatabase.PExecute("UPDATE `saved_variables` SET `NextWeeklyQuestResetTime` = '" UI64FMTD "'", uint64(m_NextWeeklyQuestReset)); @@ -2746,10 +2756,12 @@ void World::ResetMonthlyQuests() CharacterDatabase.Execute("TRUNCATE character_queststatus_monthly"); for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr) + { if (itr->second->GetPlayer()) { itr->second->GetPlayer()->ResetMonthlyQuestStatus(); } + } SetMonthlyQuestResetTime(false); } diff --git a/src/game/vmap/RegularGrid.h b/src/game/vmap/RegularGrid.h index 7ea06e57b..4ed922197 100644 --- a/src/game/vmap/RegularGrid.h +++ b/src/game/vmap/RegularGrid.h @@ -105,10 +105,12 @@ class RegularGrid2D ~RegularGrid2D() { for (int x = 0; x < CELL_NUMBER; ++x) + { for (int y = 0; y < CELL_NUMBER; ++y) { delete nodes[x][y]; } + } } /** @@ -144,11 +146,15 @@ class RegularGrid2D void balance() { for (int x = 0; x < CELL_NUMBER; ++x) + { for (int y = 0; y < CELL_NUMBER; ++y) + { if (Node* n = nodes[x][y]) { n->balance(); } + } + } } /** diff --git a/src/shared/Common/Common.cpp b/src/shared/Common/Common.cpp index f51c41674..d694bdf1b 100644 --- a/src/shared/Common/Common.cpp +++ b/src/shared/Common/Common.cpp @@ -59,10 +59,12 @@ LocaleNameStr const fullLocaleNameList[] = LocaleConstant GetLocaleByName(const std::string& name) { for (LocaleNameStr const* itr = &fullLocaleNameList[0]; itr->name; ++itr) + { if (name == itr->name) { return itr->locale; } + } return LOCALE_enUS; // including enGB case } diff --git a/src/shared/GameSystem/NGrid.h b/src/shared/GameSystem/NGrid.h index 2522a516e..bfc49dc86 100644 --- a/src/shared/GameSystem/NGrid.h +++ b/src/shared/GameSystem/NGrid.h @@ -342,10 +342,12 @@ class NGrid void Visit(TypeContainerVisitor& visitor) { for (uint32 x = 0; x < N; ++x) + { for (uint32 y = 0; y < N; ++y) { i_cells[x][y].Visit(visitor); } + } } template @@ -371,10 +373,12 @@ class NGrid { uint32 count = 0; for (uint32 x = 0; x < N; ++x) + { for (uint32 y = 0; y < N; ++y) { count += i_cells[x][y].ActiveObjectsInGrid(); } + } return count; } diff --git a/src/shared/Log/Log.cpp b/src/shared/Log/Log.cpp index 0195e28e4..38e0ccb71 100644 --- a/src/shared/Log/Log.cpp +++ b/src/shared/Log/Log.cpp @@ -347,11 +347,13 @@ void Log::Initialize() m_logFilter = 0; for (int i = 0; i < LOG_FILTER_COUNT; ++i) + { if (*logFilterData[i].name) if (sConfig.GetBoolDefault(logFilterData[i].configName, logFilterData[i].defaultState)) { m_logFilter |= (1 << i); } + } // Char log settings m_charLog_Dump = sConfig.GetBoolDefault("CharLogDump", false); diff --git a/src/shared/Utilities/Util.h b/src/shared/Utilities/Util.h index 1464a2f65..4788fbe45 100644 --- a/src/shared/Utilities/Util.h +++ b/src/shared/Utilities/Util.h @@ -573,10 +573,12 @@ inline bool isNumericOrSpace(wchar_t wchar) inline bool isNumeric(char const* str) { for (char const* c = str; *c; ++c) + { if (!isNumeric(*c)) { return false; } + } return true; } @@ -590,10 +592,12 @@ inline bool isNumeric(char const* str) inline bool isNumeric(std::string const& str) { for (std::string::const_iterator itr = str.begin(); itr != str.end(); ++itr) + { if (!isNumeric(*itr)) { return false; } + } return true; } @@ -607,10 +611,12 @@ inline bool isNumeric(std::string const& str) inline bool isNumeric(std::wstring const& str) { for (std::wstring::const_iterator itr = str.begin(); itr != str.end(); ++itr) + { if (!isNumeric(*itr)) { return false; } + } return true; } @@ -625,10 +631,12 @@ inline bool isNumeric(std::wstring const& str) inline bool isBasicLatinString(const std::wstring &wstr, bool numericOrSpace) { for (size_t i = 0; i < wstr.size(); ++i) + { if (!isBasicLatinCharacter(wstr[i]) && (!numericOrSpace || !isNumericOrSpace(wstr[i]))) { return false; } + } return true; } @@ -642,10 +650,12 @@ inline bool isBasicLatinString(const std::wstring &wstr, bool numericOrSpace) inline bool isExtendedLatinString(const std::wstring &wstr, bool numericOrSpace) { for (size_t i = 0; i < wstr.size(); ++i) + { if (!isExtendedLatinCharacter(wstr[i]) && (!numericOrSpace || !isNumericOrSpace(wstr[i]))) { return false; } + } return true; } @@ -659,10 +669,12 @@ inline bool isExtendedLatinString(const std::wstring &wstr, bool numericOrSpace) inline bool isCyrillicString(const std::wstring &wstr, bool numericOrSpace) { for (size_t i = 0; i < wstr.size(); ++i) + { if (!isCyrillicCharacter(wstr[i]) && (!numericOrSpace || !isNumericOrSpace(wstr[i]))) { return false; } + } return true; } @@ -676,10 +688,12 @@ inline bool isCyrillicString(const std::wstring &wstr, bool numericOrSpace) inline bool isEastAsianString(const std::wstring &wstr, bool numericOrSpace) { for (size_t i = 0; i < wstr.size(); ++i) + { if (!isEastAsianCharacter(wstr[i]) && (!numericOrSpace || !isNumericOrSpace(wstr[i]))) { return false; } + } return true; }