diff options
author | Lars <larsh@apache.org> | 2020-11-02 09:27:15 -0800 |
---|---|---|
committer | lhofhansl <larsh@apache.org> | 2020-11-03 16:23:47 -0800 |
commit | 39213bd00a8d00861616d94a29823cb2214f742e (patch) | |
tree | 4f5935deb6d3f1ce34291c2a8e09fc4999babf01 /src/clientiface.cpp | |
parent | aa4d3cb14837409b3cb5e17060776c6f5269d0be (diff) | |
download | minetest-39213bd00a8d00861616d94a29823cb2214f742e.tar.gz minetest-39213bd00a8d00861616d94a29823cb2214f742e.tar.bz2 minetest-39213bd00a8d00861616d94a29823cb2214f742e.zip |
Slight simplification and optimization of RemoteClient.
Diffstat (limited to 'src/clientiface.cpp')
-rw-r--r-- | src/clientiface.cpp | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/src/clientiface.cpp b/src/clientiface.cpp index f5e32469b..08d5d3be7 100644 --- a/src/clientiface.cpp +++ b/src/clientiface.cpp @@ -298,20 +298,14 @@ void RemoteClient::GetNextBlocks ( */ MapBlock *block = env->getMap().getBlockNoCreateNoEx(p); - bool surely_not_found_on_disk = false; - bool block_is_invalid = false; + bool block_not_found = false; if (block) { // Reset usage timer, this block will be of use in the future. block->resetUsageTimer(); - // Block is dummy if data doesn't exist. - // It means it has been not found from disk and not generated - if (block->isDummy()) { - surely_not_found_on_disk = true; - } - - if (!block->isGenerated()) - block_is_invalid = true; + // Check whether the block exists (with data) + if (block->isDummy() || !block->isGenerated()) + block_not_found = true; /* If block is not close, don't send it unless it is near @@ -325,7 +319,7 @@ void RemoteClient::GetNextBlocks ( continue; } - if (m_occ_cull && !block_is_invalid && + if (m_occ_cull && !block_not_found && env->getMap().isBlockOccluded(block, cam_pos_nodes)) { continue; } @@ -335,7 +329,7 @@ void RemoteClient::GetNextBlocks ( If block has been marked to not exist on disk (dummy) or is not generated and generating new ones is not wanted, skip block. */ - if (!generate && (surely_not_found_on_disk || block_is_invalid)) { + if (!generate && block_not_found) { // get next one. continue; } @@ -343,7 +337,7 @@ void RemoteClient::GetNextBlocks ( /* Add inexistent block to emerge queue. */ - if (block == NULL || surely_not_found_on_disk || block_is_invalid) { + if (block == NULL || block_not_found) { if (emerge->enqueueBlockEmerge(peer_id, p, generate)) { if (nearest_emerged_d == -1) nearest_emerged_d = d; |