Skip to content

Commit

Permalink
Fix for unloaded but active block problem
Browse files Browse the repository at this point in the history
  • Loading branch information
CiaranG authored and sapier committed Mar 2, 2014
1 parent 1b840e8 commit baee91b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/environment.cpp
Expand Up @@ -796,6 +796,14 @@ class ABMHandler

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();
Expand Down

0 comments on commit baee91b

Please sign in to comment.