mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 01:37:00 +00:00
* Small code cleanups and code style apply
This commit is contained in:
parent
8c6c66afe0
commit
58a1dd7209
2 changed files with 19 additions and 20 deletions
|
|
@ -379,7 +379,7 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
|
||||||
data << (uint8)CHAR_CREATE_SUCCESS;
|
data << (uint8)CHAR_CREATE_SUCCESS;
|
||||||
SendPacket( &data );
|
SendPacket( &data );
|
||||||
|
|
||||||
std::string IP_str = GetRemoteAddress().c_str();
|
std::string IP_str = GetRemoteAddress();
|
||||||
sLog.outBasic("Account: %d (IP: %s) Create Character:[%s]",GetAccountId(),IP_str.c_str(),name.c_str());
|
sLog.outBasic("Account: %d (IP: %s) Create Character:[%s]",GetAccountId(),IP_str.c_str(),name.c_str());
|
||||||
sLog.outChar("Account: %d (IP: %s) Create Character:[%s]",GetAccountId(),IP_str.c_str(),name.c_str());
|
sLog.outChar("Account: %d (IP: %s) Create Character:[%s]",GetAccountId(),IP_str.c_str(),name.c_str());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -47,11 +47,11 @@ _player(NULL), m_Socket(sock),_security(sec), _accountId(id), m_expansion(expans
|
||||||
m_sessionDbcLocale(sWorld.GetAvailableDbcLocale(locale)), m_sessionDbLocaleIndex(objmgr.GetIndexForLocale(locale)),
|
m_sessionDbcLocale(sWorld.GetAvailableDbcLocale(locale)), m_sessionDbLocaleIndex(objmgr.GetIndexForLocale(locale)),
|
||||||
_logoutTime(0), m_playerLoading(false), m_playerLogout(false), m_playerRecentlyLogout(false), m_latency(0)
|
_logoutTime(0), m_playerLoading(false), m_playerLogout(false), m_playerRecentlyLogout(false), m_latency(0)
|
||||||
{
|
{
|
||||||
if (sock)
|
if (sock)
|
||||||
{
|
{
|
||||||
m_Address = sock->GetRemoteAddress ();
|
m_Address = sock->GetRemoteAddress ();
|
||||||
sock->AddReference ();
|
sock->AddReference ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// WorldSession destructor
|
/// WorldSession destructor
|
||||||
|
|
@ -96,7 +96,9 @@ void WorldSession::SendPacket(WorldPacket const* packet)
|
||||||
{
|
{
|
||||||
if (!m_Socket)
|
if (!m_Socket)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#ifdef MANGOS_DEBUG
|
#ifdef MANGOS_DEBUG
|
||||||
|
|
||||||
// Code for network use statistic
|
// Code for network use statistic
|
||||||
static uint64 sendPacketCount = 0;
|
static uint64 sendPacketCount = 0;
|
||||||
static uint64 sendPacketBytes = 0;
|
static uint64 sendPacketBytes = 0;
|
||||||
|
|
@ -128,12 +130,11 @@ void WorldSession::SendPacket(WorldPacket const* packet)
|
||||||
sendLastPacketCount = 1;
|
sendLastPacketCount = 1;
|
||||||
sendLastPacketBytes = packet->wpos(); // wpos is real written size
|
sendLastPacketBytes = packet->wpos(); // wpos is real written size
|
||||||
}
|
}
|
||||||
#endif // !MANGOS_DEBUG
|
|
||||||
|
|
||||||
if (m_Socket->SendPacket (*packet) == -1)
|
#endif // !MANGOS_DEBUG
|
||||||
{
|
|
||||||
m_Socket->CloseSocket ();
|
if (m_Socket->SendPacket (*packet) == -1)
|
||||||
}
|
m_Socket->CloseSocket ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Add an incoming packet to the queue
|
/// Add an incoming packet to the queue
|
||||||
|
|
@ -154,12 +155,11 @@ void WorldSession::logUnexpectedOpcode(WorldPacket* packet, const char *reason)
|
||||||
/// Update the WorldSession (triggered by World update)
|
/// Update the WorldSession (triggered by World update)
|
||||||
bool WorldSession::Update(uint32 /*diff*/)
|
bool WorldSession::Update(uint32 /*diff*/)
|
||||||
{
|
{
|
||||||
if (m_Socket)
|
if (m_Socket && m_Socket->IsClosed ())
|
||||||
if (m_Socket->IsClosed ())
|
{
|
||||||
{
|
|
||||||
m_Socket->RemoveReference ();
|
m_Socket->RemoveReference ();
|
||||||
m_Socket = NULL;
|
m_Socket = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
WorldPacket *packet;
|
WorldPacket *packet;
|
||||||
|
|
||||||
|
|
@ -386,7 +386,8 @@ void WorldSession::LogoutPlayer(bool Save)
|
||||||
|
|
||||||
///- Since each account can only have one online character at any given time, ensure all characters for active account are marked as offline
|
///- Since each account can only have one online character at any given time, ensure all characters for active account are marked as offline
|
||||||
//No SQL injection as AccountId is uint32
|
//No SQL injection as AccountId is uint32
|
||||||
CharacterDatabase.PExecute("UPDATE characters SET online = 0 WHERE account = '%u'", GetAccountId());
|
CharacterDatabase.PExecute("UPDATE characters SET online = 0 WHERE account = '%u'",
|
||||||
|
GetAccountId());
|
||||||
sLog.outDebug( "SESSION: Sent SMSG_LOGOUT_COMPLETE Message" );
|
sLog.outDebug( "SESSION: Sent SMSG_LOGOUT_COMPLETE Message" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -398,10 +399,8 @@ void WorldSession::LogoutPlayer(bool Save)
|
||||||
/// Kick a player out of the World
|
/// Kick a player out of the World
|
||||||
void WorldSession::KickPlayer()
|
void WorldSession::KickPlayer()
|
||||||
{
|
{
|
||||||
if (m_Socket)
|
if (m_Socket)
|
||||||
{
|
m_Socket->CloseSocket ();
|
||||||
m_Socket->CloseSocket ();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Cancel channeling handler
|
/// Cancel channeling handler
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue