mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-16 18:52:22 +00:00
Prefer prefix ++/-- on non-primitive types
Postfix ++/-- might cause the creation of a tmp instance that might be optimized out. Mights are bad. Prefix doesn't have this problem.
This commit is contained in:
+6
-13
@@ -229,25 +229,18 @@ void EQStreamServer::Process() {
|
||||
}
|
||||
|
||||
std::map <std::string, EQStream*>::iterator connection;
|
||||
for (connection = connection_list.begin( ); connection != connection_list.end( );)
|
||||
{
|
||||
if(!connection->second)
|
||||
{
|
||||
std::map <std::string, EQStream*>::iterator tmp=connection;
|
||||
connection++;
|
||||
connection_list.erase(tmp);
|
||||
for (connection = connection_list.begin(); connection != connection_list.end();) {
|
||||
if (!connection->second) {
|
||||
connection = connection_list.erase(connection);
|
||||
continue;
|
||||
}
|
||||
EQStream* eqs_data = connection->second;
|
||||
if (eqs_data->IsFree() && (!eqs_data->CheckNetActive())) {
|
||||
std::map <std::string, EQStream*>::iterator tmp=connection;
|
||||
connection++;
|
||||
safe_delete(eqs_data);
|
||||
connection_list.erase(tmp);
|
||||
}
|
||||
else if(!eqs_data->RunLoop) {
|
||||
connection = connection_list.erase(connection);
|
||||
} else if (!eqs_data->RunLoop) {
|
||||
eqs_data->Process(sock);
|
||||
connection++;
|
||||
++connection;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+7
-7
@@ -747,7 +747,7 @@ void EQStream::Write(int eq_fd)
|
||||
// Copy it first as it will still live until it is acked
|
||||
p=(*sitr)->Copy();
|
||||
_log(NET__NET_COMBINE, _L "Starting combined packet with seq packet %d of len %d" __L, seq_send, p->size);
|
||||
sitr++;
|
||||
++sitr;
|
||||
NextSequencedSend++;
|
||||
} else if (!p->combine(*sitr)) {
|
||||
// Trying to combine this packet with the base didn't work (too big maybe)
|
||||
@@ -765,7 +765,7 @@ void EQStream::Write(int eq_fd)
|
||||
} else {
|
||||
// Combine worked
|
||||
_log(NET__NET_COMBINE, _L "Combined seq packet %d of len %d, yeilding %d combined." __L, seq_send, (*sitr)->size, p->size);
|
||||
sitr++;
|
||||
++sitr;
|
||||
NextSequencedSend++;
|
||||
}
|
||||
} else {
|
||||
@@ -774,7 +774,7 @@ void EQStream::Write(int eq_fd)
|
||||
// Copy it first as it will still live until it is acked
|
||||
p=(*sitr)->Copy();
|
||||
_log(NET__NET_COMBINE, _L "Starting combined packet with seq packet %d of len %d" __L, seq_send, p->size);
|
||||
sitr++;
|
||||
++sitr;
|
||||
NextSequencedSend++;
|
||||
} else if (!p->combine(*sitr)) {
|
||||
// Trying to combine this packet with the base didn't work (too big maybe)
|
||||
@@ -792,7 +792,7 @@ void EQStream::Write(int eq_fd)
|
||||
} else {
|
||||
// Combine worked
|
||||
_log(NET__NET_COMBINE, _L "Combined seq packet %d of len %d, yeilding %d combined." __L, seq_send, (*sitr)->size, p->size);
|
||||
sitr++;
|
||||
++sitr;
|
||||
NextSequencedSend++;
|
||||
}
|
||||
}
|
||||
@@ -1047,7 +1047,7 @@ EQApplicationPacket *p=nullptr;
|
||||
MInboundQueue.lock();
|
||||
if (!InboundQueue.empty()) {
|
||||
std::vector<EQRawApplicationPacket *>::iterator itr;
|
||||
for(itr=InboundQueue.begin();itr!=InboundQueue.end();itr++) {
|
||||
for(itr=InboundQueue.begin();itr!=InboundQueue.end();++itr) {
|
||||
p=*itr;
|
||||
delete p;
|
||||
}
|
||||
@@ -1094,7 +1094,7 @@ EQProtocolPacket *p=nullptr;
|
||||
}
|
||||
if(!SequencedQueue.empty()) {
|
||||
std::deque<EQProtocolPacket *>::iterator itr;
|
||||
for(itr=SequencedQueue.begin();itr!=SequencedQueue.end();itr++) {
|
||||
for(itr=SequencedQueue.begin();itr!=SequencedQueue.end();++itr) {
|
||||
p=*itr;
|
||||
delete p;
|
||||
}
|
||||
@@ -1119,7 +1119,7 @@ EQProtocolPacket *p=nullptr;
|
||||
|
||||
if(!PacketQueue.empty()) {
|
||||
std::map<unsigned short,EQProtocolPacket *>::iterator itr;
|
||||
for(itr=PacketQueue.begin();itr!=PacketQueue.end();itr++) {
|
||||
for(itr=PacketQueue.begin();itr!=PacketQueue.end();++itr) {
|
||||
p=itr->second;
|
||||
delete p;
|
||||
}
|
||||
|
||||
+25
-25
@@ -101,7 +101,7 @@ ItemInstQueue::~ItemInstQueue() {
|
||||
iter_queue cur,end;
|
||||
cur = m_list.begin();
|
||||
end = m_list.end();
|
||||
for(; cur != end; cur++) {
|
||||
for(; cur != end; ++cur) {
|
||||
ItemInst *tmp = * cur;
|
||||
safe_delete(tmp);
|
||||
}
|
||||
@@ -113,7 +113,7 @@ Inventory::~Inventory() {
|
||||
|
||||
cur = m_worn.begin();
|
||||
end = m_worn.end();
|
||||
for(; cur != end; cur++) {
|
||||
for(; cur != end; ++cur) {
|
||||
ItemInst *tmp = cur->second;
|
||||
safe_delete(tmp);
|
||||
}
|
||||
@@ -121,7 +121,7 @@ Inventory::~Inventory() {
|
||||
|
||||
cur = m_inv.begin();
|
||||
end = m_inv.end();
|
||||
for(; cur != end; cur++) {
|
||||
for(; cur != end; ++cur) {
|
||||
ItemInst *tmp = cur->second;
|
||||
safe_delete(tmp);
|
||||
}
|
||||
@@ -129,7 +129,7 @@ Inventory::~Inventory() {
|
||||
|
||||
cur = m_bank.begin();
|
||||
end = m_bank.end();
|
||||
for(; cur != end; cur++) {
|
||||
for(; cur != end; ++cur) {
|
||||
ItemInst *tmp = cur->second;
|
||||
safe_delete(tmp);
|
||||
}
|
||||
@@ -137,7 +137,7 @@ Inventory::~Inventory() {
|
||||
|
||||
cur = m_shbank.begin();
|
||||
end = m_shbank.end();
|
||||
for(; cur != end; cur++) {
|
||||
for(; cur != end; ++cur) {
|
||||
ItemInst *tmp = cur->second;
|
||||
safe_delete(tmp);
|
||||
}
|
||||
@@ -145,7 +145,7 @@ Inventory::~Inventory() {
|
||||
|
||||
cur = m_trade.begin();
|
||||
end = m_trade.end();
|
||||
for(; cur != end; cur++) {
|
||||
for(; cur != end; ++cur) {
|
||||
ItemInst *tmp = cur->second;
|
||||
safe_delete(tmp);
|
||||
}
|
||||
@@ -166,7 +166,7 @@ ItemInst::ItemInst(const ItemInst& copy)
|
||||
m_merchantcount=copy.m_merchantcount;
|
||||
// Copy container contents
|
||||
iter_contents it;
|
||||
for (it=copy.m_contents.begin(); it!=copy.m_contents.end(); it++) {
|
||||
for (it=copy.m_contents.begin(); it!=copy.m_contents.end(); ++it) {
|
||||
ItemInst* inst_old = it->second;
|
||||
ItemInst* inst_new = nullptr;
|
||||
|
||||
@@ -179,7 +179,7 @@ ItemInst::ItemInst(const ItemInst& copy)
|
||||
}
|
||||
}
|
||||
std::map<std::string, std::string>::const_iterator iter;
|
||||
for (iter = copy.m_custom_data.begin(); iter != copy.m_custom_data.end(); iter++) {
|
||||
for (iter = copy.m_custom_data.begin(); iter != copy.m_custom_data.end(); ++iter) {
|
||||
m_custom_data[iter->first] = iter->second;
|
||||
}
|
||||
m_SerialNumber = copy.m_SerialNumber;
|
||||
@@ -428,7 +428,7 @@ void ItemInst::Clear()
|
||||
iter_contents cur, end;
|
||||
cur = m_contents.begin();
|
||||
end = m_contents.end();
|
||||
for (; cur != end; cur++) {
|
||||
for (; cur != end; ++cur) {
|
||||
ItemInst* inst = cur->second;
|
||||
safe_delete(inst);
|
||||
}
|
||||
@@ -446,7 +446,7 @@ void ItemInst::ClearByFlags(byFlagSetting is_nodrop, byFlagSetting is_norent)
|
||||
ItemInst* inst = cur->second;
|
||||
const Item_Struct* item = inst->GetItem();
|
||||
del = cur;
|
||||
cur++;
|
||||
++cur;
|
||||
|
||||
switch(is_nodrop) {
|
||||
case byFlagSet:
|
||||
@@ -611,7 +611,7 @@ std::string ItemInst::GetCustomDataString() const {
|
||||
ret_val += iter->first;
|
||||
ret_val += "^";
|
||||
ret_val += iter->second;
|
||||
iter++;
|
||||
++iter;
|
||||
|
||||
if(ret_val.length() > 0) {
|
||||
ret_val += "^";
|
||||
@@ -1231,11 +1231,11 @@ int16 Inventory::FindFreeSlot(bool for_bag, bool try_cursor, uint8 min_size, boo
|
||||
void Inventory::dumpBagContents(ItemInst *inst, iter_inst *it) {
|
||||
iter_contents itb;
|
||||
|
||||
if (!inst || !inst->IsType(ItemClassContainer))
|
||||
if (!inst || !inst->IsType(ItemClassContainer))
|
||||
return;
|
||||
|
||||
// Go through bag, if bag
|
||||
for (itb=inst->_begin(); itb!=inst->_end(); itb++) {
|
||||
for (itb=inst->_begin(); itb!=inst->_end(); ++itb) {
|
||||
ItemInst* baginst = itb->second;
|
||||
if(!baginst || !baginst->GetItem())
|
||||
continue;
|
||||
@@ -1308,7 +1308,7 @@ void Inventory::dumpItemCollection(const std::map<int16, ItemInst*> &collection)
|
||||
iter_contents itb;
|
||||
ItemInst* inst = nullptr;
|
||||
|
||||
for (it=collection.begin(); it!=collection.end(); it++) {
|
||||
for (it=collection.begin(); it!=collection.end(); ++it) {
|
||||
inst = it->second;
|
||||
if(!inst || !inst->GetItem())
|
||||
continue;
|
||||
@@ -1430,7 +1430,7 @@ int16 Inventory::_HasItem(std::map<int16, ItemInst*>& bucket, uint32 item_id, ui
|
||||
uint8 quantity_found = 0;
|
||||
|
||||
// Check item: After failed checks, check bag contents (if bag)
|
||||
for (it=bucket.begin(); it!=bucket.end(); it++) {
|
||||
for (it=bucket.begin(); it!=bucket.end(); ++it) {
|
||||
inst = it->second;
|
||||
if (inst) {
|
||||
if (inst->GetID() == item_id) {
|
||||
@@ -1447,7 +1447,7 @@ int16 Inventory::_HasItem(std::map<int16, ItemInst*>& bucket, uint32 item_id, ui
|
||||
// Go through bag, if bag
|
||||
if (inst && inst->IsType(ItemClassContainer)) {
|
||||
|
||||
for (itb=inst->_begin(); itb!=inst->_end(); itb++) {
|
||||
for (itb=inst->_begin(); itb!=inst->_end(); ++itb) {
|
||||
ItemInst* baginst = itb->second;
|
||||
if (baginst->GetID() == item_id) {
|
||||
quantity_found += (baginst->GetCharges()<=0) ? 1 : baginst->GetCharges();
|
||||
@@ -1474,7 +1474,7 @@ int16 Inventory::_HasItem(ItemInstQueue& iqueue, uint32 item_id, uint8 quantity)
|
||||
uint8 quantity_found = 0;
|
||||
|
||||
// Read-only iteration of queue
|
||||
for (it=iqueue.begin(); it!=iqueue.end(); it++) {
|
||||
for (it=iqueue.begin(); it!=iqueue.end(); ++it) {
|
||||
ItemInst* inst = *it;
|
||||
if (inst)
|
||||
{
|
||||
@@ -1491,7 +1491,7 @@ int16 Inventory::_HasItem(ItemInstQueue& iqueue, uint32 item_id, uint8 quantity)
|
||||
// Go through bag, if bag
|
||||
if (inst && inst->IsType(ItemClassContainer)) {
|
||||
|
||||
for (itb=inst->_begin(); itb!=inst->_end(); itb++) {
|
||||
for (itb=inst->_begin(); itb!=inst->_end(); ++itb) {
|
||||
ItemInst* baginst = itb->second;
|
||||
if (baginst->GetID() == item_id) {
|
||||
quantity_found += (baginst->GetCharges()<=0) ? 1 : baginst->GetCharges();
|
||||
@@ -1520,7 +1520,7 @@ int16 Inventory::_HasItemByUse(std::map<int16, ItemInst*>& bucket, uint8 use, ui
|
||||
uint8 quantity_found = 0;
|
||||
|
||||
// Check item: After failed checks, check bag contents (if bag)
|
||||
for (it=bucket.begin(); it!=bucket.end(); it++) {
|
||||
for (it=bucket.begin(); it!=bucket.end(); ++it) {
|
||||
inst = it->second;
|
||||
if (inst && inst->IsType(ItemClassCommon) && inst->GetItem()->ItemType == use) {
|
||||
quantity_found += (inst->GetCharges()<=0) ? 1 : inst->GetCharges();
|
||||
@@ -1554,7 +1554,7 @@ int16 Inventory::_HasItemByUse(ItemInstQueue& iqueue, uint8 use, uint8 quantity)
|
||||
uint8 quantity_found = 0;
|
||||
|
||||
// Read-only iteration of queue
|
||||
for (it=iqueue.begin(); it!=iqueue.end(); it++) {
|
||||
for (it=iqueue.begin(); it!=iqueue.end(); ++it) {
|
||||
ItemInst* inst = *it;
|
||||
if (inst && inst->IsType(ItemClassCommon) && inst->GetItem()->ItemType == use) {
|
||||
quantity_found += (inst->GetCharges()<=0) ? 1 : inst->GetCharges();
|
||||
@@ -1565,7 +1565,7 @@ int16 Inventory::_HasItemByUse(ItemInstQueue& iqueue, uint8 use, uint8 quantity)
|
||||
// Go through bag, if bag
|
||||
if (inst && inst->IsType(ItemClassContainer)) {
|
||||
|
||||
for (itb=inst->_begin(); itb!=inst->_end(); itb++) {
|
||||
for (itb=inst->_begin(); itb!=inst->_end(); ++itb) {
|
||||
ItemInst* baginst = itb->second;
|
||||
if (baginst && baginst->IsType(ItemClassCommon) && baginst->GetItem()->ItemType == use) {
|
||||
quantity_found += (baginst->GetCharges()<=0) ? 1 : baginst->GetCharges();
|
||||
@@ -1587,7 +1587,7 @@ int16 Inventory::_HasItemByLoreGroup(std::map<int16, ItemInst*>& bucket, uint32
|
||||
ItemInst* inst = nullptr;
|
||||
|
||||
// Check item: After failed checks, check bag contents (if bag)
|
||||
for (it=bucket.begin(); it!=bucket.end(); it++) {
|
||||
for (it=bucket.begin(); it!=bucket.end(); ++it) {
|
||||
inst = it->second;
|
||||
if (inst) {
|
||||
if (inst->GetItem()->LoreGroup == loregroup)
|
||||
@@ -1603,7 +1603,7 @@ int16 Inventory::_HasItemByLoreGroup(std::map<int16, ItemInst*>& bucket, uint32
|
||||
// Go through bag, if bag
|
||||
if (inst && inst->IsType(ItemClassContainer)) {
|
||||
|
||||
for (itb=inst->_begin(); itb!=inst->_end(); itb++) {
|
||||
for (itb=inst->_begin(); itb!=inst->_end(); ++itb) {
|
||||
ItemInst* baginst = itb->second;
|
||||
if (baginst && baginst->IsType(ItemClassCommon)&& baginst->GetItem()->LoreGroup == loregroup)
|
||||
return Inventory::CalcSlotId(it->first, itb->first);
|
||||
@@ -1629,7 +1629,7 @@ int16 Inventory::_HasItemByLoreGroup(ItemInstQueue& iqueue, uint32 loregroup)
|
||||
iter_contents itb;
|
||||
|
||||
// Read-only iteration of queue
|
||||
for (it=iqueue.begin(); it!=iqueue.end(); it++) {
|
||||
for (it=iqueue.begin(); it!=iqueue.end(); ++it) {
|
||||
ItemInst* inst = *it;
|
||||
if (inst)
|
||||
{
|
||||
@@ -1646,7 +1646,7 @@ int16 Inventory::_HasItemByLoreGroup(ItemInstQueue& iqueue, uint32 loregroup)
|
||||
// Go through bag, if bag
|
||||
if (inst && inst->IsType(ItemClassContainer)) {
|
||||
|
||||
for (itb=inst->_begin(); itb!=inst->_end(); itb++) {
|
||||
for (itb=inst->_begin(); itb!=inst->_end(); ++itb) {
|
||||
ItemInst* baginst = itb->second;
|
||||
if (baginst && baginst->IsType(ItemClassCommon)&& baginst->GetItem()->LoreGroup == loregroup)
|
||||
return Inventory::CalcSlotId(SLOT_CURSOR, itb->first);
|
||||
|
||||
+2
-2
@@ -65,7 +65,7 @@ public:
|
||||
vitr cur, end;
|
||||
cur = m_list.begin();
|
||||
end = m_list.end();
|
||||
for(; cur != end; cur++) {
|
||||
for(; cur != end; ++cur) {
|
||||
delete *cur;
|
||||
}
|
||||
}
|
||||
@@ -98,7 +98,7 @@ protected:
|
||||
} else {
|
||||
if (!data->Process())
|
||||
data->Disconnect();
|
||||
cur++;
|
||||
++cur;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1113,7 +1113,7 @@ uint8 *BaseGuildManager::MakeGuildList(const char *head_name, uint32 &length) co
|
||||
std::map<uint32, GuildInfo *>::const_iterator cur, end;
|
||||
cur = m_guilds.begin();
|
||||
end = m_guilds.end();
|
||||
for(; cur != end; cur++) {
|
||||
for(; cur != end; ++cur) {
|
||||
pos = 64 + (64 * cur->first);
|
||||
strn0cpy((char *) buffer + pos, cur->second->name.c_str(), 64);
|
||||
}
|
||||
@@ -1218,7 +1218,7 @@ uint32 BaseGuildManager::FindGuildByLeader(uint32 leader) const {
|
||||
std::map<uint32, GuildInfo *>::const_iterator cur, end;
|
||||
cur = m_guilds.begin();
|
||||
end = m_guilds.end();
|
||||
for(; cur != end; cur++) {
|
||||
for(; cur != end; ++cur) {
|
||||
if(cur->second->leader_char_id == leader)
|
||||
return(cur->first);
|
||||
}
|
||||
@@ -1297,7 +1297,7 @@ void BaseGuildManager::ClearGuilds() {
|
||||
std::map<uint32, GuildInfo *>::iterator cur, end;
|
||||
cur = m_guilds.begin();
|
||||
end = m_guilds.end();
|
||||
for(; cur != end; cur++) {
|
||||
for(; cur != end; ++cur) {
|
||||
delete cur->second;
|
||||
}
|
||||
m_guilds.clear();
|
||||
|
||||
+4
-4
@@ -294,7 +294,7 @@ PTimerList::~PTimerList() {
|
||||
while(s != _list.end()) {
|
||||
if(s->second != nullptr)
|
||||
delete s->second;
|
||||
s++;
|
||||
++s;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -305,7 +305,7 @@ bool PTimerList::Load(Database *db) {
|
||||
while(s != _list.end()) {
|
||||
if(s->second != nullptr)
|
||||
delete s->second;
|
||||
s++;
|
||||
++s;
|
||||
}
|
||||
_list.clear();
|
||||
|
||||
@@ -373,7 +373,7 @@ bool PTimerList::Store(Database *db) {
|
||||
if(!s->second->Store(db))
|
||||
res = false;
|
||||
}
|
||||
s++;
|
||||
++s;
|
||||
}
|
||||
return(res);
|
||||
}
|
||||
@@ -474,7 +474,7 @@ void PTimerList::ToVector(std::vector< std::pair<pTimerType, PersistentTimer *>
|
||||
p.second = s->second;
|
||||
out.push_back(p);
|
||||
}
|
||||
s++;
|
||||
++s;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -150,7 +150,7 @@ bool ret=true;
|
||||
char* query = 0;
|
||||
// Delete cursor items
|
||||
if ((ret = RunQuery(query, MakeAnyLenString(&query, "DELETE FROM inventory WHERE charid=%i AND ( (slotid >=8000 and slotid<=8999) or slotid=30 or (slotid>=331 and slotid<=340))", char_id), errbuf))) {
|
||||
for(it=start,i=8000;it!=end;it++,i++) {
|
||||
for(it=start,i=8000;it!=end;++it,i++) {
|
||||
ItemInst *inst=*it;
|
||||
if (!(ret=SaveInventory(char_id,inst,(i==8000) ? 30 : i)))
|
||||
break;
|
||||
|
||||
@@ -39,7 +39,7 @@ void TimeoutManager::CheckTimeouts() {
|
||||
std::vector<Timeoutable *>::iterator cur,end;
|
||||
cur = members.begin();
|
||||
end = members.end();
|
||||
for(; cur != end; cur++) {
|
||||
for(; cur != end; ++cur) {
|
||||
Timeoutable *it = *cur;
|
||||
if(it->next_check.Check()) {
|
||||
#ifdef TIMEOUT_DEBUG
|
||||
@@ -69,7 +69,7 @@ void TimeoutManager::DeleteMember(Timeoutable *who) {
|
||||
std::vector<Timeoutable *>::iterator cur,end;
|
||||
cur = members.begin();
|
||||
end = members.end();
|
||||
for(; cur != end; cur++) {
|
||||
for(; cur != end; ++cur) {
|
||||
if(*cur == who) {
|
||||
members.erase(cur);
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user