whoa/src/object/client/CGUnit_C.cpp
fallenoak 8cf0abb1b1
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
feat(object): manage post init flag across base object classes
2026-01-19 20:04:17 -06:00

120 lines
2.6 KiB
C++

#include "object/client/CGUnit_C.hpp"
#include "db/Db.hpp"
WOWGUID CGUnit_C::s_activeMover;
const char* CGUnit_C::GetDisplayClassNameFromRecord(const ChrClassesRec* classRec, UNIT_SEX sex, UNIT_SEX* displaySex) {
if (displaySex) {
*displaySex = sex;
}
if (!classRec) {
return nullptr;
}
if (sex == UNITSEX_MALE) {
if (*classRec->m_nameMale) {
return classRec->m_nameMale;
}
if (*classRec->m_nameFemale) {
if (displaySex) {
*displaySex = UNITSEX_FEMALE;
}
return classRec->m_nameFemale;
}
return classRec->m_name;
}
if (sex == UNITSEX_FEMALE) {
if (*classRec->m_nameFemale) {
return classRec->m_nameFemale;
}
if (*classRec->m_nameMale) {
if (displaySex) {
*displaySex = UNITSEX_MALE;
}
return classRec->m_nameMale;
}
return classRec->m_name;
}
return classRec->m_name;
}
const char* CGUnit_C::GetDisplayRaceNameFromRecord(const ChrRacesRec* raceRec, UNIT_SEX sex, UNIT_SEX* displaySex) {
if (displaySex) {
*displaySex = sex;
}
if (!raceRec) {
return nullptr;
}
if (sex == UNITSEX_MALE) {
if (*raceRec->m_nameMale) {
return raceRec->m_nameMale;
}
if (*raceRec->m_nameFemale) {
if (displaySex) {
*displaySex = UNITSEX_FEMALE;
}
return raceRec->m_nameFemale;
}
return raceRec->m_name;
}
if (sex == UNITSEX_FEMALE) {
if (*raceRec->m_nameFemale) {
return raceRec->m_nameFemale;
}
if (*raceRec->m_nameMale) {
if (displaySex) {
*displaySex = UNITSEX_MALE;
}
return raceRec->m_nameMale;
}
return raceRec->m_name;
}
return raceRec->m_name;
}
CGUnit_C::CGUnit_C(uint32_t time, CClientObjCreate& objCreate) : CGObject_C(time, objCreate) {
// TODO
}
CGUnit_C::~CGUnit_C() {
// TODO
}
void CGUnit_C::PostInit(uint32_t time, const CClientObjCreate& init, bool a4) {
// TODO
this->CGObject_C::PostInit(time, init, a4);
// TODO
}
void CGUnit_C::PostMovementUpdate(const CClientMoveUpdate& move, int32_t activeMover) {
// TODO
}
void CGUnit_C::SetStorage(uint32_t* storage, uint32_t* saved) {
this->CGObject_C::SetStorage(storage, saved);
this->m_unit = reinterpret_cast<CGUnitData*>(&storage[CGUnit::GetBaseOffset()]);
this->m_unitSaved = &saved[CGUnit::GetBaseOffsetSaved()];
}