Core: Do not use STL container size method to check if container is empty
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user