feat(object): add ExtractDirtyMasks

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

View File

@ -8,6 +8,34 @@
#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 <common/DataStore.hpp>
#define MAX_DIRTY_MASKS 42
/**
* Given a message data store, extract the dirty masks contained inside. Any masks not present are
* zeroed out. This function assumes the provided masks pointer has enough space for
* MAX_DIRTY_MASKS.
*/
int32_t ExtractDirtyMasks(CDataStore* msg, uint8_t* maskCount, uint32_t* masks) {
uint8_t count;
msg->Get(count);
*maskCount = count;
if (count > MAX_DIRTY_MASKS) {
return 0;
}
for (int32_t i = 0; i < count; i++) {
msg->Get(masks[i]);
}
// Zero out unused masks
memset(&masks[count], 0, (MAX_DIRTY_MASKS - count) * sizeof(uint32_t));
return 1;
}
/** /**
* Given an object type hierarchy and GUID, return the number of DWORD blocks backing the object's * Given an object type hierarchy and GUID, return the number of DWORD blocks backing the object's