chore(util): restructure guid code and add WOWGUID typedef

This commit is contained in:
fallenoak committed 2026-01-12 09:00:56 -06:00
1 parent 5e4ca1980d
commit 364fba9f34
19 files changed
+90 -65

No files matched your search

+9
View File
@@ -0,0 +1,9 @@
#include "util/guid/CHashKeyGUID.hpp"
CHashKeyGUID::CHashKeyGUID() {
this->m_guid = 0;
}
CHashKeyGUID::CHashKeyGUID(WOWGUID guid) {
this->m_guid = guid;
}
+18
View File
@@ -0,0 +1,18 @@
#ifndef UTIL_GUID_C_HASH_KEY_GUID_HPP
#define UTIL_GUID_C_HASH_KEY_GUID_HPP
#include "util/guid/Types.hpp"
#include <cstdint>
class CHashKeyGUID {
public:
// Public member functions
CHashKeyGUID();
CHashKeyGUID(WOWGUID guid);
private:
// Private member variables
WOWGUID m_guid;
};
#endif
+29
View File
@@ -0,0 +1,29 @@
#include "util/guid/SmartGUID.hpp"
#include <common/DataStore.hpp>
SmartGUID::operator WOWGUID() const {
return this->guid;
}
SmartGUID& SmartGUID::operator=(WOWGUID guid) {
this->guid = guid;
return *this;
}
CDataStore& operator>>(CDataStore& msg, SmartGUID& guid) {
guid = 0;
uint8_t mask;
msg.Get(mask);
for (int32_t i = 0; i < 8; i++) {
if (mask & (1 << i)) {
uint8_t byte;
msg.Get(byte);
guid.guid |= static_cast<uint64_t>(byte) << (i * 8);
}
}
return msg;
}
+18
View File
@@ -0,0 +1,18 @@
#ifndef UTIL_GUID_SMART_GUID_HPP
#define UTIL_GUID_SMART_GUID_HPP
#include "util/guid/Types.hpp"
#include <cstdint>
class CDataStore;
struct SmartGUID {
WOWGUID guid;
operator WOWGUID() const;
SmartGUID& operator=(WOWGUID value);
};
CDataStore& operator>>(CDataStore& msg, SmartGUID& guid);
#endif
+8
View File
@@ -0,0 +1,8 @@
#ifndef UTIL_GUID_TYPES_HPP
#define UTIL_GUID_TYPES_HPP
#include <cstdint>
typedef uint64_t WOWGUID;
#endif