mirror of
https://github.com/thunderbrewhq/thunderbrew
synced 2025-12-12 11:12:29 +00:00
feat(glue): display list of characters
This commit is contained in:
parent
d536140d63
commit
f28f4b0379
10 changed files with 174 additions and 8 deletions
16
src/clientobject/CMakeLists.txt
Normal file
16
src/clientobject/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
file(GLOB PRIVATE_SOURCES "*.cpp")
|
||||
|
||||
add_library(clientobject STATIC
|
||||
${PRIVATE_SOURCES}
|
||||
)
|
||||
|
||||
target_include_directories(clientobject
|
||||
PRIVATE
|
||||
${CMAKE_SOURCE_DIR}/src
|
||||
)
|
||||
|
||||
target_link_libraries(clientobject
|
||||
PRIVATE
|
||||
storm
|
||||
db
|
||||
)
|
||||
43
src/clientobject/Unit_C.cpp
Normal file
43
src/clientobject/Unit_C.cpp
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
#include "clientobject/Unit_C.hpp"
|
||||
|
||||
const char* CGUnit_C::GetDisplayRaceNameFromRecord(ChrRacesRec* record, uint8_t sexIn, uint8_t* sexOut) {
|
||||
const char* result;
|
||||
|
||||
if (sexOut) {
|
||||
*sexOut = sexIn;
|
||||
}
|
||||
if (!record) {
|
||||
return nullptr;
|
||||
}
|
||||
if (!sexIn) {
|
||||
if (record->m_nameMale[0]) {
|
||||
return record->m_nameMale;
|
||||
}
|
||||
|
||||
if (record->m_nameFemale[0]) {
|
||||
if (sexOut) {
|
||||
*sexOut = 1;
|
||||
}
|
||||
return record->m_nameFemale;
|
||||
}
|
||||
|
||||
return record->m_name;
|
||||
}
|
||||
|
||||
if (sexIn != 1) {
|
||||
return record->m_name;
|
||||
}
|
||||
|
||||
if (record->m_nameFemale[0]) {
|
||||
return record->m_nameFemale;
|
||||
}
|
||||
|
||||
if (!record->m_nameMale[0]) {
|
||||
return record->m_name;
|
||||
}
|
||||
|
||||
if (sexOut) {
|
||||
*sexOut = 0;
|
||||
}
|
||||
return record->m_nameMale;
|
||||
}
|
||||
11
src/clientobject/Unit_C.hpp
Normal file
11
src/clientobject/Unit_C.hpp
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
#ifndef CLIENTOBJECT_UNIT_C_HPP
|
||||
#define CLIENTOBJECT_UNIT_C_HPP
|
||||
|
||||
#include "db/rec/ChrRacesRec.hpp"
|
||||
|
||||
class CGUnit_C {
|
||||
public:
|
||||
static const char* GetDisplayRaceNameFromRecord(ChrRacesRec* record, uint8_t sexIn, uint8_t* sexOut = nullptr);
|
||||
};
|
||||
|
||||
#endif // CLIENTOBJECT_UNIT_C_HPP
|
||||
Loading…
Add table
Add a link
Reference in a new issue