mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-21 01:37:37 +01:00
mangosd->trinitycore & realmd->trinityrealm
--HG-- branch : trunk
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
|
||||
*
|
||||
* Copyright (C) 2008-2009 Trinity <http://www.trinitycore.org/>
|
||||
@@ -29,13 +29,19 @@
|
||||
#include "Timer.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "MapManager.h"
|
||||
#include "BattleGroundMgr.h"
|
||||
|
||||
#include "Database/DatabaseEnv.h"
|
||||
|
||||
#if (defined(SHORT_SLEEP) || defined(WIN32))
|
||||
#ifdef WIN32
|
||||
#define WORLD_SLEEP_CONST 50
|
||||
#else
|
||||
#define WORLD_SLEEP_CONST 100 //Is this still needed?? [On linux some time ago not working 50ms]
|
||||
#define WORLD_SLEEP_CONST 100 //Is this still needed?? [On linux some time ago not working 50ms]
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#include "ServiceWin32.h"
|
||||
extern int m_ServiceStatus;
|
||||
#endif
|
||||
|
||||
/// Heartbeat for the World
|
||||
@@ -43,6 +49,8 @@ void WorldRunnable::run()
|
||||
{
|
||||
///- Init new SQL thread for the world database
|
||||
WorldDatabase.ThreadStart(); // let thread do safe mySQL requests (one connection call enough)
|
||||
CharacterDatabase.ThreadStart();
|
||||
LoginDatabase.ThreadStart();
|
||||
sWorld.InitResultQueue();
|
||||
|
||||
uint32 realCurrTime = 0;
|
||||
@@ -72,16 +80,25 @@ void WorldRunnable::run()
|
||||
}
|
||||
else
|
||||
prevSleepTime = 0;
|
||||
|
||||
#ifdef WIN32
|
||||
if (m_ServiceStatus == 0) World::StopNow(SHUTDOWN_EXIT_CODE);
|
||||
while (m_ServiceStatus == 2) Sleep(1000);
|
||||
#endif
|
||||
}
|
||||
|
||||
sWorld.KickAll(); // save and kick all players
|
||||
sWorld.UpdateSessions( 1 ); // real players unload required UpdateSessions call
|
||||
|
||||
// unload battleground templates before different singletons destroyed
|
||||
sBattleGroundMgr.DeleteAllBattleGrounds();
|
||||
|
||||
sWorldSocketMgr->StopNetwork();
|
||||
|
||||
MapManager::Instance().UnloadAll(); // unload all grids (including locked in memory)
|
||||
|
||||
///- End the database thread
|
||||
WorldDatabase.ThreadEnd(); // free mySQL thread resources
|
||||
CharacterDatabase.ThreadStart();
|
||||
LoginDatabase.ThreadEnd();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user