aboutsummaryrefslogtreecommitdiff
path: root/src/game/World.h
diff options
context:
space:
mode:
authormegamage <none@none>2008-11-20 16:16:57 -0600
committermegamage <none@none>2008-11-20 16:16:57 -0600
commit1e997b95cc89c615adf2acd27a5f6916b78e0ff3 (patch)
tree491c496b798daf9b20db6397ae3f0affb6fd3738 /src/game/World.h
parent0b61584e1b19afb8dbef376a4e2903d8631bfc1d (diff)
Re-commit 262 due to EOL issues. (no difference from 262)
--HG-- branch : trunk
Diffstat (limited to 'src/game/World.h')
-rw-r--r--src/game/World.h79
1 files changed, 45 insertions, 34 deletions
diff --git a/src/game/World.h b/src/game/World.h
index c1ceb6891a5..50065b360dd 100644
--- a/src/game/World.h
+++ b/src/game/World.h
@@ -10,12 +10,12 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/// \addtogroup world The World
@@ -51,6 +51,13 @@ enum ShutdownMask
SHUTDOWN_MASK_IDLE = 2,
};
+enum ShutdownExitCode
+{
+ SHUTDOWN_EXIT_CODE = 0,
+ ERROR_EXIT_CODE = 1,
+ RESTART_EXIT_CODE = 2,
+};
+
/// Timers for different object refresh rates
enum WorldTimers
{
@@ -61,8 +68,7 @@ enum WorldTimers
WUPDATE_UPTIME = 4,
WUPDATE_CORPSES = 5,
WUPDATE_EVENTS = 6,
- WUPDATE_COUNT = 7,
-
+ WUPDATE_COUNT = 7
};
/// Configuration elements
@@ -105,6 +111,8 @@ enum WorldConfigs
CONFIG_INSTANCE_IGNORE_LEVEL,
CONFIG_INSTANCE_IGNORE_RAID,
CONFIG_BATTLEGROUND_CAST_DESERTER,
+ CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_ENABLE,
+ CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_PLAYERONLY,
CONFIG_INSTANCE_RESET_TIME_HOUR,
CONFIG_INSTANCE_UNLOAD_DELAY,
CONFIG_CAST_UNSTUCK,
@@ -143,6 +151,7 @@ enum WorldConfigs
CONFIG_WORLD_BOSS_LEVEL_DIFF,
CONFIG_QUEST_LOW_LEVEL_HIDE_DIFF,
CONFIG_QUEST_HIGH_LEVEL_HIDE_DIFF,
+ CONFIG_DETECT_POS_COLLISION,
CONFIG_RESTRICTED_LFG_CHANNEL,
CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL,
CONFIG_TALENTS_INSPECTING,
@@ -316,27 +325,26 @@ enum RealmZone
/// Storage class for commands issued for delayed execution
struct CliCommandHolder
{
- typedef void Print(const char*);
+ typedef void Print(const char*);
- char *m_command;
- Print* m_print;
+ char *m_command;
+ Print* m_print;
- CliCommandHolder(const char *command, Print* zprint)
- : m_print(zprint)
- {
- size_t len = strlen(command)+1;
- m_command = new char[len];
- memcpy(m_command, command, len);
- }
+ CliCommandHolder(const char *command, Print* zprint)
+ : m_print(zprint)
+ {
+ size_t len = strlen(command)+1;
+ m_command = new char[len];
+ memcpy(m_command, command, len);
+ }
- ~CliCommandHolder() { delete[] m_command; }
+ ~CliCommandHolder() { delete[] m_command; }
};
/// The World
class World
{
public:
- static volatile bool m_stopEvent;
static volatile uint32 m_worldLoopCounter;
World();
@@ -344,7 +352,6 @@ class World
WorldSession* FindSession(uint32 id) const;
void AddSession(WorldSession *s);
-
bool RemoveSession(uint32 id);
/// Get the number of current active sessions
void UpdateMaxSessionCounters();
@@ -407,18 +414,20 @@ class World
void SetInitialWorldSettings();
void LoadConfigSettings(bool reload = false);
- void SendWorldText(int32 string_id, ...);
+ void SendWorldText(int32 string_id, ...);
void SendGlobalMessage(WorldPacket *packet, WorldSession *self = 0, uint32 team = 0);
void SendZoneMessage(uint32 zone, WorldPacket *packet, WorldSession *self = 0, uint32 team = 0);
void SendZoneText(uint32 zone, const char *text, WorldSession *self = 0, uint32 team = 0);
void SendServerMessage(uint32 type, const char *text = "", Player* player = NULL);
/// Are we in the middle of a shutdown?
- uint32 GetShutdownMask() const { return m_ShutdownMask; }
bool IsShutdowning() const { return m_ShutdownTimer > 0; }
- void ShutdownServ(uint32 time, uint32 options = 0);
+ void ShutdownServ(uint32 time, uint32 options, uint8 exitcode);
void ShutdownCancel();
void ShutdownMsg(bool show = false, Player* player = NULL);
+ static uint8 GetExitCode() { return m_ExitCode; }
+ static void StopNow(uint8 exitcode) { m_stopEvent = true; m_ExitCode = exitcode; }
+ static bool IsStopped() { return m_stopEvent; }
void Update(time_t diff);
@@ -453,7 +462,7 @@ class World
void KickAllLess(AccountTypes sec);
void KickAllQueued();
BanReturn BanAccount(BanMode mode, std::string nameOrIP, std::string duration, std::string reason, std::string author);
- bool RemoveBanAccount(BanMode mode, std::string nameOrIP);
+ bool RemoveBanAccount(BanMode mode, std::string nameOrIP);
void ScriptsStart(std::map<uint32, std::multimap<uint32, ScriptInfo> > const& scripts, uint32 id, Object* source, Object* target);
void ScriptCommandStart(ScriptInfo const& script, uint32 delay, Object* source, Object* target);
@@ -481,13 +490,13 @@ class World
LocaleConstant GetAvailableDbcLocale(LocaleConstant locale) const { if(m_availableDbcLocaleMask & (1 << locale)) return locale; else return m_defaultDbcLocale; }
- //used World DB version
- void LoadDBVersion();
- char const* GetDBVersion() { return m_DBVersion.c_str(); }
+ //used World DB version
+ void LoadDBVersion();
+ char const* GetDBVersion() { return m_DBVersion.c_str(); }
- //used Script version
- void SetScriptsVersion(char const* version) { m_ScriptsVersion = version ? version : "unknown scripting library"; }
- char const* GetScriptsVersion() { return m_ScriptsVersion.c_str(); }
+ //used Script version
+ void SetScriptsVersion(char const* version) { m_ScriptsVersion = version ? version : "unknown scripting library"; }
+ char const* GetScriptsVersion() { return m_ScriptsVersion.c_str(); }
protected:
void _UpdateGameTime();
@@ -498,6 +507,11 @@ class World
void InitDailyQuestResetTime();
void ResetDailyQuests();
private:
+ static volatile bool m_stopEvent;
+ static uint8 m_ExitCode;
+ uint32 m_ShutdownTimer;
+ uint32 m_ShutdownMask;
+
time_t m_startTime;
time_t m_gameTime;
IntervalTimer m_timers[WUPDATE_COUNT];
@@ -525,9 +539,6 @@ class World
std::string m_dataPath;
std::set<uint32> m_forbiddenMapIds;
- uint32 m_ShutdownTimer;
- uint32 m_ShutdownMask;
-
// for max speed access
static float m_MaxVisibleDistanceForCreature;
static float m_MaxVisibleDistanceForPlayer;
@@ -545,14 +556,14 @@ class World
//Player Queue
Queue m_QueuedPlayer;
-
+
//sessions that are added async
void AddSession_(WorldSession* s);
ZThread::LockedQueue<WorldSession*, ZThread::FastMutex> addSessQueue;
- //used versions
- std::string m_DBVersion;
- std::string m_ScriptsVersion;
+ //used versions
+ std::string m_DBVersion;
+ std::string m_ScriptsVersion;
};
extern uint32 realmID;