parent
ee2b8c7103
commit
82ce40e2cc
@ -573,20 +573,11 @@ void cChunk::ProcessQueuedSetBlocks(void)
|
|||||||
|
|
||||||
void cChunk::BroadcastPendingBlockChanges(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)
|
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)
|
void cChunk::CheckBlocks(void)
|
||||||
{
|
{
|
||||||
cCSLock Lock2(m_CSBlockLists);
|
|
||||||
if (m_ToTickBlocks.size() == 0)
|
if (m_ToTickBlocks.size() == 0)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
std::vector<unsigned int> ToTickBlocks;
|
std::vector<unsigned int> ToTickBlocks;
|
||||||
std::swap(m_ToTickBlocks, ToTickBlocks);
|
std::swap(m_ToTickBlocks, ToTickBlocks);
|
||||||
Lock2.Unlock();
|
|
||||||
|
|
||||||
for (std::vector<unsigned int>::const_iterator itr = ToTickBlocks.begin(), end = ToTickBlocks.end(); itr != end; ++itr)
|
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));
|
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));
|
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)
|
void cChunk::AddBlockEntity(cBlockEntity * a_BlockEntity)
|
||||||
{
|
{
|
||||||
cCSLock Lock(m_CSBlockLists);
|
MarkDirty();
|
||||||
m_BlockEntities.push_back( a_BlockEntity );
|
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 )
|
void cChunk::RemoveBlockEntity( cBlockEntity* a_BlockEntity )
|
||||||
{
|
{
|
||||||
cCSLock Lock(m_CSBlockLists);
|
|
||||||
MarkDirty();
|
MarkDirty();
|
||||||
m_BlockEntities.remove( a_BlockEntity );
|
m_BlockEntities.remove(a_BlockEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -344,7 +344,6 @@ private:
|
|||||||
bool m_IsSaving; // True if the chunk is being saved
|
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
|
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;
|
std::vector<unsigned int> m_ToTickBlocks;
|
||||||
sSetBlockVector m_PendingSendBlocks; ///< Blocks that have changed and need to be sent to all clients
|
sSetBlockVector m_PendingSendBlocks; ///< Blocks that have changed and need to be sent to all clients
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user