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/Tools
${CMAKE_SOURCE_DIR}/src/server/game/Weather ${CMAKE_SOURCE_DIR}/src/server/game/Weather
${CMAKE_SOURCE_DIR}/src/server/game/World ${CMAKE_SOURCE_DIR}/src/server/game/World
${CMAKE_SOURCE_DIR}/src/server/authserver/Server
${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/CommandLine ${CMAKE_CURRENT_SOURCE_DIR}/CommandLine
${CMAKE_CURRENT_SOURCE_DIR}/RemoteAccess ${CMAKE_CURRENT_SOURCE_DIR}/RemoteAccess
+8 -4
View File
@@ -40,6 +40,7 @@
#include "TCSoap.h" #include "TCSoap.h"
#include "Timer.h" #include "Timer.h"
#include "Util.h" #include "Util.h"
#include "AuthSocket.h"
#include "BigNumber.h" #include "BigNumber.h"
@@ -160,6 +161,9 @@ int Master::Run()
if (!_StartDB()) if (!_StartDB())
return 1; 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 ///- Initialize the World
sWorld->SetInitialWorldSettings(); sWorld->SetInitialWorldSettings();
@@ -183,9 +187,6 @@ int Master::Run()
ACE_Based::Thread world_thread(new WorldRunnable); ACE_Based::Thread world_thread(new WorldRunnable);
world_thread.setPriority(ACE_Based::Highest); 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; ACE_Based::Thread* cliThread = NULL;
#ifdef _WIN32 #ifdef _WIN32
@@ -276,6 +277,9 @@ int Master::Run()
// go down and shutdown the server // 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(); sWorldSocketMgr->Wait();
if (soap_thread) if (soap_thread)
@@ -286,7 +290,7 @@ int Master::Run()
} }
// set server offline // 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 // when the main thread closes the singletons get unloaded
// since worldrunnable uses them, it will crash if unloaded after master // since worldrunnable uses them, it will crash if unloaded after master