Core: header cleanup, split realmlist, boost compatibility, cotire, remove stormlib/zlib and stormlib/bzip2 and instead use dep sources

This commit is contained in:
ariel- committed 2018-03-28 04:41:59 -03:00
1 parent 7fff6c424f
commit 5ff847159c
1243 files changed
+29780 -36517

No files matched your search

+60 -51
View File
@@ -20,36 +20,37 @@
\ingroup u2w
*/
#include "WorldSocket.h"
#include "Config.h"
#include "Common.h"
#include "DatabaseEnv.h"
#include "QueryCallback.h"
#include "AccountMgr.h"
#include "Log.h"
#include "Opcodes.h"
#include "WorldPacket.h"
#include "WorldSession.h"
#include "Player.h"
#include "Vehicle.h"
#include "ObjectMgr.h"
#include "GuildMgr.h"
#include "AccountMgr.h"
#include "AddonMgr.h"
#include "BattlegroundMgr.h"
#include "BattlenetServerManager.h"
#include "Common.h"
#include "Config.h"
#include "DatabaseEnv.h"
#include "Group.h"
#include "Guild.h"
#include "World.h"
#include "ObjectAccessor.h"
#include "BattlegroundMgr.h"
#include "OutdoorPvPMgr.h"
#include "GuildMgr.h"
#include "Log.h"
#include "MapManager.h"
#include "SocialMgr.h"
#include "ScriptMgr.h"
#include "Transport.h"
#include "WardenWin.h"
#include "WardenMac.h"
#include "WardenMac.h"
#include "Metric.h"
#include "BattlenetServerManager.h"
#include "ObjectAccessor.h"
#include "ObjectMgr.h"
#include "Opcodes.h"
#include "OutdoorPvPMgr.h"
#include "Player.h"
#include "QueryCallback.h"
#include "QueryHolder.h"
#include "ScriptMgr.h"
#include "SocialMgr.h"
#include "Transport.h"
#include "Vehicle.h"
#include "WardenMac.h"
#include "WardenMac.h"
#include "WardenWin.h"
#include "World.h"
#include "WorldPacket.h"
#include "WorldSocket.h"
#include <zlib.h>
namespace {
@@ -106,14 +107,14 @@ WorldSession::WorldSession(uint32 id, std::string&& name, uint32 battlenetAccoun
m_timeOutTime(0),
AntiDOS(this),
m_GUIDLow(0),
_player(NULL),
_player(nullptr),
m_Socket(sock),
_security(sec),
_accountId(id),
_accountName(std::move(name)),
_battlenetAccountId(battlenetAccountId),
m_expansion(expansion),
_warden(NULL),
_warden(nullptr),
_logoutTime(0),
m_inQueue(false),
m_playerLoading(false),
@@ -128,7 +129,7 @@ WorldSession::WorldSession(uint32 id, std::string&& name, uint32 battlenetAccoun
_filterAddonMessages(false),
recruiterId(recruiter),
isRecruiter(isARecruiter),
_RBACData(NULL),
_RBACData(nullptr),
expireTime(60000), // 1 min after socket loss, session is deleted
forceExit(false),
m_currentBankerGUID()
@@ -143,11 +144,11 @@ WorldSession::WorldSession(uint32 id, std::string&& name, uint32 battlenetAccoun
}
_compressionStream = new z_stream();
_compressionStream->zalloc = (alloc_func)NULL;
_compressionStream->zfree = (free_func)NULL;
_compressionStream->opaque = (voidpf)NULL;
_compressionStream->zalloc = (alloc_func)nullptr;
_compressionStream->zfree = (free_func)nullptr;
_compressionStream->opaque = (voidpf)nullptr;
_compressionStream->avail_in = 0;
_compressionStream->next_in = NULL;
_compressionStream->next_in = nullptr;
int32 z_res = deflateInit(_compressionStream, sWorld->getIntConfig(CONFIG_COMPRESSION));
if (z_res != Z_OK)
TC_LOG_ERROR("network", "Can't initialize packet compression (zlib: deflateInit) Error code: %i (%s)", z_res, zError(z_res));
@@ -171,7 +172,7 @@ WorldSession::~WorldSession()
delete _RBACData;
///- empty incoming packet queue
WorldPacket* packet = NULL;
WorldPacket* packet = nullptr;
while (_recvQueue.next(packet))
delete packet;
@@ -186,7 +187,7 @@ WorldSession::~WorldSession()
std::string const & WorldSession::GetPlayerName() const
{
return _player != NULL ? _player->GetName() : DefaultPlayerName;
return _player != nullptr ? _player->GetName() : DefaultPlayerName;
}
std::string WorldSession::GetPlayerInfo() const
@@ -240,21 +241,21 @@ void WorldSession::SendPacket(WorldPacket const* packet, bool forced /*= false*/
static uint64 sendPacketCount = 0;
static uint64 sendPacketBytes = 0;
static time_t firstTime = time(NULL);
static time_t firstTime = time(nullptr);
static time_t lastTime = firstTime; // next 60 secs start time
static uint64 sendLastPacketCount = 0;
static uint64 sendLastPacketBytes = 0;
time_t cur_time = time(NULL);
time_t cur_time = time(nullptr);
if ((cur_time - lastTime) < 60)
{
sendPacketCount+=1;
sendPacketBytes+=packet->size();
sendPacketCount += 1;
sendPacketBytes += packet->size();
sendLastPacketCount+=1;
sendLastPacketBytes+=packet->size();
sendLastPacketCount += 1;
sendLastPacketBytes += packet->size();
}
else
{
@@ -282,7 +283,7 @@ void WorldSession::QueuePacket(WorldPacket* new_packet)
}
/// Logging helper for unexpected opcodes
void WorldSession::LogUnexpectedOpcode(WorldPacket* packet, const char* status, const char *reason)
void WorldSession::LogUnexpectedOpcode(WorldPacket* packet, char const* status, const char *reason)
{
TC_LOG_ERROR("network.opcode", "Received unexpected opcode %s Status: %s Reason: %s from %s",
GetOpcodeNameForLogging(packet->GetOpcode()).c_str(), status, reason, GetPlayerInfo().c_str());
@@ -312,12 +313,12 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
///- Retrieve packets from the receive queue and call the appropriate handlers
/// not process packets if socket already closed
WorldPacket* packet = NULL;
WorldPacket* packet = nullptr;
//! Delete packet after processing by default
bool deletePacket = true;
std::vector<WorldPacket*> requeuePackets;
uint32 processedPackets = 0;
time_t currentTime = time(NULL);
time_t currentTime = time(nullptr);
while (m_Socket && _recvQueue.next(packet, updater))
{
@@ -436,7 +437,7 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
//logout procedure should happen only in World::UpdateSessions() method!!!
if (updater.ProcessLogout())
{
time_t currTime = time(NULL);
time_t currTime = time(nullptr);
///- If necessary, log the player out
if (ShouldLogOut(currTime) && !m_playerLoading)
LogoutPlayer(true);
@@ -526,7 +527,7 @@ void WorldSession::LogoutPlayer(bool save)
}
}
// Repop at GraveYard or other player far teleport will prevent saving player because of not present map
// Repop at Graveyard or other player far teleport will prevent saving player because of not present map
// Teleport player immediately for correct player save
while (_player->IsBeingTeleportedFar())
HandleMoveWorldportAckOpcode();
@@ -536,7 +537,7 @@ void WorldSession::LogoutPlayer(bool save)
guild->HandleMemberLogout(this);
///- Remove pet
_player->RemovePet(NULL, PET_SAVE_AS_CURRENT, true);
_player->RemovePet(nullptr, PET_SAVE_AS_CURRENT, true);
///- Clear whisper whitelist
_player->ClearWhisperWhiteList();
@@ -596,7 +597,7 @@ void WorldSession::LogoutPlayer(bool save)
if (Map* _map = _player->FindMap())
_map->RemovePlayerFromMap(_player, true);
SetPlayer(NULL); //! Pointer already deleted during RemovePlayerFromMap
SetPlayer(nullptr); //! Pointer already deleted during RemovePlayerFromMap
//! Send the 'logout complete' packet to the client
//! Client will respond by sending 3x CMSG_CANCEL_TRADE, which we currently dont handle
@@ -672,6 +673,11 @@ char const* WorldSession::GetTrinityString(uint32 entry) const
return sObjectMgr->GetTrinityString(entry, GetSessionDbLocaleIndex());
}
void WorldSession::ResetTimeOutTime()
{
m_timeOutTime = int32(sWorld->getIntConfig(CONFIG_SOCKET_TIMEOUTTIME));
}
void WorldSession::Handle_NULL(WorldPacket& recvPacket)
{
TC_LOG_ERROR("network.opcode", "Received unhandled opcode %s from %s"
@@ -764,7 +770,7 @@ void WorldSession::SetAccountData(AccountDataType type, time_t tm, std::string c
}
else
{
// _player can be NULL and packet received after logout but m_GUID still store correct guid
// _player can be nullptr and packet received after logout but m_GUID still store correct guid
if (!m_GUIDLow)
return;
@@ -786,7 +792,7 @@ void WorldSession::SetAccountData(AccountDataType type, time_t tm, std::string c
void WorldSession::SendAccountDataTimes(uint32 mask)
{
WorldPacket data(SMSG_ACCOUNT_DATA_TIMES, 4 + 1 + 4 + NUM_ACCOUNT_DATA_TYPES * 4);
data << uint32(time(NULL)); // Server time
data << uint32(time(nullptr)); // Server time
data << uint8(1);
data << uint32(mask); // type mask
for (uint32 i = 0; i < NUM_ACCOUNT_DATA_TYPES; ++i)
@@ -1167,7 +1173,7 @@ void WorldSession::InvalidateRBACData()
TC_LOG_DEBUG("rbac", "WorldSession::Invalidaterbac::RBACData [AccountId: %u, Name: %s, realmId: %d]",
_RBACData->GetId(), _RBACData->GetName().c_str(), realm.Id.Realm);
delete _RBACData;
_RBACData = NULL;
_RBACData = nullptr;
}
bool WorldSession::DosProtection::EvaluateOpcode(WorldPacket& p, time_t time) const
@@ -1224,7 +1230,6 @@ bool WorldSession::DosProtection::EvaluateOpcode(WorldPacket& p, time_t time) co
}
}
uint32 WorldSession::DosProtection::GetMaxPacketCounterAllowed(uint16 opcode) const
{
uint32 maxPacketCounterAllowed;
@@ -1472,3 +1477,7 @@ uint32 WorldSession::DosProtection::GetMaxPacketCounterAllowed(uint16 opcode) co
return maxPacketCounterAllowed;
}
WorldSession::DosProtection::DosProtection(WorldSession* s) : Session(s), _policy((Policy)sWorld->getIntConfig(CONFIG_PACKET_SPOOF_POLICY))
{
}