Skip to content

Commit 39213bd

Browse files
committedNov 4, 2020
Slight simplification and optimization of RemoteClient.
1 parent aa4d3cb commit 39213bd

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed
 

‎src/clientiface.cpp

+7-13
Original file line numberDiff line numberDiff line change
@@ -298,20 +298,14 @@ void RemoteClient::GetNextBlocks (
298298
*/
299299
MapBlock *block = env->getMap().getBlockNoCreateNoEx(p);
300300

301-
bool surely_not_found_on_disk = false;
302-
bool block_is_invalid = false;
301+
bool block_not_found = false;
303302
if (block) {
304303
// Reset usage timer, this block will be of use in the future.
305304
block->resetUsageTimer();
306305

307-
// Block is dummy if data doesn't exist.
308-
// It means it has been not found from disk and not generated
309-
if (block->isDummy()) {
310-
surely_not_found_on_disk = true;
311-
}
312-
313-
if (!block->isGenerated())
314-
block_is_invalid = true;
306+
// Check whether the block exists (with data)
307+
if (block->isDummy() || !block->isGenerated())
308+
block_not_found = true;
315309

316310
/*
317311
If block is not close, don't send it unless it is near
@@ -325,7 +319,7 @@ void RemoteClient::GetNextBlocks (
325319
continue;
326320
}
327321

328-
if (m_occ_cull && !block_is_invalid &&
322+
if (m_occ_cull && !block_not_found &&
329323
env->getMap().isBlockOccluded(block, cam_pos_nodes)) {
330324
continue;
331325
}
@@ -335,15 +329,15 @@ void RemoteClient::GetNextBlocks (
335329
If block has been marked to not exist on disk (dummy) or is
336330
not generated and generating new ones is not wanted, skip block.
337331
*/
338-
if (!generate && (surely_not_found_on_disk || block_is_invalid)) {
332+
if (!generate && block_not_found) {
339333
// get next one.
340334
continue;
341335
}
342336

343337
/*
344338
Add inexistent block to emerge queue.
345339
*/
346-
if (block == NULL || surely_not_found_on_disk || block_is_invalid) {
340+
if (block == NULL || block_not_found) {
347341
if (emerge->enqueueBlockEmerge(peer_id, p, generate)) {
348342
if (nearest_emerged_d == -1)
349343
nearest_emerged_d = d;

0 commit comments

Comments
 (0)
Please sign in to comment.