chore(object): tidy up ExtractDirtyMasks

This commit is contained in:
fallenoak 2026-01-11 20:38:20 -06:00
parent d1b764903c
commit 47e0dbb028
No known key found for this signature in database
GPG Key ID: 7628F8E61AEA070D

View File

@ -8,14 +8,15 @@
#include "object/client/CGPlayer.hpp" #include "object/client/CGPlayer.hpp"
#include "object/client/CGUnit.hpp" #include "object/client/CGUnit.hpp"
#include "object/client/ObjMgr.hpp" #include "object/client/ObjMgr.hpp"
#include "object/Types.hpp"
#include <common/DataStore.hpp> #include <common/DataStore.hpp>
#define MAX_DIRTY_MASKS 42 #define MAX_CHANGE_MASKS 42
/** /**
* Given a message data store, extract the dirty masks contained inside. Any masks not present are * Given a message data store, extract the dirty change masks contained inside. Any masks not
* zeroed out. This function assumes the provided masks pointer has enough space for * present are zeroed out. This function assumes the provided masks pointer has enough space for
* MAX_DIRTY_MASKS. * MAX_CHANGE_MASKS.
*/ */
int32_t ExtractDirtyMasks(CDataStore* msg, uint8_t* maskCount, uint32_t* masks) { int32_t ExtractDirtyMasks(CDataStore* msg, uint8_t* maskCount, uint32_t* masks) {
uint8_t count; uint8_t count;
@ -23,7 +24,7 @@ int32_t ExtractDirtyMasks(CDataStore* msg, uint8_t* maskCount, uint32_t* masks)
*maskCount = count; *maskCount = count;
if (count > MAX_DIRTY_MASKS) { if (count > MAX_CHANGE_MASKS) {
return 0; return 0;
} }
@ -31,8 +32,8 @@ int32_t ExtractDirtyMasks(CDataStore* msg, uint8_t* maskCount, uint32_t* masks)
msg->Get(masks[i]); msg->Get(masks[i]);
} }
// Zero out unused masks // Zero out masks that aren't present
memset(&masks[count], 0, (MAX_DIRTY_MASKS - count) * sizeof(uint32_t)); memset(&masks[count], 0, (MAX_CHANGE_MASKS - count) * sizeof(uint32_t));
return 1; return 1;
} }