Change Creature::Nickname to be an optional.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
Signed-off-by: Deukhoofd <Deukhoofd@gmail.com>
This commit is contained in:
@@ -55,7 +55,13 @@ SIMPLE_GET_FUNC(Creature, GetCurrentHealth, uint32_t);
|
||||
OPTIONAL_GET_FUNC(Creature, GetBattle, Battle*);
|
||||
OPTIONAL_GET_FUNC(Creature, GetBattleSide, BattleSide*);
|
||||
SIMPLE_GET_FUNC(Creature, IsOnBattleField, bool);
|
||||
export const char* CreatureLib_Creature_GetNickname(Creature* p) { return p->GetNickname().data(); }
|
||||
export const char* CreatureLib_Creature_GetNickname(Creature* p) {
|
||||
auto s = p->GetNickname();
|
||||
if (s.has_value()) {
|
||||
return p->GetNickname().value().data();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
export void CreatureLib_Creature_SetNickname(Creature* p, const char* nickname) { p->SetNickname(nickname); }
|
||||
export bool CreatureLib_Creature_HasType(Creature* p, uint8_t type) { return p->HasType(type); }
|
||||
export size_t CreatureLib_Creature_GetTypeCount(Creature* p) { return p->GetTypes().size(); }
|
||||
|
||||
Reference in New Issue
Block a user