From 7268a70902b04e098b6b530986d9ce6d210fdd07 Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Sun, 26 Feb 2012 12:55:42 +0000 Subject: Attempt at fixing crashes with disconnecting players git-svn-id: http://mc-server.googlecode.com/svn/trunk@329 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/cEntity.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'source/cEntity.cpp') diff --git a/source/cEntity.cpp b/source/cEntity.cpp index cb91c2bdc..3df995d59 100644 --- a/source/cEntity.cpp +++ b/source/cEntity.cpp @@ -169,14 +169,18 @@ void cEntity::MoveToCorrectChunk(bool a_bIgnoreOldChunk) void cEntity::Destroy() { - if( !m_bDestroyed ) + if (m_bDestroyed) { - m_bDestroyed = true; - if( !m_bRemovedFromChunk ) - { - RemoveFromChunk(); - } + return; } + if (!m_bRemovedFromChunk) + { + RemoveFromChunk(); + } + + m_World->BroadcastToChunk(m_ChunkX, m_ChunkY, m_ChunkZ, cPacket_DestroyEntity(this)); + + m_bDestroyed = true; } -- cgit v1.2.3