Server counts the players correctly.
Was missing the PlayerDestroying() call, so players weren't removed from the playercount.
This commit is contained in:
parent
f8757d3606
commit
17b2353d71
@ -112,6 +112,9 @@ cPlayer::~cPlayer(void)
|
|||||||
{
|
{
|
||||||
LOGD("Deleting cPlayer \"%s\" at %p, ID %d", m_PlayerName.c_str(), this, GetUniqueID());
|
LOGD("Deleting cPlayer \"%s\" at %p, ID %d", m_PlayerName.c_str(), this, GetUniqueID());
|
||||||
|
|
||||||
|
// Notify the server that the player is being destroyed
|
||||||
|
cRoot::Get()->GetServer()->PlayerDestroying(this);
|
||||||
|
|
||||||
SaveToDisk();
|
SaveToDisk();
|
||||||
|
|
||||||
m_World->RemovePlayer( this );
|
m_World->RemovePlayer( this );
|
||||||
|
@ -183,7 +183,7 @@ void cServer::PlayerCreated(const cPlayer * a_Player)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void cServer::PlayerDestroyed(const cPlayer * a_Player)
|
void cServer::PlayerDestroying(const cPlayer * a_Player)
|
||||||
{
|
{
|
||||||
// To avoid deadlocks, the player count is not handled directly, but rather posted onto the tick thread
|
// To avoid deadlocks, the player count is not handled directly, but rather posted onto the tick thread
|
||||||
cCSLock Lock(m_CSPlayerCountDiff);
|
cCSLock Lock(m_CSPlayerCountDiff);
|
||||||
|
@ -81,8 +81,8 @@ public: // tolua_export
|
|||||||
/// Notifies the server that a player was created; the server uses this to adjust the number of players
|
/// Notifies the server that a player was created; the server uses this to adjust the number of players
|
||||||
void PlayerCreated(const cPlayer * a_Player);
|
void PlayerCreated(const cPlayer * a_Player);
|
||||||
|
|
||||||
/// Notifies the server that a player was destroyed; the server uses this to adjust the number of players
|
/// Notifies the server that a player is being destroyed; the server uses this to adjust the number of players
|
||||||
void PlayerDestroyed(const cPlayer * a_Player);
|
void PlayerDestroying(const cPlayer * a_Player);
|
||||||
|
|
||||||
CryptoPP::RSA::PrivateKey & GetPrivateKey(void) { return m_PrivateKey; }
|
CryptoPP::RSA::PrivateKey & GetPrivateKey(void) { return m_PrivateKey; }
|
||||||
CryptoPP::RSA::PublicKey & GetPublicKey (void) { return m_PublicKey; }
|
CryptoPP::RSA::PublicKey & GetPublicKey (void) { return m_PublicKey; }
|
||||||
|
Loading…
Reference in New Issue
Block a user