mirror of
https://github.com/whoahq/whoa.git
synced 2026-02-01 16:22:45 +03:00
feat(object): handle disabled objects in GetUpdateObject
This commit is contained in:
parent
56f645fe3b
commit
3332062f86
@ -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;
|
||||||
|
|||||||
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user