mirror of
https://github.com/whoahq/whoa.git
synced 2026-03-05 15:42:17 +03:00
feat(object): clean up data struct visibility
Some checks are pending
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:cl compiler_name:MSVC cxx:cl os:windows-latest system_name:Windows test_path:WhoaTest]) (push) Waiting to run
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:clang compiler_name:Clang cxx:clang++ os:macos-latest system_name:macOS test_path:WhoaTest]) (push) Waiting to run
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:gcc compiler_name:GCC cxx:g++ os:ubuntu-latest system_name:Linux test_path:WhoaTest]) (push) Waiting to run
Some checks are pending
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:cl compiler_name:MSVC cxx:cl os:windows-latest system_name:Windows test_path:WhoaTest]) (push) Waiting to run
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:clang compiler_name:Clang cxx:clang++ os:macos-latest system_name:macOS test_path:WhoaTest]) (push) Waiting to run
Push / ${{ matrix.build.system_name }} / ${{ matrix.build.build_type }} / ${{ matrix.build.compiler_name }} (map[build_type:Release cc:gcc compiler_name:GCC cxx:g++ os:ubuntu-latest system_name:Linux test_path:WhoaTest]) (push) Waiting to run
This commit is contained in:
parent
4d0c48be52
commit
87ae3b512b
@ -24,3 +24,7 @@ uint32_t CGContainer::TotalFields() {
|
|||||||
uint32_t CGContainer::TotalFieldsSaved() {
|
uint32_t CGContainer::TotalFieldsSaved() {
|
||||||
return CGContainer::GetBaseOffsetSaved() + 72;
|
return CGContainer::GetBaseOffsetSaved() + 72;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CGContainerData* CGContainer::Container() const {
|
||||||
|
return this->m_cont;
|
||||||
|
}
|
||||||
|
|||||||
@ -20,9 +20,13 @@ class CGContainer {
|
|||||||
static uint32_t TotalFields();
|
static uint32_t TotalFields();
|
||||||
static uint32_t TotalFieldsSaved();
|
static uint32_t TotalFieldsSaved();
|
||||||
|
|
||||||
// Public member variables
|
protected:
|
||||||
|
// Protected member variables
|
||||||
CGContainerData* m_cont;
|
CGContainerData* m_cont;
|
||||||
uint32_t* m_contSaved;
|
uint32_t* m_contSaved;
|
||||||
|
|
||||||
|
// Protected member functions
|
||||||
|
CGContainerData* Container() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -24,3 +24,7 @@ uint32_t CGCorpse::TotalFields() {
|
|||||||
uint32_t CGCorpse::TotalFieldsSaved() {
|
uint32_t CGCorpse::TotalFieldsSaved() {
|
||||||
return CGCorpse::GetBaseOffsetSaved() + 3;
|
return CGCorpse::GetBaseOffsetSaved() + 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CGCorpseData* CGCorpse::Corpse() const {
|
||||||
|
return this->m_corpse;
|
||||||
|
}
|
||||||
|
|||||||
@ -17,9 +17,13 @@ class CGCorpse {
|
|||||||
static uint32_t TotalFields();
|
static uint32_t TotalFields();
|
||||||
static uint32_t TotalFieldsSaved();
|
static uint32_t TotalFieldsSaved();
|
||||||
|
|
||||||
// Public member variables
|
protected:
|
||||||
|
// Protected member variables
|
||||||
CGCorpseData* m_corpse;
|
CGCorpseData* m_corpse;
|
||||||
uint32_t* m_corpseSaved;
|
uint32_t* m_corpseSaved;
|
||||||
|
|
||||||
|
// Protected member functions
|
||||||
|
CGCorpseData* Corpse() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -24,3 +24,7 @@ uint32_t CGDynamicObject::TotalFields() {
|
|||||||
uint32_t CGDynamicObject::TotalFieldsSaved() {
|
uint32_t CGDynamicObject::TotalFieldsSaved() {
|
||||||
return CGDynamicObject::GetBaseOffsetSaved() + 0;
|
return CGDynamicObject::GetBaseOffsetSaved() + 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CGDynamicObjectData* CGDynamicObject::DynamicObject() const {
|
||||||
|
return this->m_dynamicObj;
|
||||||
|
}
|
||||||
|
|||||||
@ -17,9 +17,13 @@ class CGDynamicObject {
|
|||||||
static uint32_t TotalFields();
|
static uint32_t TotalFields();
|
||||||
static uint32_t TotalFieldsSaved();
|
static uint32_t TotalFieldsSaved();
|
||||||
|
|
||||||
// Public member variables
|
protected:
|
||||||
|
// Protected member variables
|
||||||
CGDynamicObjectData* m_dynamicObj;
|
CGDynamicObjectData* m_dynamicObj;
|
||||||
uint32_t* m_dynamicObjSaved;
|
uint32_t* m_dynamicObjSaved;
|
||||||
|
|
||||||
|
// Protected member functions
|
||||||
|
CGDynamicObjectData* DynamicObject() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -24,3 +24,7 @@ uint32_t CGGameObject::TotalFields() {
|
|||||||
uint32_t CGGameObject::TotalFieldsSaved() {
|
uint32_t CGGameObject::TotalFieldsSaved() {
|
||||||
return CGGameObject::GetBaseOffsetSaved() + 4;
|
return CGGameObject::GetBaseOffsetSaved() + 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CGGameObjectData* CGGameObject::GameObject() const {
|
||||||
|
return this->m_gameObj;
|
||||||
|
}
|
||||||
|
|||||||
@ -17,9 +17,13 @@ class CGGameObject {
|
|||||||
static uint32_t TotalFields();
|
static uint32_t TotalFields();
|
||||||
static uint32_t TotalFieldsSaved();
|
static uint32_t TotalFieldsSaved();
|
||||||
|
|
||||||
// Public member variables
|
protected:
|
||||||
|
// Protected member variables
|
||||||
CGGameObjectData* m_gameObj;
|
CGGameObjectData* m_gameObj;
|
||||||
uint32_t* m_gameObjSaved;
|
uint32_t* m_gameObjSaved;
|
||||||
|
|
||||||
|
// Protected member functions
|
||||||
|
CGGameObjectData* GameObject() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -24,3 +24,7 @@ uint32_t CGItem::TotalFields() {
|
|||||||
uint32_t CGItem::TotalFieldsSaved() {
|
uint32_t CGItem::TotalFieldsSaved() {
|
||||||
return CGItem::GetBaseOffsetSaved() + 47;
|
return CGItem::GetBaseOffsetSaved() + 47;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CGItemData* CGItem::Item() const {
|
||||||
|
return this->m_item;
|
||||||
|
}
|
||||||
|
|||||||
@ -38,9 +38,13 @@ class CGItem {
|
|||||||
static uint32_t TotalFields();
|
static uint32_t TotalFields();
|
||||||
static uint32_t TotalFieldsSaved();
|
static uint32_t TotalFieldsSaved();
|
||||||
|
|
||||||
// Public member variables
|
protected:
|
||||||
|
// Protected member variables
|
||||||
CGItemData* m_item;
|
CGItemData* m_item;
|
||||||
uint32_t* m_itemSaved;
|
uint32_t* m_itemSaved;
|
||||||
|
|
||||||
|
// Protected member functions
|
||||||
|
CGItemData* Item() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -27,3 +27,15 @@ uint32_t CGObject::TotalFieldsSaved() {
|
|||||||
WOWGUID CGObject::GetGUID() const {
|
WOWGUID CGObject::GetGUID() const {
|
||||||
return this->m_obj->m_guid;
|
return this->m_obj->m_guid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OBJECT_TYPE CGObject::GetType() const {
|
||||||
|
return this->m_obj->m_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
OBJECT_TYPE_ID CGObject::GetTypeID() const {
|
||||||
|
return this->m_typeID;
|
||||||
|
}
|
||||||
|
|
||||||
|
CGObjectData* CGObject::Obj() const {
|
||||||
|
return this->m_obj;
|
||||||
|
}
|
||||||
|
|||||||
@ -25,13 +25,21 @@ class CGObject {
|
|||||||
|
|
||||||
// Public member variables
|
// Public member variables
|
||||||
uint32_t uint0; // TODO what is this?
|
uint32_t uint0; // TODO what is this?
|
||||||
CGObjectData* m_obj;
|
|
||||||
uint32_t* m_objSaved;
|
|
||||||
uint32_t m_memHandle;
|
uint32_t m_memHandle;
|
||||||
OBJECT_TYPE_ID m_typeID;
|
|
||||||
|
|
||||||
// Public member functions
|
// Public member functions
|
||||||
WOWGUID GetGUID() const;
|
WOWGUID GetGUID() const;
|
||||||
|
OBJECT_TYPE GetType() const;
|
||||||
|
OBJECT_TYPE_ID GetTypeID() const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// Protected member variables
|
||||||
|
CGObjectData* m_obj;
|
||||||
|
uint32_t* m_objSaved;
|
||||||
|
OBJECT_TYPE_ID m_typeID;
|
||||||
|
|
||||||
|
// Protected member functions
|
||||||
|
CGObjectData* Obj() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -40,3 +40,7 @@ uint32_t CGPlayer::TotalFieldsSaved() {
|
|||||||
uint32_t CGPlayer::TotalRemoteFieldsSaved() {
|
uint32_t CGPlayer::TotalRemoteFieldsSaved() {
|
||||||
return CGPlayer::GetBaseOffsetSaved() + 173;
|
return CGPlayer::GetBaseOffsetSaved() + 173;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CGPlayerData* CGPlayer::Player() const {
|
||||||
|
return this->m_player;
|
||||||
|
}
|
||||||
|
|||||||
@ -148,9 +148,13 @@ class CGPlayer {
|
|||||||
static uint32_t TotalFieldsSaved();
|
static uint32_t TotalFieldsSaved();
|
||||||
static uint32_t TotalRemoteFieldsSaved();
|
static uint32_t TotalRemoteFieldsSaved();
|
||||||
|
|
||||||
// Public member variables
|
protected:
|
||||||
|
// Protected member variables
|
||||||
CGPlayerData* m_player;
|
CGPlayerData* m_player;
|
||||||
uint32_t* m_playerSaved;
|
uint32_t* m_playerSaved;
|
||||||
|
|
||||||
|
// Protected member functions
|
||||||
|
CGPlayerData* Player() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -24,3 +24,7 @@ uint32_t CGUnit::TotalFields() {
|
|||||||
uint32_t CGUnit::TotalFieldsSaved() {
|
uint32_t CGUnit::TotalFieldsSaved() {
|
||||||
return CGUnit::GetBaseOffsetSaved() + 123;
|
return CGUnit::GetBaseOffsetSaved() + 123;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CGUnitData* CGUnit::Unit() const {
|
||||||
|
return this->m_unit;
|
||||||
|
}
|
||||||
|
|||||||
@ -82,9 +82,13 @@ class CGUnit {
|
|||||||
static uint32_t TotalFields();
|
static uint32_t TotalFields();
|
||||||
static uint32_t TotalFieldsSaved();
|
static uint32_t TotalFieldsSaved();
|
||||||
|
|
||||||
// Public member variables
|
protected:
|
||||||
|
// Protected member variables
|
||||||
CGUnitData* m_unit;
|
CGUnitData* m_unit;
|
||||||
uint32_t* m_unitSaved;
|
uint32_t* m_unitSaved;
|
||||||
|
|
||||||
|
// Protected member functions
|
||||||
|
CGUnitData* Unit() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -61,7 +61,7 @@ int32_t PostInitObject(CDataStore* msg, uint32_t time, bool a3) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (object->m_inReenable && object->m_obj->m_type & TYPE_UNIT) {
|
if (object->m_inReenable && object->GetType() & TYPE_UNIT) {
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,7 +139,7 @@ void PostMovementUpdate(CDataStore* msg) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
unit->PostMovementUpdate(move, unit->m_obj->m_guid == CGUnit_C::s_activeMover);
|
unit->PostMovementUpdate(move, unit->GetGUID() == CGUnit_C::s_activeMover);
|
||||||
|
|
||||||
if (reenable) {
|
if (reenable) {
|
||||||
unit->Reenable();
|
unit->Reenable();
|
||||||
@ -201,7 +201,7 @@ int32_t UpdateObject(CDataStore* msg) {
|
|||||||
auto object = GetUpdateObject(guid, &reenable);
|
auto object = GetUpdateObject(guid, &reenable);
|
||||||
|
|
||||||
if (object) {
|
if (object) {
|
||||||
if (!FillInPartialObjectData(object, object->m_obj->m_guid, msg, false, false)) {
|
if (!FillInPartialObjectData(object, object->GetGUID(), msg, false, false)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -329,7 +329,7 @@ int32_t CreateObject(CDataStore* msg, uint32_t time) {
|
|||||||
if (existingObject) {
|
if (existingObject) {
|
||||||
CClientObjCreate::Skip(msg);
|
CClientObjCreate::Skip(msg);
|
||||||
|
|
||||||
if (!FillInPartialObjectData(existingObject, existingObject->m_obj->m_guid, msg, false, true)) {
|
if (!FillInPartialObjectData(existingObject, existingObject->GetGUID(), msg, false, true)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -91,7 +91,7 @@ uint32_t GetNumDwordBlocks(OBJECT_TYPE type, WOWGUID guid) {
|
|||||||
* to indicate the end of the hierarchy.
|
* to indicate the end of the hierarchy.
|
||||||
*/
|
*/
|
||||||
OBJECT_TYPE_ID IncTypeID(CGObject_C* object, OBJECT_TYPE_ID curTypeID) {
|
OBJECT_TYPE_ID IncTypeID(CGObject_C* object, OBJECT_TYPE_ID curTypeID) {
|
||||||
switch (object->m_obj->m_type) {
|
switch (object->GetType()) {
|
||||||
// ID_OBJECT -> ID_ITEM -> ID_CONTAINER
|
// ID_OBJECT -> ID_ITEM -> ID_CONTAINER
|
||||||
case HIER_TYPE_ITEM:
|
case HIER_TYPE_ITEM:
|
||||||
case HIER_TYPE_CONTAINER:
|
case HIER_TYPE_CONTAINER:
|
||||||
@ -173,7 +173,7 @@ int32_t CallMirrorHandlers(CDataStore* msg, bool a2, WOWGUID guid) {
|
|||||||
|
|
||||||
OBJECT_TYPE_ID typeID = ID_OBJECT;
|
OBJECT_TYPE_ID typeID = ID_OBJECT;
|
||||||
uint32_t blockOffset = 0;
|
uint32_t blockOffset = 0;
|
||||||
uint32_t numBlocks = GetNumDwordBlocks(object->m_obj->m_type, guid);
|
uint32_t numBlocks = GetNumDwordBlocks(object->GetType(), guid);
|
||||||
|
|
||||||
for (int32_t block = 0; block < numBlocks; block++) {
|
for (int32_t block = 0; block < numBlocks; block++) {
|
||||||
if (block >= s_objMirrorBlocks[typeID]) {
|
if (block >= s_objMirrorBlocks[typeID]) {
|
||||||
@ -203,7 +203,7 @@ int32_t FillInPartialObjectData(CGObject_C* object, WOWGUID guid, CDataStore* ms
|
|||||||
|
|
||||||
OBJECT_TYPE_ID typeID = ID_OBJECT;
|
OBJECT_TYPE_ID typeID = ID_OBJECT;
|
||||||
uint32_t blockOffset = 0;
|
uint32_t blockOffset = 0;
|
||||||
uint32_t numBlocks = GetNumDwordBlocks(object->m_obj->m_type, guid);
|
uint32_t numBlocks = GetNumDwordBlocks(object->GetType(), guid);
|
||||||
|
|
||||||
for (int32_t block = 0; block < numBlocks; block++) {
|
for (int32_t block = 0; block < numBlocks; block++) {
|
||||||
if (block >= s_objMirrorBlocks[typeID]) {
|
if (block >= s_objMirrorBlocks[typeID]) {
|
||||||
|
|||||||
@ -93,9 +93,9 @@ CGObject_C* ClntObjMgrAllocObject(OBJECT_TYPE_ID typeID, WOWGUID guid) {
|
|||||||
|
|
||||||
void ClntObjMgrFreeObject(CGObject_C* object) {
|
void ClntObjMgrFreeObject(CGObject_C* object) {
|
||||||
auto playerGUID = ClntObjMgrGetActivePlayer();
|
auto playerGUID = ClntObjMgrGetActivePlayer();
|
||||||
auto isActivePlayer = object->m_obj->m_guid == playerGUID;
|
auto isActivePlayer = object->GetGUID() == playerGUID;
|
||||||
|
|
||||||
switch (object->m_obj->m_type) {
|
switch (object->GetType()) {
|
||||||
case TYPE_OBJECT:
|
case TYPE_OBJECT:
|
||||||
case HIER_TYPE_ITEM:
|
case HIER_TYPE_ITEM:
|
||||||
case HIER_TYPE_CONTAINER:
|
case HIER_TYPE_CONTAINER:
|
||||||
@ -117,7 +117,7 @@ void ClntObjMgrFreeObject(CGObject_C* object) {
|
|||||||
if (isActivePlayer) {
|
if (isActivePlayer) {
|
||||||
STORM_FREE(object);
|
STORM_FREE(object);
|
||||||
} else {
|
} else {
|
||||||
ObjectFree(s_objHeapId[object->m_typeID], object->m_memHandle);
|
ObjectFree(s_objHeapId[object->GetTypeID()], object->m_memHandle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -171,8 +171,8 @@ void ClntObjMgrInitializeStd(uint32_t mapID) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ClntObjMgrLinkInNewObject(CGObject_C* object) {
|
void ClntObjMgrLinkInNewObject(CGObject_C* object) {
|
||||||
CHashKeyGUID key(object->m_obj->m_guid);
|
CHashKeyGUID key(object->GetGUID());
|
||||||
s_curMgr->m_objects.Insert(object, object->m_obj->m_guid, key);
|
s_curMgr->m_objects.Insert(object, object->GetGUID(), key);
|
||||||
}
|
}
|
||||||
|
|
||||||
CGObject_C* ClntObjMgrObjectPtr(WOWGUID guid, OBJECT_TYPE type, const char* fileName, int32_t lineNumber) {
|
CGObject_C* ClntObjMgrObjectPtr(WOWGUID guid, OBJECT_TYPE type, const char* fileName, int32_t lineNumber) {
|
||||||
@ -186,7 +186,7 @@ CGObject_C* ClntObjMgrObjectPtr(WOWGUID guid, OBJECT_TYPE type, const char* file
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(object->m_obj->m_type & type)) {
|
if (!(object->GetType() & type)) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -107,11 +107,11 @@ void HandleObjectOutOfRangePass2(CGObject_C* object) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ClntObjMgrGetCurrent()->m_lazyCleanupObjects.Insert(object, object->m_hashval, CHashKeyGUID(object->m_key));
|
ClntObjMgrGetCurrent()->m_lazyCleanupObjects.Insert(object, object->m_hashval, CHashKeyGUID(object->m_key));
|
||||||
ClntObjMgrGetCurrent()->m_lazyCleanupFifo[object->m_typeID - 1].LinkToTail(object);
|
ClntObjMgrGetCurrent()->m_lazyCleanupFifo[object->GetTypeID() - 1].LinkToTail(object);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InitObject(CGObject_C* object, uint32_t time, CClientObjCreate& objCreate) {
|
void InitObject(CGObject_C* object, uint32_t time, CClientObjCreate& objCreate) {
|
||||||
switch (object->m_typeID) {
|
switch (object->GetTypeID()) {
|
||||||
case ID_ITEM: {
|
case ID_ITEM: {
|
||||||
new (object) CGItem_C(time, objCreate);
|
new (object) CGItem_C(time, objCreate);
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user