[7572] Use enum type instead int for World::SendServerMessage arg Author: VladimirMangos

--HG--
branch : trunk
This commit is contained in:
megamage
2009-03-28 17:56:15 -06:00
parent bf1cb43b3a
commit 6581497411
2 changed files with 14 additions and 14 deletions
+3 -13
View File
@@ -83,16 +83,6 @@ float World::m_MaxVisibleDistanceInFlight = DEFAULT_VISIBILITY_DISTANCE;
float World::m_VisibleUnitGreyDistance = 0; float World::m_VisibleUnitGreyDistance = 0;
float World::m_VisibleObjectGreyDistance = 0; float World::m_VisibleObjectGreyDistance = 0;
// ServerMessages.dbc
enum ServerMessageType
{
SERVER_MSG_SHUTDOWN_TIME = 1,
SERVER_MSG_RESTART_TIME = 2,
SERVER_MSG_STRING = 3,
SERVER_MSG_SHUTDOWN_CANCELLED = 4,
SERVER_MSG_RESTART_CANCELLED = 5
};
struct ScriptAction struct ScriptAction
{ {
uint64 sourceGUID; uint64 sourceGUID;
@@ -3010,7 +3000,7 @@ void World::ShutdownMsg(bool show, Player* player)
{ {
std::string str = secsToTimeString(m_ShutdownTimer); std::string str = secsToTimeString(m_ShutdownTimer);
uint32 msgid = (m_ShutdownMask & SHUTDOWN_MASK_RESTART) ? SERVER_MSG_RESTART_TIME : SERVER_MSG_SHUTDOWN_TIME; ServerMessageType msgid = (m_ShutdownMask & SHUTDOWN_MASK_RESTART) ? SERVER_MSG_RESTART_TIME : SERVER_MSG_SHUTDOWN_TIME;
SendServerMessage(msgid,str.c_str(),player); SendServerMessage(msgid,str.c_str(),player);
DEBUG_LOG("Server is %s in %s",(m_ShutdownMask & SHUTDOWN_MASK_RESTART ? "restart" : "shuttingdown"),str.c_str()); DEBUG_LOG("Server is %s in %s",(m_ShutdownMask & SHUTDOWN_MASK_RESTART ? "restart" : "shuttingdown"),str.c_str());
@@ -3024,7 +3014,7 @@ void World::ShutdownCancel()
if(!m_ShutdownTimer || m_stopEvent) if(!m_ShutdownTimer || m_stopEvent)
return; return;
uint32 msgid = (m_ShutdownMask & SHUTDOWN_MASK_RESTART) ? SERVER_MSG_RESTART_CANCELLED : SERVER_MSG_SHUTDOWN_CANCELLED; ServerMessageType msgid = (m_ShutdownMask & SHUTDOWN_MASK_RESTART) ? SERVER_MSG_RESTART_CANCELLED : SERVER_MSG_SHUTDOWN_CANCELLED;
m_ShutdownMask = 0; m_ShutdownMask = 0;
m_ShutdownTimer = 0; m_ShutdownTimer = 0;
@@ -3035,7 +3025,7 @@ void World::ShutdownCancel()
} }
/// Send a server message to the user(s) /// Send a server message to the user(s)
void World::SendServerMessage(uint32 type, const char *text, Player* player) void World::SendServerMessage(ServerMessageType type, const char *text, Player* player)
{ {
WorldPacket data(SMSG_SERVER_MESSAGE, 50); // guess size WorldPacket data(SMSG_SERVER_MESSAGE, 50); // guess size
data << uint32(type); data << uint32(type);
+11 -1
View File
@@ -45,6 +45,16 @@ class SqlResultQueue;
class QueryResult; class QueryResult;
class WorldSocket; class WorldSocket;
// ServerMessages.dbc
enum ServerMessageType
{
SERVER_MSG_SHUTDOWN_TIME = 1,
SERVER_MSG_RESTART_TIME = 2,
SERVER_MSG_STRING = 3,
SERVER_MSG_SHUTDOWN_CANCELLED = 4,
SERVER_MSG_RESTART_CANCELLED = 5
};
enum ShutdownMask enum ShutdownMask
{ {
SHUTDOWN_MASK_RESTART = 1, SHUTDOWN_MASK_RESTART = 1,
@@ -475,7 +485,7 @@ class World
void SendGlobalGMMessage(WorldPacket *packet, WorldSession *self = 0, uint32 team = 0); void SendGlobalGMMessage(WorldPacket *packet, WorldSession *self = 0, uint32 team = 0);
void SendZoneMessage(uint32 zone, 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 SendZoneText(uint32 zone, const char *text, WorldSession *self = 0, uint32 team = 0);
void SendServerMessage(uint32 type, const char *text = "", Player* player = NULL); void SendServerMessage(ServerMessageType type, const char *text = "", Player* player = NULL);
/// Are we in the middle of a shutdown? /// Are we in the middle of a shutdown?
bool IsShutdowning() const { return m_ShutdownTimer > 0; } bool IsShutdowning() const { return m_ShutdownTimer > 0; }