Add infos into target window
[ryzomcore.git] / ryzom / server / src / entities_game_service / shutdown_handler.h
blob2eabd26f31dc347793639375838b6d972d83e560
1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
16 #error DEPRECATED
18 #ifndef EGS_SHUTDOWN_HANDLER_H
19 #define EGS_SHUTDOWN_HANDLER_H
21 #include "nel/misc/variable.h"
22 #include "nel/misc/time_nl.h"
24 #include "nel/misc/ucstring.h"
27 /**
28 * This singleton handles shutdown events
29 * \author Benjamin Legros
30 * \author Nevrax France
31 * \date 2004
33 class CShutdownHandler
35 public:
37 /// \name Basic Management
38 // @{
40 /**
41 * Inits Handler
43 static void init();
45 /**
46 * Update Handler
48 static void update();
50 /**
51 * Release Handler
53 static void release();
55 // @}
60 /// \name Handler Commands Declaration
61 // @{
63 /**
64 * Start Shutdown Counter
66 static void startShutdown(sint shutdownCounter = -1, sint broadcastMessageRate = -1);
68 /**
69 * Cancel Shutdown
71 static void cancelShutdown();
73 /**
74 * Restart shard
75 * Actually reset WS ShardOpen variable to OpenForAll
77 static void restartShard();
79 // @}
85 /// \name Info queries
86 // @{
88 /**
89 * Get current shard state
91 static std::string getState();
93 // @}
96 private:
98 enum TState
100 Running = 0,
101 ShuttingDown,
102 Closed,
105 /// Shutdown State
106 static TState _State;
108 /// Shutdown Timeout
109 static NLMISC::TTime _ShutdownTimeout;
111 /// Shutdown Timeout
112 static NLMISC::TTime _NextBroadcastMessage;
114 /// ShardOpen has been closed
115 static bool _ShardClosed;
117 /// Broadcast Message Rate
118 static uint _BroadcastMessageRate;
120 /// Broadcast Shutdown message
121 static void broadcastShutdownMessage();
123 /// Broadcast message
124 static void broadcastMessage(const ucstring& message);
126 /// Disconnect all players
127 static void disconnectPlayers();
131 typedef uint32 TSecTime; // unit of NLMISC::CTime::getSecondsSince1970()
134 * Handle daily automatic shutdown
136 class CAutomaticShutdownHandler
138 public:
140 /// Update Handler
141 static void update();
143 /// Uses daily shutdown sequence time to compute next time
144 static void computePlannedShutdownTimes( NLMISC::CLog *log=NLMISC::InfoLog );
147 private:
148 /// Game cycle of last config file check
149 static NLMISC::TGameCycle _LastGCChecked;
151 /// Time of next planned shutdown sequence start
152 static TSecTime _NextPlannedShutdownStartTime;
154 /// Time of next planned shutdown sequence end
155 static TSecTime _NextPlannedShutdownEndTime;
159 #endif // EGS_SHUTDOWN_HANDLER_H
161 /* End of shutdown_handler.h */