Fix for Pokemon.HasHeldItem in AngelScript, added tests.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2020-04-10 16:03:15 +02:00
parent d2573fe959
commit 0700f7cfbd
2 changed files with 23 additions and 3 deletions

View File

@@ -82,8 +82,8 @@ CScriptArray* GetMoves(const PkmnLib::Battling::Pokemon* obj) {
}
return nullptr;
}
static bool HasHeldItem(const PkmnLib::Battling::Pokemon* obj, const Arbutils::CaseInsensitiveConstString& str) {
return obj->HasHeldItem(str);
static bool HasHeldItem(const PkmnLib::Battling::Pokemon* obj, const ConstString& str) {
return obj->HasHeldItem(str.GetHash());
}
@@ -115,7 +115,7 @@ void RegisterPokemonClass::RegisterPokemonType(asIScriptEngine* engine) {
asMETHOD(PkmnLib::Battling::Pokemon, GetHeldItem), asCALL_THISCALL);
assert(r >= 0);
r = engine->RegisterObjectMethod("Pokemon", "bool HasHeldItem(const constString &in name) const",
asFUNCTION(HasHeldItem), asCALL_CDECL_OBJLAST);
asFUNCTION(HasHeldItem), asCALL_CDECL_OBJFIRST);
assert(r >= 0);
r = engine->RegisterObjectMethod(
"Pokemon", "void SetHeldItem(const string &in name)",