Update to new CreatureLib nickname handling
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2021-09-19 11:43:02 +02:00
parent a6771353b0
commit 728bc13ac1
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
3 changed files with 9 additions and 10 deletions

View File

@ -61,11 +61,6 @@ else ()
message(FATAL_ERROR, "Invalid level size was given.")
endif ()
message(STATUS "Using Conan Libs:")
foreach (_conanLib ${CONAN_LIBS})
message(STATUS "\t ${_conanLib}")
endforeach ()
if (CMAKE_BUILD_TYPE MATCHES Release AND NOT WINDOWS)
# Include debug symbols in all linux builds
message("Including debug symbols")

View File

@ -22,7 +22,7 @@ namespace PkmnLib::Battling {
const ArbUt::BorrowedPtr<const Library::PokemonSpecies>& species,
const ArbUt::BorrowedPtr<const Library::PokemonForme>& forme, level_int_t level, uint32_t experience,
uint32_t uid, CreatureLib::Library::Gender gender, uint8_t coloring,
ArbUt::OptionalBorrowedPtr<const Library::Item> heldItem, const std::string& nickname,
ArbUt::OptionalBorrowedPtr<const Library::Item> heldItem, const std::optional<std::string>& nickname,
const CreatureLib::Library::TalentIndex& talent,
const std::vector<CreatureLib::Battling::LearnedAttack*>& moves,
CreatureLib::Library::ClampedStatisticSet<uint8_t, 0, 31> individualValues,

View File

@ -81,7 +81,12 @@ static void SetHeldItemWrapper(PkmnLib::Battling::Pokemon* obj, const ArbUt::Str
return obj->SetHeldItem(str);
}
static std::string NicknameWrapper(const PkmnLib::Battling::Pokemon* obj) { return std::string(obj->GetNickname()); }
static std::string NicknameWrapper(const PkmnLib::Battling::Pokemon* obj) {
if (!obj->GetNickname().has_value()) {
return "";
}
return std::string(obj->GetNickname().value());
}
BORROWED_PTR_GETTER_FUNC(PkmnLib::Battling::Pokemon, const CreatureLib::Library::CreatureSpecies, GetSpecies);
BORROWED_PTR_GETTER_FUNC(PkmnLib::Battling::Pokemon, const PkmnLib::Library::PokemonForme, GetForme);
@ -127,9 +132,8 @@ void RegisterPokemonClass::RegisterPokemonType(asIScriptEngine* engine) {
r = engine->RegisterObjectMethod("Pokemon", "bool HasHeldItem(const constString &in name) const",
asFUNCTION(HasHeldItem), asCALL_CDECL_OBJFIRST);
Ensure(r >= 0);
r = engine->RegisterObjectMethod(
"Pokemon", "void SetHeldItem(const constString &in name)",
asFUNCTION(SetHeldItemWrapper), asCALL_CDECL_OBJFIRST);
r = engine->RegisterObjectMethod("Pokemon", "void SetHeldItem(const constString &in name)",
asFUNCTION(SetHeldItemWrapper), asCALL_CDECL_OBJFIRST);
Ensure(r >= 0);
r = engine->RegisterObjectMethod("Pokemon", "void SetHeldItem(const Item@ item)",
asMETHODPR(PkmnLib::Battling::Pokemon, SetHeldItem,