aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/game/World.cpp26
-rw-r--r--src/game/WorldSession.cpp12
-rw-r--r--src/shared/Database/SqlDelayThread.cpp5
3 files changed, 17 insertions, 26 deletions
diff --git a/src/game/World.cpp b/src/game/World.cpp
index 9ae75029637..4b1c54ff9f9 100644
--- a/src/game/World.cpp
+++ b/src/game/World.cpp
@@ -127,8 +127,9 @@ World::~World()
m_weathers.clear();
- while (!cliCmdQueue.empty())
- delete cliCmdQueue.next();
+ CliCommandHolder* command;
+ while (cliCmdQueue.next(command))
+ delete command;
VMAP::VMapFactory::clear();
@@ -2359,11 +2360,9 @@ void World::SendServerMessage(ServerMessageType type, const char *text, Player*
void World::UpdateSessions( uint32 diff )
{
///- Add new sessions
- while(!addSessQueue.empty())
- {
- WorldSession* sess = addSessQueue.next ();
+ WorldSession* sess;
+ while(addSessQueue.next(sess))
AddSession_ (sess);
- }
///- Then send an update signal to remaining ones
for (SessionMap::iterator itr = m_sessions.begin(), next; itr != m_sessions.end(); itr = next)
@@ -2388,25 +2387,20 @@ void World::UpdateSessions( uint32 diff )
// This handles the issued and queued CLI commands
void World::ProcessCliCommands()
{
- if (cliCmdQueue.empty())
- return;
+ CliCommandHolder::Print* zprint = NULL;
- CliCommandHolder::Print* zprint;
-
- while (!cliCmdQueue.empty())
+ CliCommandHolder* command;
+ while (cliCmdQueue.next(command))
{
sLog.outDebug("CLI command under processing...");
- CliCommandHolder *command = cliCmdQueue.next();
-
zprint = command->m_print;
-
CliHandler(zprint).ParseCommands(command->m_command);
-
delete command;
}
// print the console message here so it looks right
- zprint("TC> ");
+ if (zprint)
+ zprint("TC> ");
}
void World::SendRNDBroadcast()
diff --git a/src/game/WorldSession.cpp b/src/game/WorldSession.cpp
index 97d79e10635..d80ede80bc7 100644
--- a/src/game/WorldSession.cpp
+++ b/src/game/WorldSession.cpp
@@ -73,11 +73,10 @@ WorldSession::~WorldSession()
}
///- empty incoming packet queue
- while(!_recvQueue.empty())
- {
- WorldPacket *packet = _recvQueue.next ();
+ WorldPacket* packet;
+ while(_recvQueue.next(packet))
delete packet;
- }
+
loginDatabase.PExecute("UPDATE account SET online = 0 WHERE id = %u;", GetAccountId());
CharacterDatabase.PExecute("UPDATE characters SET online = 0 WHERE account = %u;", GetAccountId());
}
@@ -169,10 +168,9 @@ bool WorldSession::Update(uint32 /*diff*/)
{
///- Retrieve packets from the receive queue and call the appropriate handlers
/// not proccess packets if socket already closed
- while (!_recvQueue.empty() && m_Socket && !m_Socket->IsClosed ())
+ WorldPacket* packet;
+ while (_recvQueue.next(packet) && m_Socket && !m_Socket->IsClosed ())
{
- WorldPacket *packet = _recvQueue.next();
-
/*#if 1
sLog.outError( "MOEP: %s (0x%.4X)",
LookupOpcodeName(packet->GetOpcode()),
diff --git a/src/shared/Database/SqlDelayThread.cpp b/src/shared/Database/SqlDelayThread.cpp
index 9a92fd5dd63..88b6b85df70 100644
--- a/src/shared/Database/SqlDelayThread.cpp
+++ b/src/shared/Database/SqlDelayThread.cpp
@@ -28,7 +28,6 @@ SqlDelayThread::SqlDelayThread(Database* db) : m_dbEngine(db), m_running(true)
void SqlDelayThread::run()
{
- SqlOperation* s;
#ifndef DO_POSTGRESQL
mysql_thread_init();
#endif
@@ -38,9 +37,9 @@ void SqlDelayThread::run()
// if the running state gets turned off while sleeping
// empty the queue before exiting
ACE_Based::Thread::Sleep(10);
- while (!m_sqlQueue.empty())
+ SqlOperation* s;
+ while (m_sqlQueue.next(s))
{
- s = m_sqlQueue.next();
s->Execute(m_dbEngine);
delete s;
}