mirror of
https://github.com/whoahq/whoa.git
synced 2026-02-01 16:22:45 +03:00
feat(object): add ExtractDirtyMasks
This commit is contained in:
parent
8ab88329bb
commit
d1b764903c
@ -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
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user