Adds get function to angelscript to get a pokemon at index.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
e320e32226
commit
7fcc4a63c5
|
@ -77,6 +77,10 @@ static u8 GetPokemonIndexWrapper(CreatureLib::Battling::BattleSide* obj, PkmnLib
|
|||
return obj->GetCreatureIndex(pokemon);
|
||||
}
|
||||
|
||||
static PkmnLib::Battling::Pokemon* GetPokemonWrapper(CreatureLib::Battling::BattleSide* obj, u8 index) {
|
||||
return dynamic_cast<PkmnLib::Battling::Pokemon*>(obj->GetCreature(index).GetValue());
|
||||
}
|
||||
|
||||
void RegisterBattleClass::RegisterBattleSide(asIScriptEngine* engine) {
|
||||
int r = engine->RegisterObjectMethod(
|
||||
"BattleSide", "bool SwapPositions(uint8 a, uint8 b)",
|
||||
|
@ -88,6 +92,9 @@ void RegisterBattleClass::RegisterBattleSide(asIScriptEngine* engine) {
|
|||
r = engine->RegisterObjectMethod("BattleSide", "uint8 GetPokemonIndex(const Pokemon@ pokemon) const",
|
||||
asFUNCTION(GetPokemonIndexWrapper), asCALL_CDECL_OBJFIRST);
|
||||
Ensure(r >= 0);
|
||||
r = engine->RegisterObjectMethod("BattleSide", "Pokemon@ GetPokemon(uint8 index) const",
|
||||
asFUNCTION(GetPokemonWrapper), asCALL_CDECL_OBJFIRST);
|
||||
Ensure(r >= 0);
|
||||
}
|
||||
|
||||
void RegisterBattleClass::RegisterBattle(asIScriptEngine* engine) {
|
||||
|
|
Loading…
Reference in New Issue