summaryrefslogtreecommitdiffstats
path: root/source/cChunk.cpp
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-03-22 16:53:40 +0100
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-03-22 16:53:40 +0100
commit389062a1ed8063d82ddd611f3426c9b2b088e0fc (patch)
tree50fb81d24e7849bed22b1acf04cad62f9b514450 /source/cChunk.cpp
parentAdded core.build permission to Core. Without this permission players are unable to build (diff)
downloadcuberite-389062a1ed8063d82ddd611f3426c9b2b088e0fc.tar
cuberite-389062a1ed8063d82ddd611f3426c9b2b088e0fc.tar.gz
cuberite-389062a1ed8063d82ddd611f3426c9b2b088e0fc.tar.bz2
cuberite-389062a1ed8063d82ddd611f3426c9b2b088e0fc.tar.lz
cuberite-389062a1ed8063d82ddd611f3426c9b2b088e0fc.tar.xz
cuberite-389062a1ed8063d82ddd611f3426c9b2b088e0fc.tar.zst
cuberite-389062a1ed8063d82ddd611f3426c9b2b088e0fc.zip
Diffstat (limited to '')
-rw-r--r--source/cChunk.cpp25
1 files changed, 17 insertions, 8 deletions
diff --git a/source/cChunk.cpp b/source/cChunk.cpp
index 2dde0cc0d..e48ababd0 100644
--- a/source/cChunk.cpp
+++ b/source/cChunk.cpp
@@ -1196,17 +1196,26 @@ bool cChunk::AddClient(cClientHandle* a_Client)
void cChunk::RemoveClient( cClientHandle* a_Client )
{
- m_LoadedByClient.remove( a_Client );
-
- if ( !a_Client->IsDestroyed() )
+ for (cClientHandleList::iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr)
{
- for (cEntityList::iterator itr = m_Entities.begin(); itr != m_Entities.end(); ++itr )
+ if (*itr != a_Client)
{
- LOG("chunk [%i, %i] destroying entity #%i for player \"%s\"", m_PosX, m_PosZ, (*itr)->GetUniqueID(), a_Client->GetUsername().c_str() );
- cPacket_DestroyEntity DestroyEntity( *itr );
- a_Client->Send( DestroyEntity );
+ continue;
}
- }
+
+ m_LoadedByClient.erase(itr);
+
+ if ( !a_Client->IsDestroyed() )
+ {
+ for (cEntityList::iterator itr = m_Entities.begin(); itr != m_Entities.end(); ++itr )
+ {
+ LOGD("chunk [%i, %i] destroying entity #%i for player \"%s\"", m_PosX, m_PosZ, (*itr)->GetUniqueID(), a_Client->GetUsername().c_str() );
+ cPacket_DestroyEntity DestroyEntity( *itr );
+ a_Client->Send( DestroyEntity );
+ }
+ }
+ return;
+ } // for itr - m_LoadedByClient[]
}