Change Creature::Nickname to be an optional.
All checks were successful
continuous-integration/drone/push Build is passing

Signed-off-by: Deukhoofd <Deukhoofd@gmail.com>
This commit is contained in:
2021-09-19 11:40:18 +02:00
parent 152ac7e407
commit ce30077a5d
4 changed files with 17 additions and 6 deletions

View File

@@ -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(); }