diff options
| author | Shauren <shauren.trinity@gmail.com> | 2020-09-04 13:38:24 +0200 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2020-09-04 13:38:24 +0200 |
| commit | b23190393248455f04d3a06def030a1ec7efad1e (patch) | |
| tree | 1ce3772314492dcdb985641269a3114813d4b4dc /src/server/game/World | |
| parent | b20acfe701e6f5f995f2776f076d3c494c02e1aa (diff) | |
Core/Misc: Port all the refactors sneaked in master to 3.3.5 include cleanup port
Diffstat (limited to 'src/server/game/World')
| -rw-r--r-- | src/server/game/World/World.cpp | 22 | ||||
| -rw-r--r-- | src/server/game/World/World.h | 9 |
2 files changed, 15 insertions, 16 deletions
diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index e7335bb766f..f4a1a4fc2aa 100644 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -60,6 +60,7 @@ #include "IPLocation.h" #include "Language.h" #include "LFGMgr.h" +#include "Log.h" #include "LootItemStorage.h" #include "LootMgr.h" #include "M2Stores.h" @@ -68,7 +69,6 @@ #include "Metric.h" #include "MiscPackets.h" #include "MMapFactory.h" -#include "Object.h" #include "ObjectAccessor.h" #include "ObjectMgr.h" #include "OutdoorPvPMgr.h" @@ -1405,7 +1405,7 @@ void World::LoadConfigSettings(bool reload) #if TRINITY_PLATFORM == TRINITY_PLATFORM_UNIX || TRINITY_PLATFORM == TRINITY_PLATFORM_APPLE if (dataPath[0] == '~') { - const char* home = getenv("HOME"); + char const* home = getenv("HOME"); if (home) dataPath.replace(0, 1, home); } @@ -2779,7 +2779,7 @@ void World::SendGMText(uint32 string_id, ...) } /// DEPRECATED, only for debug purpose. Send a System Message to all players (except self if mentioned) -void World::SendGlobalText(const char* text, WorldSession* self) +void World::SendGlobalText(char const* text, WorldSession* self) { // need copy to prevent corruption by strtok call in LineFromMessage original string char* buf = strdup(text); @@ -2819,7 +2819,7 @@ bool World::SendZoneMessage(uint32 zone, WorldPacket const* packet, WorldSession } /// Send a System Message to all players in the zone (except self if mentioned) -void World::SendZoneText(uint32 zone, const char* text, WorldSession* self, uint32 team) +void World::SendZoneText(uint32 zone, char const* text, WorldSession* self, uint32 team) { WorldPackets::Chat::Chat packet; packet.Initialize(CHAT_MSG_SYSTEM, LANG_UNIVERSAL, nullptr, nullptr, text); @@ -3142,7 +3142,7 @@ void World::SendServerMessage(ServerMessageType messageID, std::string stringPar chatServerMessage.StringParam = stringParam; if (player) - player->GetSession()->SendPacket(chatServerMessage.Write()); + player->SendDirectMessage(chatServerMessage.Write()); else SendGlobalMessage(chatServerMessage.Write()); } @@ -3258,9 +3258,9 @@ void World::_UpdateRealmCharCount(PreparedQueryResult resultCharCount) void World::InitWeeklyQuestResetTime() { - time_t wstime = sWorld->getWorldState(WS_WEEKLY_QUEST_RESET_TIME); + time_t wstime = uint64(sWorld->getWorldState(WS_WEEKLY_QUEST_RESET_TIME)); time_t curtime = time(nullptr); - m_NextWeeklyQuestReset = wstime < curtime ? curtime : wstime; + m_NextWeeklyQuestReset = wstime < curtime ? curtime : time_t(wstime); } void World::InitDailyQuestResetTime(bool loading) @@ -3300,16 +3300,16 @@ void World::InitDailyQuestResetTime(bool loading) void World::InitMonthlyQuestResetTime() { - time_t wstime = sWorld->getWorldState(WS_MONTHLY_QUEST_RESET_TIME); + time_t wstime = uint64(sWorld->getWorldState(WS_MONTHLY_QUEST_RESET_TIME)); time_t curtime = time(nullptr); - m_NextMonthlyQuestReset = wstime < curtime ? curtime : wstime; + m_NextMonthlyQuestReset = wstime < curtime ? curtime : time_t(wstime); } void World::InitRandomBGResetTime() { time_t bgtime = sWorld->getWorldState(WS_BG_DAILY_RESET_TIME); if (!bgtime) - m_NextRandomBGReset = time(nullptr); // game time not yet init + m_NextRandomBGReset = time(nullptr); // game time not yet init // generate time by config time_t curTime = time(nullptr); @@ -3337,7 +3337,7 @@ void World::InitGuildResetTime() { time_t gtime = getWorldState(WS_GUILD_DAILY_RESET_TIME); if (!gtime) - m_NextGuildReset = time(nullptr); // game time not yet init + m_NextGuildReset = time(nullptr); // game time not yet init // generate time by config time_t curTime = time(nullptr); diff --git a/src/server/game/World/World.h b/src/server/game/World/World.h index cd14025fce1..1f32f9630fb 100644 --- a/src/server/game/World/World.h +++ b/src/server/game/World/World.h @@ -560,13 +560,12 @@ enum WorldStates /// Storage class for commands issued for delayed execution struct TC_GAME_API CliCommandHolder { - typedef void(*Print)(void*, const char*); + typedef void(*Print)(void*, char const*); typedef void(*CommandFinished)(void*, bool success); void* m_callbackArg; - char *m_command; + char* m_command; Print m_print; - CommandFinished m_commandFinished; CliCommandHolder(void* callbackArg, char const* command, Print zprint, CommandFinished commandFinished); @@ -594,7 +593,7 @@ class TC_GAME_API World bool RemoveSession(uint32 id); /// Get the number of current active sessions void UpdateMaxSessionCounters(); - const SessionMap& GetAllSessions() const { return m_sessions; } + SessionMap const& GetAllSessions() const { return m_sessions; } uint32 GetActiveAndQueuedSessionCount() const { return uint32(m_sessions.size()); } uint32 GetActiveSessionCount() const { return uint32(m_sessions.size() - m_QueuedPlayer.size()); } uint32 GetQueuedSessionCount() const { return uint32(m_QueuedPlayer.size()); } @@ -673,7 +672,7 @@ class TC_GAME_API World void LoadConfigSettings(bool reload = false); void SendWorldText(uint32 string_id, ...); - void SendGlobalText(const char* text, WorldSession* self); + void SendGlobalText(char const* text, WorldSession* self); void SendGMText(uint32 string_id, ...); void SendServerMessage(ServerMessageType messageID, std::string stringParam = "", Player* player = nullptr); void SendGlobalMessage(WorldPacket const* packet, WorldSession* self = nullptr, uint32 team = 0); |
