diff options
author | madmaxoft <github@xoft.cz> | 2013-08-19 09:13:19 +0200 |
---|---|---|
committer | madmaxoft <github@xoft.cz> | 2013-08-19 09:13:19 +0200 |
commit | 82ce40e2cc8694233fad96b464367a55a5cee680 (patch) | |
tree | 9a39b2e07478fa8e0f1542684e6da690de52c2fc | |
parent | Fixed crash when the player is above the world. (diff) | |
download | cuberite-82ce40e2cc8694233fad96b464367a55a5cee680.tar cuberite-82ce40e2cc8694233fad96b464367a55a5cee680.tar.gz cuberite-82ce40e2cc8694233fad96b464367a55a5cee680.tar.bz2 cuberite-82ce40e2cc8694233fad96b464367a55a5cee680.tar.lz cuberite-82ce40e2cc8694233fad96b464367a55a5cee680.tar.xz cuberite-82ce40e2cc8694233fad96b464367a55a5cee680.tar.zst cuberite-82ce40e2cc8694233fad96b464367a55a5cee680.zip |
Diffstat (limited to '')
-rw-r--r-- | source/Chunk.cpp | 24 | ||||
-rw-r--r-- | source/Chunk.h | 1 |
2 files changed, 5 insertions, 20 deletions
diff --git a/source/Chunk.cpp b/source/Chunk.cpp index a2cfb7ead..cec4f7f25 100644 --- a/source/Chunk.cpp +++ b/source/Chunk.cpp @@ -573,20 +573,11 @@ void cChunk::ProcessQueuedSetBlocks(void) void cChunk::BroadcastPendingBlockChanges(void) { - sSetBlockVector Changes; - { - cCSLock Lock(m_CSBlockLists); - if (m_PendingSendBlocks.empty()) - { - return; - } - std::swap(Changes, m_PendingSendBlocks); - } - for (cClientHandleList::iterator itr = m_LoadedByClient.begin(), end = m_LoadedByClient.end(); itr != end; ++itr) { - (*itr)->SendBlockChanges(m_PosX, m_PosZ, Changes); + (*itr)->SendBlockChanges(m_PosX, m_PosZ, m_PendingSendBlocks); } + m_PendingSendBlocks.clear(); } @@ -595,14 +586,12 @@ void cChunk::BroadcastPendingBlockChanges(void) void cChunk::CheckBlocks(void) { - cCSLock Lock2(m_CSBlockLists); if (m_ToTickBlocks.size() == 0) { return; } std::vector<unsigned int> ToTickBlocks; std::swap(m_ToTickBlocks, ToTickBlocks); - Lock2.Unlock(); for (std::vector<unsigned int>::const_iterator itr = ToTickBlocks.begin(), end = ToTickBlocks.end(); itr != end; ++itr) { @@ -1422,7 +1411,6 @@ void cChunk::SetBlock( int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType ) ) { - cCSLock Lock(m_CSBlockLists); m_PendingSendBlocks.push_back(sSetBlock(m_PosX, m_PosZ, a_RelX, a_RelY, a_RelZ, a_BlockType, a_BlockMeta)); } @@ -1602,7 +1590,6 @@ void cChunk::FastSetBlock(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockT ) ) { - cCSLock Lock(m_CSBlockLists); m_PendingSendBlocks.push_back(sSetBlock(m_PosX, m_PosZ, a_RelX, a_RelY, a_RelZ, a_BlockType, a_BlockMeta)); } @@ -1675,8 +1662,8 @@ void cChunk::SendBlockTo(int a_RelX, int a_RelY, int a_RelZ, cClientHandle * a_C void cChunk::AddBlockEntity(cBlockEntity * a_BlockEntity) { - cCSLock Lock(m_CSBlockLists); - m_BlockEntities.push_back( a_BlockEntity ); + MarkDirty(); + m_BlockEntities.push_back(a_BlockEntity); } @@ -1788,9 +1775,8 @@ bool cChunk::SetSignLines(int a_PosX, int a_PosY, int a_PosZ, const AString & a_ void cChunk::RemoveBlockEntity( cBlockEntity* a_BlockEntity ) { - cCSLock Lock(m_CSBlockLists); MarkDirty(); - m_BlockEntities.remove( a_BlockEntity ); + m_BlockEntities.remove(a_BlockEntity); } diff --git a/source/Chunk.h b/source/Chunk.h index cba39f7ee..16cda056c 100644 --- a/source/Chunk.h +++ b/source/Chunk.h @@ -344,7 +344,6 @@ private: bool m_IsSaving; // True if the chunk is being saved bool m_HasLoadFailed; // True if chunk failed to load and hasn't been generated yet since then - cCriticalSection m_CSBlockLists; std::vector<unsigned int> m_ToTickBlocks; sSetBlockVector m_PendingSendBlocks; ///< Blocks that have changed and need to be sent to all clients |