Fixes Pokemon::get_DisplaySpecies and get_DisplayForme segfaulting in angelscript.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2021-09-19 13:02:24 +02:00
parent 3a5fa268dd
commit a43dc45665
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
1 changed files with 9 additions and 4 deletions

View File

@ -90,6 +90,11 @@ static std::string NicknameWrapper(const PkmnLib::Battling::Pokemon* obj) {
BORROWED_PTR_GETTER_FUNC(PkmnLib::Battling::Pokemon, const CreatureLib::Library::CreatureSpecies, GetSpecies); BORROWED_PTR_GETTER_FUNC(PkmnLib::Battling::Pokemon, const CreatureLib::Library::CreatureSpecies, GetSpecies);
BORROWED_PTR_GETTER_FUNC(PkmnLib::Battling::Pokemon, const PkmnLib::Library::PokemonForme, GetForme); BORROWED_PTR_GETTER_FUNC(PkmnLib::Battling::Pokemon, const PkmnLib::Library::PokemonForme, GetForme);
OPTIONAL_BORROWED_PTR_GETTER_FUNC(CreatureLib::Battling::Creature, const CreatureLib::Library::CreatureSpecies,
GetDisplaySpecies);
OPTIONAL_BORROWED_PTR_GETTER_FUNC(CreatureLib::Battling::Creature, const CreatureLib::Library::SpeciesVariant,
GetDisplayVariant);
OPTIONAL_BORROWED_PTR_GETTER_FUNC(PkmnLib::Battling::Pokemon, const CreatureLib::Library::Item, GetHeldItem); OPTIONAL_BORROWED_PTR_GETTER_FUNC(PkmnLib::Battling::Pokemon, const CreatureLib::Library::Item, GetHeldItem);
OPTIONAL_BORROWED_PTR_GETTER_FUNC(PkmnLib::Battling::Pokemon, CreatureLib::Battling::Battle, GetBattle); OPTIONAL_BORROWED_PTR_GETTER_FUNC(PkmnLib::Battling::Pokemon, CreatureLib::Battling::Battle, GetBattle);
OPTIONAL_BORROWED_PTR_GETTER_FUNC(PkmnLib::Battling::Pokemon, CreatureLib::Battling::BattleSide, GetBattleSide); OPTIONAL_BORROWED_PTR_GETTER_FUNC(PkmnLib::Battling::Pokemon, CreatureLib::Battling::BattleSide, GetBattleSide);
@ -143,8 +148,8 @@ void RegisterPokemonClass::RegisterPokemonType(asIScriptEngine* engine) {
r = engine->RegisterObjectMethod("Pokemon", "uint32 get_CurrentHealth() const property", r = engine->RegisterObjectMethod("Pokemon", "uint32 get_CurrentHealth() const property",
asMETHOD(PkmnLib::Battling::Pokemon, GetCurrentHealth), asCALL_THISCALL); asMETHOD(PkmnLib::Battling::Pokemon, GetCurrentHealth), asCALL_THISCALL);
Ensure(r >= 0); Ensure(r >= 0);
r = engine->RegisterObjectMethod("Pokemon", "string get_Nickname() const property", r = engine->RegisterObjectMethod("Pokemon", "string get_Nickname() const property", asFUNCTION(NicknameWrapper),
asFUNCTION(NicknameWrapper), asCALL_CDECL_OBJFIRST); asCALL_CDECL_OBJFIRST);
Ensure(r >= 0); Ensure(r >= 0);
r = engine->RegisterObjectMethod("Pokemon", "const constString& get_ActiveAbility() const property", r = engine->RegisterObjectMethod("Pokemon", "const constString& get_ActiveAbility() const property",
asMETHOD(PkmnLib::Battling::Pokemon, GetActiveTalent), asCALL_THISCALL); asMETHOD(PkmnLib::Battling::Pokemon, GetActiveTalent), asCALL_THISCALL);
@ -174,10 +179,10 @@ void RegisterPokemonClass::RegisterPokemonType(asIScriptEngine* engine) {
asMETHOD(PkmnLib::Battling::Pokemon, ChangeStatBoost), asCALL_THISCALL); asMETHOD(PkmnLib::Battling::Pokemon, ChangeStatBoost), asCALL_THISCALL);
Ensure(r >= 0); Ensure(r >= 0);
r = engine->RegisterObjectMethod("Pokemon", "const Species@ get_DisplaySpecies() const property", r = engine->RegisterObjectMethod("Pokemon", "const Species@ get_DisplaySpecies() const property",
asMETHOD(PkmnLib::Battling::Pokemon, GetDisplaySpecies), asCALL_THISCALL); asFUNCTION(GetDisplaySpeciesWrapper), asCALL_CDECL_OBJFIRST);
Ensure(r >= 0); Ensure(r >= 0);
r = engine->RegisterObjectMethod("Pokemon", "const Species@ get_DisplayForme() const property", r = engine->RegisterObjectMethod("Pokemon", "const Species@ get_DisplayForme() const property",
asMETHOD(PkmnLib::Battling::Pokemon, GetDisplayVariant), asCALL_THISCALL); asFUNCTION(GetDisplayVariantWrapper), asCALL_CDECL_OBJFIRST);
Ensure(r >= 0); Ensure(r >= 0);
r = engine->RegisterObjectMethod("Pokemon", "uint32 GetFlatStat(Statistic stat) const", r = engine->RegisterObjectMethod("Pokemon", "uint32 GetFlatStat(Statistic stat) const",
asMETHOD(PkmnLib::Battling::Pokemon, GetFlatStat), asCALL_THISCALL); asMETHOD(PkmnLib::Battling::Pokemon, GetFlatStat), asCALL_THISCALL);