mirror of
https://github.com/whoahq/whoa.git
synced 2026-02-01 00:02:45 +03:00
feat(object): add ClntObjMgrAllocObject
This commit is contained in:
parent
59b0cfc80d
commit
b4c8c78fe5
@ -66,6 +66,29 @@ void MirrorInitialize() {
|
|||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void* ClntObjMgrAllocObject(OBJECT_TYPE_ID typeID, uint64_t guid) {
|
||||||
|
auto playerGUID = ClntObjMgrGetActivePlayer();
|
||||||
|
|
||||||
|
// Heap allocate player object for current player
|
||||||
|
if (guid == playerGUID) {
|
||||||
|
return STORM_ALLOC(sizeof(CGPlayer_C) + sizeof(CGPlayerData) + (sizeof(uint32_t) * CGPlayer::TotalFieldsSaved()));
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO GarbageCollect(typeID, 10000);
|
||||||
|
|
||||||
|
uint32_t memHandle;
|
||||||
|
void* mem;
|
||||||
|
|
||||||
|
if (!ObjectAlloc(s_objHeapId[typeID], &memHandle, &mem, false)) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO pointer should be fetched via ObjectPtr
|
||||||
|
static_cast<CGObject_C*>(mem)->m_memHandle = memHandle;
|
||||||
|
|
||||||
|
return mem;
|
||||||
|
}
|
||||||
|
|
||||||
uint64_t ClntObjMgrGetActivePlayer() {
|
uint64_t ClntObjMgrGetActivePlayer() {
|
||||||
if (!s_curMgr) {
|
if (!s_curMgr) {
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@ -1,9 +1,13 @@
|
|||||||
#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/CGObject_C.hpp"
|
||||||
#include "object/client/ClntObjMgr.hpp"
|
#include "object/client/ClntObjMgr.hpp"
|
||||||
|
#include "object/Types.hpp"
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
|
void* ClntObjMgrAllocObject(OBJECT_TYPE_ID typeID, uint64_t guid);
|
||||||
|
|
||||||
uint64_t ClntObjMgrGetActivePlayer();
|
uint64_t ClntObjMgrGetActivePlayer();
|
||||||
|
|
||||||
ClntObjMgr* ClntObjMgrGetCurrent();
|
ClntObjMgr* ClntObjMgrGetCurrent();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user