Merge branch 'master' into 303

Conflicts:
	src/game/ItemPrototype.h
	src/game/ObjectMgr.cpp
	src/shared/Database/SQLStorage.cpp
This commit is contained in:
tomrus88 2008-11-16 17:20:43 +03:00
commit e738198eb4
33 changed files with 721 additions and 335 deletions

View file

@ -62,6 +62,7 @@
INSTANTIATE_SINGLETON_1( World );
volatile bool World::m_stopEvent = false;
uint8 World::m_ExitCode = SHUTDOWN_EXIT_CODE;
volatile uint32 World::m_worldLoopCounter = 0;
float World::m_MaxVisibleDistanceForCreature = DEFAULT_VISIBILITY_DISTANCE;
@ -927,6 +928,9 @@ void World::SetInitialWorldSettings()
LoadDBCStores(m_dataPath);
DetectDBCLang();
sLog.outString( "Loading Script Names...");
objmgr.LoadScriptNames();
sLog.outString( "Loading InstanceTemplate" );
objmgr.LoadInstanceTemplate();
@ -1534,6 +1538,8 @@ void World::ScriptsProcess()
}
}
if(source && !source->IsInWorld()) source = NULL;
Object* target = NULL;
if(step.targetGUID)
@ -1564,6 +1570,8 @@ void World::ScriptsProcess()
}
}
if(target && !target->IsInWorld()) target = NULL;
switch (step.script->command)
{
case SCRIPT_COMMAND_TALK:
@ -2323,13 +2331,13 @@ void World::_UpdateGameTime()
m_gameTime = thisTime;
///- if there is a shutdown timer
if(m_ShutdownTimer > 0 && elapsed > 0)
if(!m_stopEvent && m_ShutdownTimer > 0 && elapsed > 0)
{
///- ... and it is overdue, stop the world (set m_stopEvent)
if( m_ShutdownTimer <= elapsed )
{
if(!(m_ShutdownMask & SHUTDOWN_MASK_IDLE) || GetActiveAndQueuedSessionCount()==0)
m_stopEvent = true;
m_stopEvent = true; // exist code already set
else
m_ShutdownTimer = 1; // minimum timer value to wait idle state
}
@ -2344,15 +2352,20 @@ void World::_UpdateGameTime()
}
/// Shutdown the server
void World::ShutdownServ(uint32 time, uint32 options)
void World::ShutdownServ(uint32 time, uint32 options, uint8 exitcode)
{
// ignore if server shutdown at next tick
if(m_stopEvent)
return;
m_ShutdownMask = options;
m_ExitCode = exitcode;
///- If the shutdown time is 0, set m_stopEvent (except if shutdown is 'idle' with remaining sessions)
if(time==0)
{
if(!(options & SHUTDOWN_MASK_IDLE) || GetActiveAndQueuedSessionCount()==0)
m_stopEvent = true;
m_stopEvent = true; // exist code already set
else
m_ShutdownTimer = 1; //So that the session count is re-evaluated at next world tick
}
@ -2397,13 +2410,15 @@ void World::ShutdownMsg(bool show, Player* player)
/// Cancel a planned server shutdown
void World::ShutdownCancel()
{
if(!m_ShutdownTimer)
// nothing cancel or too later
if(!m_ShutdownTimer || m_stopEvent)
return;
uint32 msgid = (m_ShutdownMask & SHUTDOWN_MASK_RESTART) ? SERVER_MSG_RESTART_CANCELLED : SERVER_MSG_SHUTDOWN_CANCELLED;
m_ShutdownMask = 0;
m_ShutdownTimer = 0;
m_ExitCode = SHUTDOWN_EXIT_CODE; // to default value
SendServerMessage(msgid);
DEBUG_LOG("Server %s cancelled.",(m_ShutdownMask & SHUTDOWN_MASK_RESTART ? "restart" : "shuttingdown"));