feat(object): add ClntObjMgrObjectPtr

This commit is contained in:
fallenoak 2026-01-14 23:37:40 -06:00
parent 7e994ff195
commit 2bb8da6971
No known key found for this signature in database
GPG Key ID: 7628F8E61AEA070D
2 changed files with 21 additions and 0 deletions

View File

@ -11,6 +11,7 @@
#include "object/client/CGPlayer_C.hpp" #include "object/client/CGPlayer_C.hpp"
#include "object/client/CGUnit_C.hpp" #include "object/client/CGUnit_C.hpp"
#include "object/client/MessageHandlers.hpp" #include "object/client/MessageHandlers.hpp"
#include "object/client/Util.hpp"
#include "util/Unimplemented.hpp" #include "util/Unimplemented.hpp"
#include <common/ObjectAlloc.hpp> #include <common/ObjectAlloc.hpp>
#include <storm/Memory.hpp> #include <storm/Memory.hpp>
@ -143,6 +144,24 @@ void ClntObjMgrLinkInNewObject(CGObject_C* object) {
s_curMgr->m_objects.Insert(object, object->m_obj->m_guid, key); s_curMgr->m_objects.Insert(object, object->m_obj->m_guid, key);
} }
CGObject_C* ClntObjMgrObjectPtr(WOWGUID guid, OBJECT_TYPE type) {
if (!s_curMgr || !guid) {
return nullptr;
}
auto object = FindActiveObject(guid);
if (!object) {
return nullptr;
}
if (!(object->m_obj->m_type & type)) {
return nullptr;
}
return object;
}
void ClntObjMgrPop() { void ClntObjMgrPop() {
if (!s_savMgr) { if (!s_savMgr) {
return; return;

View File

@ -20,6 +20,8 @@ void ClntObjMgrInitializeStd(uint32_t mapID);
void ClntObjMgrLinkInNewObject(CGObject_C* object); void ClntObjMgrLinkInNewObject(CGObject_C* object);
CGObject_C* ClntObjMgrObjectPtr(WOWGUID guid, OBJECT_TYPE type);
void ClntObjMgrPop(); void ClntObjMgrPop();
void ClntObjMgrPush(ClntObjMgr* mgr); void ClntObjMgrPush(ClntObjMgr* mgr);