Core/World: Set realm status as invalid during startup and online when initialized

--HG--
branch : trunk
This commit is contained in:
Shauren
2010-12-28 17:56:15 +01:00
parent f0db5396f4
commit 4e697869a0
2 changed files with 46 additions and 41 deletions
+1
View File
@@ -131,6 +131,7 @@ include_directories(
${CMAKE_SOURCE_DIR}/src/server/game/Tools
${CMAKE_SOURCE_DIR}/src/server/game/Weather
${CMAKE_SOURCE_DIR}/src/server/game/World
${CMAKE_SOURCE_DIR}/src/server/authserver/Server
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/CommandLine
${CMAKE_CURRENT_SOURCE_DIR}/RemoteAccess
+8 -4
View File
@@ -40,6 +40,7 @@
#include "TCSoap.h"
#include "Timer.h"
#include "Util.h"
#include "AuthSocket.h"
#include "BigNumber.h"
@@ -160,6 +161,9 @@ int Master::Run()
if (!_StartDB())
return 1;
// set server offline (not connectable)
LoginDatabase.DirectPExecute("UPDATE realmlist SET color = (color & ~%u) | %u WHERE id = '%d'", REALM_FLAG_OFFLINE, REALM_FLAG_INVALID, realmID);
///- Initialize the World
sWorld->SetInitialWorldSettings();
@@ -183,9 +187,6 @@ int Master::Run()
ACE_Based::Thread world_thread(new WorldRunnable);
world_thread.setPriority(ACE_Based::Highest);
// set server online
LoginDatabase.PExecute("UPDATE realmlist SET color = 0, population = 0 WHERE id = '%d'",realmID);
ACE_Based::Thread* cliThread = NULL;
#ifdef _WIN32
@@ -276,6 +277,9 @@ int Master::Run()
// go down and shutdown the server
}
// set server online (allow connecting now)
LoginDatabase.DirectPExecute("UPDATE realmlist SET color = color & ~%u, population = 0 WHERE id = '%u'", REALM_FLAG_INVALID, realmID);
sWorldSocketMgr->Wait();
if (soap_thread)
@@ -286,7 +290,7 @@ int Master::Run()
}
// set server offline
LoginDatabase.PExecute("UPDATE realmlist SET color = 2 WHERE id = '%d'",realmID);
LoginDatabase.PExecute("UPDATE realmlist SET color = color | %u WHERE id = '%d'", REALM_FLAG_OFFLINE, realmID);
// when the main thread closes the singletons get unloaded
// since worldrunnable uses them, it will crash if unloaded after master