1
0

Fixed the extreme strain on the world tick thread.

Block changes were sent even with empty changesets, causing a lot of lost CPU cycles.
This commit is contained in:
madmaxoft 2013-08-19 21:55:03 +02:00
parent 53455a10fa
commit 94f8884f60
2 changed files with 7 additions and 0 deletions

View File

@ -573,6 +573,11 @@ void cChunk::ProcessQueuedSetBlocks(void)
void cChunk::BroadcastPendingBlockChanges(void)
{
if (m_PendingSendBlocks.empty())
{
return;
}
for (cClientHandleList::iterator itr = m_LoadedByClient.begin(), end = m_LoadedByClient.end(); itr != end; ++itr)
{
(*itr)->SendBlockChanges(m_PosX, m_PosZ, m_PendingSendBlocks);

View File

@ -1502,6 +1502,8 @@ void cClientHandle::SendBlockChange(int a_BlockX, int a_BlockY, int a_BlockZ, BL
void cClientHandle::SendBlockChanges(int a_ChunkX, int a_ChunkZ, const sSetBlockVector & a_Changes)
{
ASSERT(!a_Changes.empty()); // We don't want to be sending empty change packets!
m_Protocol->SendBlockChanges(a_ChunkX, a_ChunkZ, a_Changes);
}