1
0

Removed an unused CriticalSection from cChunk.

Fixes #109
This commit is contained in:
madmaxoft 2013-08-19 09:13:19 +02:00
parent ee2b8c7103
commit 82ce40e2cc
2 changed files with 5 additions and 20 deletions

View File

@ -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);
}

View File

@ -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