Drop some unneeded MOD_REASONs

This commit is contained in:
sfan5 2024-01-19 16:05:59 +01:00
parent be7844192b
commit 6aa4f14a28
2 changed files with 26 additions and 27 deletions

@ -40,13 +40,11 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "util/basic_macros.h" #include "util/basic_macros.h"
static const char *modified_reason_strings[] = { static const char *modified_reason_strings[] = {
"initial", "reallocate or initial",
"reallocate",
"setIsUnderground", "setIsUnderground",
"setLightingExpired", "setLightingExpired",
"setGenerated", "setGenerated",
"setNode", "setNode",
"setNodeNoCheck",
"setTimestamp", "setTimestamp",
"NodeMetaRef::reportMetadataChange", "NodeMetaRef::reportMetadataChange",
"clearAllObjects", "clearAllObjects",
@ -73,6 +71,7 @@ MapBlock::MapBlock(v3s16 pos, IGameDef *gamedef):
m_gamedef(gamedef) m_gamedef(gamedef)
{ {
reallocate(); reallocate();
assert(m_modified > MOD_STATE_CLEAN);
} }
MapBlock::~MapBlock() MapBlock::~MapBlock()

@ -43,27 +43,27 @@ class VoxelManipulator;
//// MapBlock modified reason flags //// MapBlock modified reason flags
//// ////
#define MOD_REASON_INITIAL (1 << 0) enum ModReason : u32 {
#define MOD_REASON_REALLOCATE (1 << 1) MOD_REASON_REALLOCATE = 1 << 0,
#define MOD_REASON_SET_IS_UNDERGROUND (1 << 2) MOD_REASON_SET_IS_UNDERGROUND = 1 << 1,
#define MOD_REASON_SET_LIGHTING_COMPLETE (1 << 3) MOD_REASON_SET_LIGHTING_COMPLETE = 1 << 2,
#define MOD_REASON_SET_GENERATED (1 << 4) MOD_REASON_SET_GENERATED = 1 << 3,
#define MOD_REASON_SET_NODE (1 << 5) MOD_REASON_SET_NODE = 1 << 4,
#define MOD_REASON_SET_NODE_NO_CHECK (1 << 6) MOD_REASON_SET_TIMESTAMP = 1 << 5,
#define MOD_REASON_SET_TIMESTAMP (1 << 7) MOD_REASON_REPORT_META_CHANGE = 1 << 6,
#define MOD_REASON_REPORT_META_CHANGE (1 << 8) MOD_REASON_CLEAR_ALL_OBJECTS = 1 << 7,
#define MOD_REASON_CLEAR_ALL_OBJECTS (1 << 9) MOD_REASON_BLOCK_EXPIRED = 1 << 8,
#define MOD_REASON_BLOCK_EXPIRED (1 << 10) MOD_REASON_ADD_ACTIVE_OBJECT_RAW = 1 << 9,
#define MOD_REASON_ADD_ACTIVE_OBJECT_RAW (1 << 11) MOD_REASON_REMOVE_OBJECTS_REMOVE = 1 << 10,
#define MOD_REASON_REMOVE_OBJECTS_REMOVE (1 << 12) MOD_REASON_REMOVE_OBJECTS_DEACTIVATE = 1 << 11,
#define MOD_REASON_REMOVE_OBJECTS_DEACTIVATE (1 << 13) MOD_REASON_TOO_MANY_OBJECTS = 1 << 12,
#define MOD_REASON_TOO_MANY_OBJECTS (1 << 14) MOD_REASON_STATIC_DATA_ADDED = 1 << 13,
#define MOD_REASON_STATIC_DATA_ADDED (1 << 15) MOD_REASON_STATIC_DATA_REMOVED = 1 << 14,
#define MOD_REASON_STATIC_DATA_REMOVED (1 << 16) MOD_REASON_STATIC_DATA_CHANGED = 1 << 15,
#define MOD_REASON_STATIC_DATA_CHANGED (1 << 17) MOD_REASON_EXPIRE_DAYNIGHTDIFF = 1 << 16,
#define MOD_REASON_EXPIRE_DAYNIGHTDIFF (1 << 18) MOD_REASON_VMANIP = 1 << 17,
#define MOD_REASON_VMANIP (1 << 19) MOD_REASON_UNKNOWN = 1 << 18,
#define MOD_REASON_UNKNOWN (1 << 20) };
//// ////
//// MapBlock itself //// MapBlock itself
@ -296,7 +296,7 @@ public:
inline void setNodeNoCheck(s16 x, s16 y, s16 z, MapNode n) inline void setNodeNoCheck(s16 x, s16 y, s16 z, MapNode n)
{ {
data[z * zstride + y * ystride + x] = n; data[z * zstride + y * ystride + x] = n;
raiseModified(MOD_STATE_WRITE_NEEDED, MOD_REASON_SET_NODE_NO_CHECK); raiseModified(MOD_STATE_WRITE_NEEDED, MOD_REASON_SET_NODE);
} }
inline void setNodeNoCheck(v3s16 p, MapNode n) inline void setNodeNoCheck(v3s16 p, MapNode n)
@ -525,8 +525,8 @@ private:
block has been modified from the one on disk. block has been modified from the one on disk.
- On the client, this is used for nothing. - On the client, this is used for nothing.
*/ */
u16 m_modified = MOD_STATE_WRITE_NEEDED; u16 m_modified = MOD_STATE_CLEAN;
u32 m_modified_reason = MOD_REASON_INITIAL; u32 m_modified_reason = 0;
/* /*
When block is removed from active blocks, this is set to gametime. When block is removed from active blocks, this is set to gametime.