1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Fix performance bug with applying LBMs

This commit is contained in:
sfan5 2025-03-18 20:06:39 +01:00
parent 8fc7bf2af4
commit ea1e8797a3

View file

@ -270,7 +270,8 @@ void LBMManager::applyLBMs(ServerEnvironment *env, MapBlock *block,
if (previous_c != c) {
c_changed = true;
lbm_list = it->second.lookup(c);
batch = &to_run[c];
if (lbm_list)
batch = &to_run[c]; // creates entry
previous_c = c;
}
@ -301,6 +302,8 @@ void LBMManager::applyLBMs(ServerEnvironment *env, MapBlock *block,
else
++it2;
}
} else {
assert(!batch.p.empty());
}
first = false;
@ -1061,9 +1064,6 @@ void ServerEnvironment::activateBlock(MapBlock *block, u32 additional_dtime)
dtime_s = m_game_time - stamp;
dtime_s += additional_dtime;
/*infostream<<"ServerEnvironment::activateBlock(): block timestamp: "
<<stamp<<", game time: "<<m_game_time<<std::endl;*/
// Remove stored static objects if clearObjects was called since block's timestamp
// Note that non-generated blocks may still have stored static objects
if (stamp != BLOCK_TIMESTAMP_UNDEFINED && stamp < m_last_clear_objects_time) {
@ -1074,9 +1074,6 @@ void ServerEnvironment::activateBlock(MapBlock *block, u32 additional_dtime)
// Set current time as timestamp
block->setTimestampNoChangedFlag(m_game_time);
/*infostream<<"ServerEnvironment::activateBlock(): block is "
<<dtime_s<<" seconds old."<<std::endl;*/
// Activate stored objects
activateObjects(block, dtime_s);
if (block->isOrphan())