feat(object): add ClntObjMgrPush

This commit is contained in:
fallenoak 2026-01-05 22:31:29 -06:00
parent 35787c4ac8
commit 0e685d6fbd
No known key found for this signature in database
GPG Key ID: 7628F8E61AEA070D
2 changed files with 14 additions and 1 deletions

View File

@ -1,5 +1,4 @@
#include "object/client/ObjMgr.hpp" #include "object/client/ObjMgr.hpp"
#include "object/client/ClntObjMgr.hpp"
#if defined(WHOA_SYSTEM_WIN) #if defined(WHOA_SYSTEM_WIN)
static thread_local ClntObjMgr* s_curMgr; static thread_local ClntObjMgr* s_curMgr;
@ -7,6 +6,8 @@ static thread_local ClntObjMgr* s_curMgr;
static ClntObjMgr* s_curMgr; static ClntObjMgr* s_curMgr;
#endif #endif
static ClntObjMgr* s_savMgr;
uint32_t ClntObjMgrGetMapID() { uint32_t ClntObjMgrGetMapID() {
if (!s_curMgr) { if (!s_curMgr) {
return 0; return 0;
@ -14,3 +15,12 @@ uint32_t ClntObjMgrGetMapID() {
return s_curMgr->m_mapID; return s_curMgr->m_mapID;
} }
void ClntObjMgrPush(ClntObjMgr* mgr) {
if (s_savMgr || mgr == s_curMgr) {
return;
}
s_savMgr = s_curMgr;
s_curMgr = mgr;
}

View File

@ -1,8 +1,11 @@
#ifndef OBJECT_CLIENT_OBJ_MGR_HPP #ifndef OBJECT_CLIENT_OBJ_MGR_HPP
#define OBJECT_CLIENT_OBJ_MGR_HPP #define OBJECT_CLIENT_OBJ_MGR_HPP
#include "object/client/ClntObjMgr.hpp"
#include <cstdint> #include <cstdint>
uint32_t ClntObjMgrGetMapID(); uint32_t ClntObjMgrGetMapID();
void ClntObjMgrPush(ClntObjMgr* mgr);
#endif #endif