From 82ce40e2cc8694233fad96b464367a55a5cee680 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Mon, 19 Aug 2013 09:13:19 +0200 Subject: Removed an unused CriticalSection from cChunk. Fixes #109 --- source/Chunk.cpp | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) (limited to 'source/Chunk.cpp') 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 ToTickBlocks; std::swap(m_ToTickBlocks, ToTickBlocks); - Lock2.Unlock(); for (std::vector::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); } -- cgit v1.2.3