* Added new World::OnStartup/OnShutdown hooks.

--HG--
branch : trunk
This commit is contained in:
XTZGZoReX
2010-08-07 14:30:10 +02:00
parent 360e028331
commit f1c571a79e
3 changed files with 28 additions and 3 deletions
@@ -27,7 +27,7 @@
#include "World.h"
#include "WorldSocketMgr.h"
#include "Database/DatabaseEnv.h"
#include "ScriptMgr.h"
#include "BattleGroundMgr.h"
#include "MapManager.h"
#include "Timer.h"
@@ -53,6 +53,8 @@ void WorldRunnable::run()
uint32 prevSleepTime = 0; // used for balanced full tick time length near WORLD_SLEEP_CONST
sScriptMgr.OnStartup();
///- While we have not World::m_stopEvent, update the world
while (!World::IsStopped())
{
@@ -77,11 +79,16 @@ void WorldRunnable::run()
prevSleepTime = 0;
#ifdef _WIN32
if (m_ServiceStatus == 0) World::StopNow(SHUTDOWN_EXIT_CODE);
while (m_ServiceStatus == 2) Sleep(1000);
if (m_ServiceStatus == 0)
World::StopNow(SHUTDOWN_EXIT_CODE);
while (m_ServiceStatus == 2)
Sleep(1000);
#endif
}
sScriptMgr.OnShutdown();
sWorld.KickAll(); // save and kick all players
sWorld.UpdateSessions( 1 ); // real players unload required UpdateSessions call