summaryrefslogtreecommitdiffstats
path: root/source/cClientHandle.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--source/cClientHandle.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/source/cClientHandle.cpp b/source/cClientHandle.cpp
index 66d343784..05bdec249 100644
--- a/source/cClientHandle.cpp
+++ b/source/cClientHandle.cpp
@@ -178,6 +178,16 @@ cClientHandle::~cClientHandle()
if( m_LoadedChunks[i] ) m_LoadedChunks[i]->RemoveClient( this );
}
+ cWorld::PlayerList PlayerList = cRoot::Get()->GetWorld()->GetAllPlayers();
+ for( cWorld::PlayerList::iterator itr = PlayerList.begin(); itr != PlayerList.end(); ++itr )
+ {
+ if ((*itr) && (*itr)->GetClientHandle() && strlen(GetUsername()) > 0)
+ {
+ cPacket_PlayerListItem *PlayerList = new cPacket_PlayerListItem(m_Player->GetColor() + GetUsername(), false, (short)9999);
+ (*itr)->GetClientHandle()->Send( *PlayerList );
+ }
+ }
+
// First stop sending thread
m_bKeepThreadGoing = false;
@@ -1162,12 +1172,6 @@ void cClientHandle::HandlePacket( cPacket* a_Packet )
{
cPacket_Chat DisconnectMessage( m_pState->Username + " disconnected: " + PacketData->m_Reason );
cRoot::Get()->GetServer()->Broadcast( DisconnectMessage );
- cWorld::PlayerList PlayerList = cRoot::Get()->GetWorld()->GetAllPlayers();
- for( cWorld::PlayerList::iterator itr = PlayerList.begin(); itr != PlayerList.end(); ++itr )
- {
- cPacket_PlayerListItem *PlayerList = new cPacket_PlayerListItem(m_Player->GetColor() + GetUsername(), false, (short)9999);
- (*itr)->GetClientHandle()->Send( *PlayerList );
- }
}
Destroy();
return;