diff options
Diffstat (limited to 'src')
17 files changed, 34 insertions, 30 deletions
diff --git a/src/server/collision/BoundingIntervalHierarchy.h b/src/server/collision/BoundingIntervalHierarchy.h index 39d237d9a2f..f7bfdf73ccc 100755 --- a/src/server/collision/BoundingIntervalHierarchy.h +++ b/src/server/collision/BoundingIntervalHierarchy.h @@ -86,7 +86,7 @@ class BIH template< class T, class BoundsFunc > void build(const std::vector<T> &primitives, BoundsFunc &getBounds, uint32 leafSize = 3, bool printStats=false) { - if(primitives.size() == 0) + if(primitives.empty()) return; buildData dat; dat.maxPrims = leafSize; diff --git a/src/server/collision/Models/WorldModel.cpp b/src/server/collision/Models/WorldModel.cpp index 03101170c44..501be416a26 100644 --- a/src/server/collision/Models/WorldModel.cpp +++ b/src/server/collision/Models/WorldModel.cpp @@ -360,7 +360,7 @@ namespace VMAP bool GroupModel::IntersectRay(const G3D::Ray &ray, float &distance, bool stopAtFirstHit) const { - if (!triangles.size()) + if (triangles.empty()) return false; GModelRayCallback callback(triangles, vertices); meshTree.intersectRay(ray, callback, distance, stopAtFirstHit); @@ -369,7 +369,7 @@ namespace VMAP bool GroupModel::IsInsideObject(const Vector3 &pos, const Vector3 &down, float &z_dist) const { - if (!triangles.size() || !iBound.contains(pos)) + if (triangles.empty() || !iBound.contains(pos)) return false; GModelRayCallback callback(triangles, vertices); Vector3 rPos = pos - 0.1f * down; @@ -468,7 +468,7 @@ namespace VMAP bool WorldModel::IntersectPoint(const G3D::Vector3 &p, const G3D::Vector3 &down, float &dist, AreaInfo &info) const { - if (!groupModels.size()) + if (groupModels.empty()) return false; WModelAreaCallback callback(groupModels, down); groupTree.intersectPoint(p, callback); @@ -486,7 +486,7 @@ namespace VMAP bool WorldModel::GetLocationInfo(const G3D::Vector3 &p, const G3D::Vector3 &down, float &dist, LocationInfo &info) const { - if (!groupModels.size()) + if (groupModels.empty()) return false; WModelAreaCallback callback(groupModels, down); groupTree.intersectPoint(p, callback); diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp index 96740ba2a2c..29a24de3d73 100755 --- a/src/server/game/DungeonFinding/LFGMgr.cpp +++ b/src/server/game/DungeonFinding/LFGMgr.cpp @@ -430,7 +430,7 @@ void LFGMgr::InitializeLockedDungeons(Player* plr) */ void LFGMgr::Join(Player* plr, uint8 roles, const LfgDungeonSet& selectedDungeons, const std::string& comment) { - if (!plr || !plr->GetSession() || !selectedDungeons.size()) + if (!plr || !plr->GetSession() || selectedDungeons.empty()) return; Group* grp = plr->GetGroup(); @@ -477,7 +477,7 @@ void LFGMgr::Join(Player* plr, uint8 roles, const LfgDungeonSet& selectedDungeon joinData.result = LFG_JOIN_DESERTER; else if (plr->HasAura(LFG_SPELL_DUNGEON_COOLDOWN)) joinData.result = LFG_JOIN_RANDOM_COOLDOWN; - else if (!dungeons.size()) + else if (dungeons.empty()) joinData.result = LFG_JOIN_NOT_MEET_REQS; else if (grp) { @@ -763,7 +763,7 @@ bool LFGMgr::CheckCompatibility(LfgGuidList check, LfgProposal*& pProposal) std::string strGuids = ConcatenateGuids(check); - if (check.size() > MAXGROUPSIZE || !check.size()) + if (check.size() > MAXGROUPSIZE || check.empty()) { sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::CheckCompatibility: (%s): Size wrong - Not compatibles", strGuids.c_str()); return false; @@ -1163,7 +1163,7 @@ void LFGMgr::GetCompatibleDungeons(LfgDungeonSet& dungeons, const PlayerSet& pla } } } - if (dungeons.size()) + if (!dungeons.empty()) lockMap.clear(); } @@ -1176,7 +1176,7 @@ void LFGMgr::GetCompatibleDungeons(LfgDungeonSet& dungeons, const PlayerSet& pla */ bool LFGMgr::CheckGroupRoles(LfgRolesMap& groles, bool removeLeaderFlag /*= true*/) { - if (!groles.size()) + if (groles.empty()) return false; uint8 damage = 0; diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index 85fa2c3e362..539a04ef2c6 100755 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -1092,7 +1092,7 @@ void GameObject::Use(Unit* user) if (user->GetTypeId() != TYPEID_PLAYER) return; - if (!ChairListSlots.size()) // this is called once at first chair use to make list of available slots + if (ChairListSlots.empty()) // this is called once at first chair use to make list of available slots { if (info->chair.slots > 0) // sometimes chairs in DB have error in fields and we dont know number of slots for (uint32 i = 0; i < info->chair.slots; ++i) diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 7d206bcdbea..8a5503e9f25 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -18588,7 +18588,7 @@ void Player::_SaveMail(SQLTransaction& trans) { trans->PAppend("UPDATE mail SET has_items = '%u', expire_time = '" UI64FMTD "', deliver_time = '" UI64FMTD "', money = '%u', cod = '%u', checked = '%u' WHERE id = '%u'", m->HasItems() ? 1 : 0, (uint64)m->expire_time, (uint64)m->deliver_time, m->money, m->COD, m->checked, m->messageID); - if (m->removedItems.size()) + if (!m->removedItems.empty()) { for (std::vector<uint32>::iterator itr2 = m->removedItems.begin(); itr2 != m->removedItems.end(); ++itr2) trans->PAppend("DELETE FROM mail_items WHERE item_guid = '%u'", *itr2); diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 4f8d39d5b03..7558bb887a4 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -17150,8 +17150,10 @@ bool Unit::SetPosition(float x, float y, float z, float orientation, bool telepo void Unit::SendThreatListUpdate() { - if (uint32 count = getThreatManager().getThreatList().size()) + if (!getThreatManager().isThreatListEmpty()) { + uint32 count = getThreatManager().getThreatList().size(); + //sLog->outDebug(LOG_FILTER_UNITS, "WORLD: Send SMSG_THREAT_UPDATE Message"); WorldPacket data(SMSG_THREAT_UPDATE, 8 + count * 8); data.append(GetPackGUID()); @@ -17168,8 +17170,10 @@ void Unit::SendThreatListUpdate() void Unit::SendChangeCurrentVictimOpcode(HostileReference* pHostileReference) { - if (uint32 count = getThreatManager().getThreatList().size()) + if (!getThreatManager().isThreatListEmpty()) { + uint32 count = getThreatManager().getThreatList().size(); + sLog->outDebug(LOG_FILTER_UNITS, "WORLD: Send SMSG_HIGHEST_THREAT_UPDATE Message"); WorldPacket data(SMSG_HIGHEST_THREAT_UPDATE, 8 + 8 + count * 8); data.append(GetPackGUID()); diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 356f26e880c..79df2b9fa73 100755 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -7863,7 +7863,7 @@ bool ObjectMgr::LoadTrinityStrings(char const* table, int32 min_value, int32 max TrinityStringLocale& data = mTrinityStringLocaleMap[entry]; - if (data.Content.size() > 0) + if (!data.Content.empty()) { sLog->outErrorDb("Table `%s` contain data for already loaded entry %i (from another table?), ignored.", table, entry); continue; diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp index 3c3b71deddc..bb7b37c1eaf 100755 --- a/src/server/game/Groups/Group.cpp +++ b/src/server/game/Groups/Group.cpp @@ -1574,7 +1574,7 @@ bool Group::InCombatToInstance(uint32 instanceId) for (GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next()) { Player *pPlayer = itr->getSource(); - if (pPlayer && pPlayer->getAttackers().size() && pPlayer->GetInstanceId() == instanceId && (pPlayer->GetMap()->IsRaidOrHeroicDungeon())) + if (pPlayer && !pPlayer->getAttackers().empty() && pPlayer->GetInstanceId() == instanceId && (pPlayer->GetMap()->IsRaidOrHeroicDungeon())) for (std::set<Unit*>::const_iterator i = pPlayer->getAttackers().begin(); i != pPlayer->getAttackers().end(); ++i) if ((*i) && (*i)->GetTypeId() == TYPEID_UNIT && (*i)->ToCreature()->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_INSTANCE_BIND) return true; diff --git a/src/server/game/Pools/PoolMgr.cpp b/src/server/game/Pools/PoolMgr.cpp index e2a5bdfef91..1c239fc0438 100755 --- a/src/server/game/Pools/PoolMgr.cpp +++ b/src/server/game/Pools/PoolMgr.cpp @@ -140,7 +140,7 @@ void PoolGroup<T>::AddEntry(PoolObject& poolitem, uint32 maxentries) template <class T> bool PoolGroup<T>::CheckPool() const { - if (!EqualChanced.size()) + if (EqualChanced.empty()) { float chance = 0; for (uint32 i = 0; i < ExplicitlyChanced.size(); ++i) @@ -496,7 +496,7 @@ void PoolGroup<Quest>::SpawnObject(ActivePoolData& spawns, uint32 limit, uint32 Spawn1Object(&tempObj); newQuests.erase(itr); --limit; - } while (limit && newQuests.size()); + } while (limit && !newQuests.empty()); // if we are here it means the pool is initialized at startup and did not have previous saved state if (!triggerFrom) @@ -779,7 +779,7 @@ void PoolMgr::LoadFromDB() while (result->NextRow()); // Now check for circular reference - for (uint32 i=0; i<mPoolPoolGroups.size(); ++i) + for (uint32 i=0; i < max_pool_id; ++i) { std::set<uint32> checkedPools; for (SearchMap::iterator poolItr = mPoolSearchMap.find(i); poolItr != mPoolSearchMap.end(); poolItr = mPoolSearchMap.find(poolItr->second)) diff --git a/src/server/game/Server/Protocol/Handlers/LFGHandler.cpp b/src/server/game/Server/Protocol/Handlers/LFGHandler.cpp index 56de97aaddc..004c5ea2e63 100755 --- a/src/server/game/Server/Protocol/Handlers/LFGHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/LFGHandler.cpp @@ -285,7 +285,7 @@ void WorldSession::SendLfgUpdatePlayer(const LfgUpdateData& updateData) bool queued = false; bool extrainfo = false; - switch(updateData.updateType) + switch (updateData.updateType) { case LFG_UPDATETYPE_JOIN_PROPOSAL: case LFG_UPDATETYPE_ADDED_TO_QUEUE: @@ -328,7 +328,7 @@ void WorldSession::SendLfgUpdateParty(const LfgUpdateData& updateData) bool extrainfo = false; bool queued = false; - switch(updateData.updateType) + switch (updateData.updateType) { case LFG_UPDATETYPE_JOIN_PROPOSAL: extrainfo = true; @@ -401,7 +401,7 @@ void WorldSession::SendLfgRoleCheckUpdate(const LfgRoleCheck* pRoleCheck) data << uint32(pRoleCheck->state); // Check result data << uint8(pRoleCheck->state == LFG_ROLECHECK_INITIALITING); data << uint8(dungeons.size()); // Number of dungeons - if (dungeons.size()) + if (!dungeons.empty()) { for (LfgDungeonSet::iterator it = dungeons.begin(); it != dungeons.end(); ++it) { @@ -411,7 +411,7 @@ void WorldSession::SendLfgRoleCheckUpdate(const LfgRoleCheck* pRoleCheck) } data << uint8(pRoleCheck->roles.size()); // Players in group - if (pRoleCheck->roles.size()) + if (!pRoleCheck->roles.empty()) { // Leader info MUST be sent 1st :S uint64 guid = pRoleCheck->leader; diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp index b380d559ae0..adde1d9bf4a 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp @@ -286,7 +286,7 @@ void boss_attumen::boss_attumenAI::UpdateAI(const uint32 diff) target_list.push_back(pTarget); pTarget = NULL; } - if (target_list.size()) + if (!target_list.empty()) pTarget = *(target_list.begin()+rand()%target_list.size()); DoCast(pTarget, SPELL_BERSERKER_CHARGE); diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp index 788c9fb171a..daad47b6106 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp @@ -312,7 +312,7 @@ public: std::list<HostileReference *> t_list = me->getThreatManager().getThreatList(); std::vector<Unit* > targets; - if (!t_list.size()) + if (t_list.empty()) return; //begin + 1, so we don't target the one with the highest threat diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp index 1fdd23fe51d..cf785a64301 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp @@ -525,7 +525,7 @@ public: me->IsWithinDistInMap(i->getSource(), range) && i->getSource()->isAlive()) temp.push_back(i->getSource()); - if (temp.size()) + if (!temp.empty()) { j = temp.begin(); advance(j, rand()%temp.size()); diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp index c1f80fb50af..2b93d4a6d57 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp @@ -247,7 +247,7 @@ class boss_janalai : public CreatureScript } //sLog->outError("Eggs %d at middle", templist.size()); - if (!templist.size()) + if (templist.empty()) return false; for (std::list<Creature*>::const_iterator i = templist.begin(); i != templist.end(); ++i) diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp index 3a6ccacf753..ab4cb968336 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp @@ -175,7 +175,7 @@ class boss_nalorakk : public CreatureScript cell.Visit(pair, cSearcher, *(me->GetMap())); } - if (!templist.size()) + if (templist.empty()) return; for (std::list<Creature*>::const_iterator i = templist.begin(); i != templist.end(); ++i) diff --git a/src/server/scripts/Outland/BlackTemple/boss_bloodboil.cpp b/src/server/scripts/Outland/BlackTemple/boss_bloodboil.cpp index 5ebe89ffea9..b958243e5ec 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_bloodboil.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_bloodboil.cpp @@ -144,7 +144,7 @@ public: // Get the Threat List std::list<HostileReference *> m_threatlist = me->getThreatManager().getThreatList(); - if (!m_threatlist.size()) // He doesn't have anyone in his threatlist, useless to continue + if (m_threatlist.empty()) // He doesn't have anyone in his threatlist, useless to continue return; std::list<Unit* > targets; diff --git a/src/server/scripts/Outland/GruulsLair/boss_high_king_maulgar.cpp b/src/server/scripts/Outland/GruulsLair/boss_high_king_maulgar.cpp index c175c0baa8c..dc44a455c34 100644 --- a/src/server/scripts/Outland/GruulsLair/boss_high_king_maulgar.cpp +++ b/src/server/scripts/Outland/GruulsLair/boss_high_king_maulgar.cpp @@ -776,7 +776,7 @@ public: target_list.push_back(pTarget); pTarget = NULL; } - if (target_list.size()) + if (!target_list.empty()) pTarget = *(target_list.begin()+rand()%target_list.size()); me->InterruptNonMeleeSpells(false); |