Fixed a crash bug
This commit is contained in:
parent
a3759c1462
commit
6de8c09fe0
|
@ -230,7 +230,7 @@ void cClientHandle::Authenticate(void)
|
||||||
if (!cRoot::Get()->GetPluginManager()->CallHookPlayerJoined(*m_Player))
|
if (!cRoot::Get()->GetPluginManager()->CallHookPlayerJoined(*m_Player))
|
||||||
{
|
{
|
||||||
AString JoinMessage;
|
AString JoinMessage;
|
||||||
AppendPrintf(JoinMessage, "%s[JOIN] %s%s has joined the game", cChatColor::Yellow.c_str(), cChatColor::White.c_str(), m_Username.c_str());
|
AppendPrintf(JoinMessage, "%s[JOIN] %s%s has joined the game", cChatColor::Yellow.c_str(), cChatColor::White.c_str(), GetUsername().c_str());
|
||||||
cRoot::Get()->BroadcastChat(JoinMessage);
|
cRoot::Get()->BroadcastChat(JoinMessage);
|
||||||
LOGINFO("Player %s has joined the game.", m_Username.c_str());
|
LOGINFO("Player %s has joined the game.", m_Username.c_str());
|
||||||
}
|
}
|
||||||
|
@ -2461,13 +2461,7 @@ void cClientHandle::SocketClosed(void)
|
||||||
|
|
||||||
if (m_Username != "") // Ignore client pings
|
if (m_Username != "") // Ignore client pings
|
||||||
{
|
{
|
||||||
if (!cRoot::Get()->GetPluginManager()->CallHookDisconnect(m_Player, "Player disconnected"))
|
cRoot::Get()->GetPluginManager()->CallHookDisconnect(m_Player, "Player disconnected");
|
||||||
{
|
|
||||||
AString DisconnectMessage;
|
|
||||||
Printf(DisconnectMessage, "%s[LEAVE] %s%s has left the game", cChatColor::Yellow.c_str(), cChatColor::White.c_str(), m_Username.c_str());
|
|
||||||
cRoot::Get()->BroadcastChat(DisconnectMessage);
|
|
||||||
LOGINFO("Player %s has left the game.", m_Username.c_str());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Destroy();
|
Destroy();
|
||||||
|
|
|
@ -133,12 +133,12 @@ cPlayer::~cPlayer(void)
|
||||||
if (!cRoot::Get()->GetPluginManager()->CallHookPlayerDestroyed(*this))
|
if (!cRoot::Get()->GetPluginManager()->CallHookPlayerDestroyed(*this))
|
||||||
{
|
{
|
||||||
AString DisconnectMessage;
|
AString DisconnectMessage;
|
||||||
AppendPrintf(DisconnectMessage, "%s[LEAVE] %s%s has left the game", cChatColor::Yellow.c_str(), cChatColor::White.c_str(), GetClientHandle()->GetUsername().c_str());
|
AppendPrintf(DisconnectMessage, "%s[LEAVE] %s%s has left the game", cChatColor::Yellow.c_str(), cChatColor::White.c_str(), GetName().c_str());
|
||||||
cRoot::Get()->BroadcastChat(DisconnectMessage);
|
cRoot::Get()->BroadcastChat(DisconnectMessage);
|
||||||
LOGINFO("Player %s has left the game.", GetClientHandle()->GetUsername().c_str());
|
LOGINFO("Player %s has left the game.", GetName().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
LOGD("Deleting cPlayer \"%s\" at %p, ID %d", m_PlayerName.c_str(), this, GetUniqueID());
|
LOGD("Deleting cPlayer \"%s\" at %p, ID %d", GetName().c_str(), this, GetUniqueID());
|
||||||
|
|
||||||
// Notify the server that the player is being destroyed
|
// Notify the server that the player is being destroyed
|
||||||
cRoot::Get()->GetServer()->PlayerDestroying(this);
|
cRoot::Get()->GetServer()->PlayerDestroying(this);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user