forked from Mirrorlandia_minetest/minetest
Slight simplification and optimization of RemoteClient.
This commit is contained in:
parent
aa4d3cb148
commit
39213bd00a
@ -298,20 +298,14 @@ void RemoteClient::GetNextBlocks (
|
|||||||
*/
|
*/
|
||||||
MapBlock *block = env->getMap().getBlockNoCreateNoEx(p);
|
MapBlock *block = env->getMap().getBlockNoCreateNoEx(p);
|
||||||
|
|
||||||
bool surely_not_found_on_disk = false;
|
bool block_not_found = false;
|
||||||
bool block_is_invalid = false;
|
|
||||||
if (block) {
|
if (block) {
|
||||||
// Reset usage timer, this block will be of use in the future.
|
// Reset usage timer, this block will be of use in the future.
|
||||||
block->resetUsageTimer();
|
block->resetUsageTimer();
|
||||||
|
|
||||||
// Block is dummy if data doesn't exist.
|
// Check whether the block exists (with data)
|
||||||
// It means it has been not found from disk and not generated
|
if (block->isDummy() || !block->isGenerated())
|
||||||
if (block->isDummy()) {
|
block_not_found = true;
|
||||||
surely_not_found_on_disk = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!block->isGenerated())
|
|
||||||
block_is_invalid = true;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
If block is not close, don't send it unless it is near
|
If block is not close, don't send it unless it is near
|
||||||
@ -325,7 +319,7 @@ void RemoteClient::GetNextBlocks (
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_occ_cull && !block_is_invalid &&
|
if (m_occ_cull && !block_not_found &&
|
||||||
env->getMap().isBlockOccluded(block, cam_pos_nodes)) {
|
env->getMap().isBlockOccluded(block, cam_pos_nodes)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -335,7 +329,7 @@ void RemoteClient::GetNextBlocks (
|
|||||||
If block has been marked to not exist on disk (dummy) or is
|
If block has been marked to not exist on disk (dummy) or is
|
||||||
not generated and generating new ones is not wanted, skip block.
|
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.
|
// get next one.
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -343,7 +337,7 @@ void RemoteClient::GetNextBlocks (
|
|||||||
/*
|
/*
|
||||||
Add inexistent block to emerge queue.
|
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 (emerge->enqueueBlockEmerge(peer_id, p, generate)) {
|
||||||
if (nearest_emerged_d == -1)
|
if (nearest_emerged_d == -1)
|
||||||
nearest_emerged_d = d;
|
nearest_emerged_d = d;
|
||||||
|
Loading…
Reference in New Issue
Block a user