From 5d08617f37a9b6ad1077f8863c94dfb907d6849b Mon Sep 17 00:00:00 2001 From: rilex Date: Thu, 12 Feb 2009 15:11:38 +0300 Subject: [PATCH] [7271] Implement mangosd stop and pause if it work as Windows service. Signed-off-by: VladimirMangos --- src/mangosd/WorldRunnable.cpp | 10 ++++++++++ src/shared/revision_nr.h | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/mangosd/WorldRunnable.cpp b/src/mangosd/WorldRunnable.cpp index f2c427c4e28..929463503db 100644 --- a/src/mangosd/WorldRunnable.cpp +++ b/src/mangosd/WorldRunnable.cpp @@ -37,6 +37,11 @@ #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 void WorldRunnable::run() { @@ -71,6 +76,11 @@ 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 diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 8e527cfed75..2d4ab514c72 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "7270" + #define REVISION_NR "7271" #endif // __REVISION_NR_H__