aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCiaran Gultnieks <ciaran@ciarang.com>2014-02-20 12:55:32 +0000
committersapier <Sapier at GMX dot net>2014-03-02 20:39:28 +0100
commitbaee91bf78cdc17a401ad82ee14e2917d44be8fb (patch)
tree65a980bdc738c113d15b8b0edae68a39f6562f49 /src
parent1b840e8ef9c43324f68e119260805f878e2c5900 (diff)
downloadminetest-baee91bf78cdc17a401ad82ee14e2917d44be8fb.tar.gz
minetest-baee91bf78cdc17a401ad82ee14e2917d44be8fb.tar.bz2
minetest-baee91bf78cdc17a401ad82ee14e2917d44be8fb.zip
Fix for unloaded but active block problem
Diffstat (limited to 'src')
-rw-r--r--src/environment.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/environment.cpp b/src/environment.cpp
index 08564046e..0e7830a26 100644
--- a/src/environment.cpp
+++ b/src/environment.cpp
@@ -796,6 +796,14 @@ neighbor_found:
void ServerEnvironment::activateBlock(MapBlock *block, u32 additional_dtime)
{
+ // Reset usage timer immediately, otherwise a block that becomes active
+ // again at around the same time as it would normally be unloaded will
+ // get unloaded incorrectly. (I think this still leaves a small possibility
+ // of a race condition between this and server::AsyncRunStep, which only
+ // some kind of synchronisation will fix, but it at least reduces the window
+ // of opportunity for it to break from seconds to nanoseconds)
+ block->resetUsageTimer();
+
// Get time difference
u32 dtime_s = 0;
u32 stamp = block->getTimestamp();