Further fixes for setting pokemon held items from angelscript.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2021-08-24 20:43:01 +02:00
parent 249584bfc8
commit dfcdfd8343
2 changed files with 25 additions and 1 deletions

View File

@@ -77,6 +77,9 @@ CScriptArray* GetMoves(const PkmnLib::Battling::Pokemon* obj) {
static bool HasHeldItem(const PkmnLib::Battling::Pokemon* obj, const ArbUt::StringView& str) {
return obj->HasHeldItem(str.GetHash());
}
static void SetHeldItemWrapper(PkmnLib::Battling::Pokemon* obj, const ArbUt::StringView& str) {
return obj->SetHeldItem(str);
}
static std::string NicknameWrapper(const PkmnLib::Battling::Pokemon* obj) { return std::string(obj->GetNickname()); }
@@ -126,7 +129,7 @@ void RegisterPokemonClass::RegisterPokemonType(asIScriptEngine* engine) {
Ensure(r >= 0);
r = engine->RegisterObjectMethod(
"Pokemon", "void SetHeldItem(const constString &in name)",
asMETHODPR(PkmnLib::Battling::Pokemon, SetHeldItem, (const ArbUt::BasicStringView&), void), asCALL_THISCALL);
asFUNCTION(SetHeldItemWrapper), asCALL_CDECL_OBJFIRST);
Ensure(r >= 0);
r = engine->RegisterObjectMethod("Pokemon", "void SetHeldItem(const Item@ item)",
asMETHODPR(PkmnLib::Battling::Pokemon, SetHeldItem,