mirror of
https://github.com/luanti-org/luanti.git
synced 2025-11-30 04:35:20 +01:00
Record MapBlock modification reasons as flags instead of strings
This improves performance of MapBlock::raiseModified by a factor of 6. Also, clean up mapblock.h a bit and inline small functions.
This commit is contained in:
@@ -1436,7 +1436,7 @@ void Map::timerUpdate(float dtime, float unload_timeout,
|
||||
|
||||
// Save if modified
|
||||
if (block->getModified() != MOD_STATE_CLEAN && save_before_unloading) {
|
||||
modprofiler.add(block->getModifiedReason(), 1);
|
||||
modprofiler.add(block->getModifiedReasonString(), 1);
|
||||
if (!saveBlock(block))
|
||||
continue;
|
||||
saved_blocks_count++;
|
||||
@@ -2412,7 +2412,7 @@ void ServerMap::finishBlockMake(BlockMakeData *data,
|
||||
Set block as modified
|
||||
*/
|
||||
block->raiseModified(MOD_STATE_WRITE_NEEDED,
|
||||
"finishBlockMake expireDayNightDiff");
|
||||
MOD_REASON_EXPIRE_DAYNIGHTDIFF);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -2981,7 +2981,7 @@ void ServerMap::save(ModifiedState save_level)
|
||||
save_started = true;
|
||||
}
|
||||
|
||||
modprofiler.add(block->getModifiedReason(), 1);
|
||||
modprofiler.add(block->getModifiedReasonString(), 1);
|
||||
|
||||
saveBlock(block);
|
||||
block_count++;
|
||||
|
||||
Reference in New Issue
Block a user