Update to newest version of CreatureLib, added ChoiceQueue in AngelScript.
continuous-integration/drone/push Build is failing Details

This commit is contained in:
Deukhoofd 2020-02-22 15:22:13 +01:00
parent b1f101d646
commit 904af99022
Signed by: Deukhoofd
GPG Key ID: ADF2E9256009EDCE
3 changed files with 20 additions and 1 deletions

View File

@ -45,7 +45,7 @@ class PkmnLibConan(ConanFile):
self.options["AngelScript"].link_std_statically = True self.options["AngelScript"].link_std_statically = True
def requirements(self): def requirements(self):
self.requires("CreatureLib/d4fd7282f5fe52acafae0098168a66e4a613bffd@creaturelib/master") self.requires("CreatureLib/32584ac4067d5997d4f8bfaa33dbfc407b19fb05@creaturelib/master")
if self.options.script_handler == "angelscript": if self.options.script_handler == "angelscript":
self.requires("AngelScript/2.34@AngelScript/Deukhoofd") self.requires("AngelScript/2.34@AngelScript/Deukhoofd")
else: else:

View File

@ -4,9 +4,24 @@
#include <cstdint> #include <cstdint>
void RegisterBattleClass::Register(asIScriptEngine* engine) { void RegisterBattleClass::Register(asIScriptEngine* engine) {
RegisterChoiceQueue(engine);
RegisterBattleRandom(engine); RegisterBattleRandom(engine);
RegisterBattle(engine); RegisterBattle(engine);
} }
void RegisterBattleClass::RegisterChoiceQueue(asIScriptEngine* engine) {
[[maybe_unused]] int r = engine->RegisterObjectType("ChoiceQueue", 0, asOBJ_REF | asOBJ_NOCOUNT);
assert(r >= 0);
r = engine->RegisterObjectMethod("ChoiceQueue", "bool MovePokemonChoiceNext(Pokemon@ target)",
asMETHOD(CreatureLib::Battling::ChoiceQueue, MoveCreatureChoiceNext),
asCALL_THISCALL);
assert(r >= 0);
r = engine->RegisterObjectMethod("ChoiceQueue", "BaseTurnChoice Peek() const",
asMETHOD(CreatureLib::Battling::ChoiceQueue, Peek),
asCALL_THISCALL);
assert(r >= 0);
}
void RegisterBattleClass::RegisterBattleRandom(asIScriptEngine* engine) { void RegisterBattleClass::RegisterBattleRandom(asIScriptEngine* engine) {
[[maybe_unused]] int r = engine->RegisterObjectType("BattleRandom", 0, asOBJ_REF | asOBJ_NOCOUNT); [[maybe_unused]] int r = engine->RegisterObjectType("BattleRandom", 0, asOBJ_REF | asOBJ_NOCOUNT);
assert(r >= 0); assert(r >= 0);
@ -43,4 +58,7 @@ void RegisterBattleClass::RegisterBattle(asIScriptEngine* engine) {
r = engine->RegisterObjectMethod("Battle", "BattleRandom@ get_Random() const property", r = engine->RegisterObjectMethod("Battle", "BattleRandom@ get_Random() const property",
asMETHOD(CreatureLib::Battling::Battle, GetRandom), asCALL_THISCALL); asMETHOD(CreatureLib::Battling::Battle, GetRandom), asCALL_THISCALL);
assert(r >= 0); assert(r >= 0);
r = engine->RegisterObjectMethod("Battle", "ChoiceQueue@ get_TurnQueue() const property",
asMETHOD(CreatureLib::Battling::Battle, GetCurrentTurnQueue), asCALL_THISCALL);
assert(r >= 0);
} }

View File

@ -3,6 +3,7 @@
#include <angelscript.h> #include <angelscript.h>
class RegisterBattleClass { class RegisterBattleClass {
static void RegisterChoiceQueue(asIScriptEngine* engine);
static void RegisterBattle(asIScriptEngine* engine); static void RegisterBattle(asIScriptEngine* engine);
static void RegisterBattleRandom(asIScriptEngine* engine); static void RegisterBattleRandom(asIScriptEngine* engine);
public: public: