* one more fix for gcc, replaced DelayedPacketQueue:queue with deque
This commit is contained in:
parent
46a855278e
commit
f7598b6a31
@ -54,7 +54,7 @@ WorldSession::~WorldSession()
|
|||||||
while(delayedPktQueue.size())
|
while(delayedPktQueue.size())
|
||||||
{
|
{
|
||||||
packet = delayedPktQueue.back().pkt;
|
packet = delayedPktQueue.back().pkt;
|
||||||
delayedPktQueue.c.pop_back();
|
delayedPktQueue.pop_back();
|
||||||
delete packet;
|
delete packet;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -299,7 +299,7 @@ void WorldSession::_DelayWorldPacket(WorldPacket& pkt, uint32 ms)
|
|||||||
// need to copy the packet, because the current packet will be deleted after it got handled
|
// need to copy the packet, because the current packet will be deleted after it got handled
|
||||||
WorldPacket *pktcopy = new WorldPacket(pkt.GetOpcode(),pkt.size());
|
WorldPacket *pktcopy = new WorldPacket(pkt.GetOpcode(),pkt.size());
|
||||||
pktcopy->append(pkt.contents(),pkt.size());
|
pktcopy->append(pkt.contents(),pkt.size());
|
||||||
delayedPktQueue.push(DelayedWorldPacket(pktcopy,ms));
|
delayedPktQueue.push_back(DelayedWorldPacket(pktcopy,ms));
|
||||||
DEBUG(logdebug("-> WP ptr = 0x%X",pktcopy));
|
DEBUG(logdebug("-> WP ptr = 0x%X",pktcopy));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -308,12 +308,11 @@ void WorldSession::_HandleDelayedPackets(void)
|
|||||||
if(delayedPktQueue.size())
|
if(delayedPktQueue.size())
|
||||||
{
|
{
|
||||||
DelayedPacketQueue copy(delayedPktQueue);
|
DelayedPacketQueue copy(delayedPktQueue);
|
||||||
while(delayedPktQueue.size())
|
delayedPktQueue.clear(); // clear original, since it might be filled up by newly delayed packets, which would cause endless loop
|
||||||
delayedPktQueue.pop(); // clear original, since it might be filled up by newly delayed packets, which would cause endless loop
|
|
||||||
while(copy.size())
|
while(copy.size())
|
||||||
{
|
{
|
||||||
DelayedWorldPacket d = copy.front();
|
DelayedWorldPacket d = copy.front();
|
||||||
copy.c.pop_front(); // remove packet from front, std::queue seems not to have a func for it
|
copy.pop_front(); // remove packet from front
|
||||||
if(clock() >= d.when) // if its time to handle this packet, do so
|
if(clock() >= d.when) // if its time to handle this packet, do so
|
||||||
{
|
{
|
||||||
DEBUG(logdebug("Handling delayed packet (%s [%u], size: %u, ptr: 0x%X)",GetOpcodeName(d.pkt->GetOpcode()),d.pkt->GetOpcode(),d.pkt->size(),d.pkt));
|
DEBUG(logdebug("Handling delayed packet (%s [%u], size: %u, ptr: 0x%X)",GetOpcodeName(d.pkt->GetOpcode()),d.pkt->GetOpcode(),d.pkt->size(),d.pkt));
|
||||||
@ -321,7 +320,7 @@ void WorldSession::_HandleDelayedPackets(void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
delayedPktQueue.push(d); // and if not, put it again onto the queue
|
delayedPktQueue.push_back(d); // and if not, put it again onto the queue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
#ifndef _WORLDSESSION_H
|
#ifndef _WORLDSESSION_H
|
||||||
#define _WORLDSESSION_H
|
#define _WORLDSESSION_H
|
||||||
|
|
||||||
#include <queue>
|
#include <deque>
|
||||||
#include <bitset>
|
#include <bitset>
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
@ -40,7 +40,7 @@ struct DelayedWorldPacket
|
|||||||
};
|
};
|
||||||
|
|
||||||
typedef std::vector<WhoListEntry> WhoList;
|
typedef std::vector<WhoListEntry> WhoList;
|
||||||
typedef std::queue<DelayedWorldPacket> DelayedPacketQueue;
|
typedef std::deque<DelayedWorldPacket> DelayedPacketQueue;
|
||||||
|
|
||||||
class WorldSession
|
class WorldSession
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user