feat(object): handle disabled objects in GetUpdateObject

This commit is contained in:
fallenoak 2026-01-13 23:04:21 -06:00
parent 56f645fe3b
commit 3332062f86
No known key found for this signature in database
GPG Key ID: 7628F8E61AEA070D
2 changed files with 30 additions and 1 deletions

View File

@ -12,8 +12,10 @@ class ClntObjMgr {
public: public:
// Member variables // Member variables
TSHashTable<CGObject_C, CHashKeyGUID> m_objects; TSHashTable<CGObject_C, CHashKeyGUID> m_objects;
TSHashTable<CGObject_C, CHashKeyGUID> m_lazyCleanupObjects;
// TODO // TODO
STORM_EXPLICIT_LIST(CGObject_C, m_link) m_visibleObjects; STORM_EXPLICIT_LIST(CGObject_C, m_link) m_visibleObjects;
STORM_EXPLICIT_LIST(CGObject_C, m_link) m_reenabledObjects;
// TODO // TODO
WOWGUID m_activePlayer = 0; WOWGUID m_activePlayer = 0;
uint32_t m_mapID = 0; uint32_t m_mapID = 0;

View File

@ -17,6 +17,8 @@ CGObject_C* FindActiveObject(WOWGUID guid) {
CGObject_C* GetUpdateObject(WOWGUID guid, int32_t* reenabled) { CGObject_C* GetUpdateObject(WOWGUID guid, int32_t* reenabled) {
*reenabled = false; *reenabled = false;
// Active object
auto activeObject = FindActiveObject(guid); auto activeObject = FindActiveObject(guid);
if (activeObject) { if (activeObject) {
@ -25,7 +27,32 @@ CGObject_C* GetUpdateObject(WOWGUID guid, int32_t* reenabled) {
return activeObject; return activeObject;
} }
// TODO handle reenabling object // Disabled object
auto disabledObject = ClntObjMgrGetCurrent()->m_lazyCleanupObjects.Ptr(guid, CHashKeyGUID(guid));
if (disabledObject) {
ClntObjMgrGetCurrent()->m_lazyCleanupObjects.Unlink(disabledObject);
disabledObject->m_link.Unlink();
ClntObjMgrGetCurrent()->m_objects.Insert(disabledObject, guid, CHashKeyGUID(guid));
// These link checks are guaranteed to pass because of the unlink above (both lists share
// the same link). This check is either from an inlined function or is cruft left behind
// after a refactor.
if (
!ClntObjMgrGetCurrent()->m_visibleObjects.IsLinked(disabledObject)
&& !ClntObjMgrGetCurrent()->m_reenabledObjects.IsLinked(disabledObject)
) {
*reenabled = true;
ClntObjMgrGetCurrent()->m_reenabledObjects.LinkToTail(disabledObject);
}
return disabledObject;
}
// Object not found
return nullptr; return nullptr;
} }