]> git.lizzy.rs Git - minetest.git/commitdiff
Fix for #13255: Check if client has a block even if the server has unloaded it. ...
authorlhofhansl <larsh@apache.org>
Mon, 27 Feb 2023 17:57:03 +0000 (09:57 -0800)
committerGitHub <noreply@github.com>
Mon, 27 Feb 2023 17:57:03 +0000 (09:57 -0800)
src/clientiface.cpp

index 8ae2efada1e14e3605390a720d38dbf35d333da0..9d1a6cd0383f56d80b89bc06bf74679f57bd82b8 100644 (file)
@@ -298,18 +298,19 @@ void RemoteClient::GetNextBlocks (
                                Check if map has this block
                        */
                        MapBlock *block = env->getMap().getBlockNoCreateNoEx(p);
-
-                       bool block_not_found = false;
                        if (block) {
-                               // Reset usage timer, this block will be of use in the future.
+                               // First: Reset usage timer, this block will be of use in the future.
                                block->resetUsageTimer();
+                       }
 
-                               /*
-                                       Don't send already sent blocks
-                               */
-                               if (m_blocks_sent.find(p) != m_blocks_sent.end())
-                                       continue;
+                       /*
+                               Don't send already sent blocks
+                       */
+                       if (m_blocks_sent.find(p) != m_blocks_sent.end())
+                               continue;
 
+                       bool block_not_found = false;
+                       if (block) {
                                // Check whether the block exists (with data)
                                if (!block->isGenerated())
                                        block_not_found = true;