Adds some more Angelscript functionality for the BattleSide.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2021-03-26 23:05:51 +01:00
parent 41475fcb2f
commit bee9170603
3 changed files with 26 additions and 11 deletions

View File

@@ -91,7 +91,6 @@ void AngelScriptResolver::Initialize(CreatureLib::Battling::BattleLibrary* arg,
_contextPool = new ContextPool(_engine);
}
OPTIONAL_BORROWED_PTR_GETTER_FUNC(PkmnLib::Battling::Pokemon, CreatureLib::Battling::Battle, GetBattle);
void AngelScriptResolver::RegisterTypes() {
// Register static library types
@@ -104,14 +103,17 @@ void AngelScriptResolver::RegisterTypes() {
RegisterEffectParameter::Register(_engine);
// Register battle types
// Predeclare these two types, and declare their implementation later.
[[maybe_unused]] int r = _engine->RegisterObjectType("Battle", 0, asOBJ_REF | asOBJ_NOCOUNT);
Ensure(r >= 0);
r = _engine->RegisterObjectType("BattleSide", 0, asOBJ_REF | asOBJ_NOCOUNT);
Ensure(r >= 0);
RegisterPokemonClass::Register(_engine);
RegisterExecutingAttack::Register(_engine);
RegisterTurnChoices::Register(_engine);
RegisterBattleLibrary::Register(_engine);
RegisterBattleClass::Register(_engine);
[[maybe_unused]] int r = _engine->RegisterObjectMethod("Pokemon", "const Battle@ get_Battle() const property",
asFUNCTION(GetBattleWrapper), asCALL_CDECL_OBJFIRST);
Ensure(r >= 0);
// Register base script
BasicScriptClass::Register(_engine);