Core: Do not use STL container size method to check if container is empty

This commit is contained in:
Spp-
2011-07-01 14:58:44 +02:00
parent ce75ced741
commit bb921ae78c
17 changed files with 34 additions and 30 deletions
@@ -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);
@@ -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
@@ -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());
@@ -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)
@@ -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)
@@ -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;
@@ -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);