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
@@ -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)
+1 -1
View File
@@ -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);
+6 -2
View File
@@ -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());