Adds HasVolatile functions to Angelscript Battle and BattleSide.
continuous-integration/drone/push Build is failing Details

This commit is contained in:
Deukhoofd 2021-10-29 21:16:47 +02:00
parent 2ae73b816b
commit 0623bdff06
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
1 changed files with 13 additions and 0 deletions

View File

@ -84,6 +84,13 @@ static CScriptHandle BattleSide_AddVolatileWrapper(CreatureLib::Battling::Battle
return handle;
}
static bool Battle_HasVolatileWrapper(PkmnLib::Battling::Battle* obj, const ArbUt::StringView& name) {
return obj->HasVolatileScript(name);
}
static bool BattleSide_HasVolatileWrapper(CreatureLib::Battling::BattleSide* obj, const ArbUt::StringView& name) {
return obj->HasVolatileScript(name);
}
static u8 GetPokemonIndexWrapper(CreatureLib::Battling::BattleSide* obj, PkmnLib::Battling::Pokemon* pokemon) {
return obj->GetCreatureIndex(pokemon);
}
@ -120,6 +127,9 @@ void RegisterBattleClass::RegisterBattleSide(asIScriptEngine* engine) {
asMETHODPR(CreatureLib::Battling::BattleSide, RemoveVolatileScript, (const ArbUt::BasicStringView&), void),
asCALL_THISCALL);
Ensure(r >= 0);
r = engine->RegisterObjectMethod("BattleSide", "bool HasVolatile(const constString &in name) const",
asFUNCTION(BattleSide_HasVolatileWrapper), asCALL_CDECL_OBJFIRST);
Ensure(r >= 0);
}
void RegisterBattleClass::RegisterBattle(asIScriptEngine* engine) {
@ -169,4 +179,7 @@ void RegisterBattleClass::RegisterBattle(asIScriptEngine* engine) {
r = engine->RegisterObjectMethod("Battle", "BattleParty@ FindPartyForPokemon(Pokemon@ pokemon)",
asFUNCTION(FindPartyWrapper), asCALL_CDECL_OBJFIRST);
Ensure(r >= 0);
r = engine->RegisterObjectMethod("Battle", "bool HasVolatile(const constString &in name) const",
asFUNCTION(Battle_HasVolatileWrapper), asCALL_CDECL_OBJFIRST);
Ensure(r >= 0);
}