Support for new version of CreatureLib.
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
@@ -75,7 +75,7 @@ static AngelScripResolver* GetScriptResolver(PkmnLib::Battling::BattleLibrary* m
|
||||
return _resolverCache;
|
||||
}
|
||||
|
||||
static AngelScriptScript* GetScript(PkmnLib::Battling::BattleLibrary* mainLib, const char* scriptName) {
|
||||
static AngelScriptScript* GetScript(PkmnLib::Battling::BattleLibrary* mainLib, const ConstString& scriptName) {
|
||||
auto lib = GetScriptResolver(mainLib);
|
||||
auto s = lib->LoadScript(ScriptCategory::Creature, scriptName);
|
||||
auto script = dynamic_cast<AngelScriptScript*>(s);
|
||||
@@ -84,14 +84,14 @@ static AngelScriptScript* GetScript(PkmnLib::Battling::BattleLibrary* mainLib, c
|
||||
|
||||
TEST_CASE("Invoke non-implemented script function") {
|
||||
auto mainLib = TestLibrary::GetLibrary();
|
||||
auto script = GetScript(mainLib, "blankScript");
|
||||
auto script = GetScript(mainLib, "blankScript"_cnc);
|
||||
script->Stack();
|
||||
delete script;
|
||||
}
|
||||
|
||||
TEST_CASE("Invoke Stack script function") {
|
||||
auto mainLib = TestLibrary::GetLibrary();
|
||||
auto script = GetScript(mainLib, "stackScript");
|
||||
auto script = GetScript(mainLib, "stackScript"_cnc);
|
||||
for (int i = 1; i <= 10; i++) {
|
||||
script->Stack();
|
||||
|
||||
@@ -108,7 +108,7 @@ TEST_CASE("Invoke Stack script function") {
|
||||
|
||||
TEST_CASE("Invoke OnRemove script function") {
|
||||
auto mainLib = TestLibrary::GetLibrary();
|
||||
auto script = GetScript(mainLib, "onRemoveScript");
|
||||
auto script = GetScript(mainLib, "onRemoveScript"_cnc);
|
||||
script->OnRemove();
|
||||
|
||||
auto ctxPool = script->GetContextPool();
|
||||
@@ -124,7 +124,7 @@ TEST_CASE("Invoke OnRemove script function") {
|
||||
|
||||
TEST_CASE("Invoke Stack script function with implementation in base class") {
|
||||
auto mainLib = TestLibrary::GetLibrary();
|
||||
auto script = GetScript(mainLib, "doubleInheritanceScript");
|
||||
auto script = GetScript(mainLib, "doubleInheritanceScript"_cnc);
|
||||
for (int i = 1; i <= 10; i++) {
|
||||
script->Stack();
|
||||
|
||||
@@ -141,7 +141,7 @@ TEST_CASE("Invoke Stack script function with implementation in base class") {
|
||||
|
||||
TEST_CASE("Invoke preventAttackScript script function") {
|
||||
auto mainLib = TestLibrary::GetLibrary();
|
||||
auto script = GetScript(mainLib, "preventAttackScript");
|
||||
auto script = GetScript(mainLib, "preventAttackScript"_cnc);
|
||||
bool b = false;
|
||||
script->PreventAttack(nullptr, &b);
|
||||
REQUIRE(b);
|
||||
@@ -151,7 +151,7 @@ TEST_CASE("Invoke preventAttackScript script function") {
|
||||
|
||||
TEST_CASE("Invoke StopBeforeAttack script function") {
|
||||
auto mainLib = TestLibrary::GetLibrary();
|
||||
auto script = GetScript(mainLib, "stopBeforeAttackScript");
|
||||
auto script = GetScript(mainLib, "stopBeforeAttackScript"_cnc);
|
||||
bool b = false;
|
||||
script->StopBeforeAttack(nullptr, &b);
|
||||
REQUIRE(b);
|
||||
@@ -161,7 +161,7 @@ TEST_CASE("Invoke StopBeforeAttack script function") {
|
||||
|
||||
TEST_CASE("Invoke OnBeforeAttack script function") {
|
||||
auto mainLib = TestLibrary::GetLibrary();
|
||||
auto script = GetScript(mainLib, "OnBeforeAttackScript");
|
||||
auto script = GetScript(mainLib, "OnBeforeAttackScript"_cnc);
|
||||
|
||||
script->OnBeforeAttack(nullptr);
|
||||
|
||||
@@ -177,7 +177,7 @@ TEST_CASE("Invoke OnBeforeAttack script function") {
|
||||
|
||||
TEST_CASE("Invoke FailIncomingAttack script function") {
|
||||
auto mainLib = TestLibrary::GetLibrary();
|
||||
auto script = GetScript(mainLib, "FailIncomingAttackScript");
|
||||
auto script = GetScript(mainLib, "FailIncomingAttackScript"_cnc);
|
||||
bool b = false;
|
||||
script->FailIncomingAttack(nullptr, nullptr, &b);
|
||||
REQUIRE(b);
|
||||
@@ -187,7 +187,7 @@ TEST_CASE("Invoke FailIncomingAttack script function") {
|
||||
|
||||
TEST_CASE("Invoke OnAttackMiss script function") {
|
||||
auto mainLib = TestLibrary::GetLibrary();
|
||||
auto script = GetScript(mainLib, "OnAttackMissScript");
|
||||
auto script = GetScript(mainLib, "OnAttackMissScript"_cnc);
|
||||
|
||||
script->OnAttackMiss(nullptr, nullptr);
|
||||
|
||||
@@ -203,7 +203,7 @@ TEST_CASE("Invoke OnAttackMiss script function") {
|
||||
|
||||
TEST_CASE("Invoke ChangeAttackType script function") {
|
||||
auto mainLib = TestLibrary::GetLibrary();
|
||||
auto script = GetScript(mainLib, "ChangeAttackTypeScript");
|
||||
auto script = GetScript(mainLib, "ChangeAttackTypeScript"_cnc);
|
||||
uint8_t b = 0;
|
||||
script->ChangeAttackType(nullptr, nullptr, 0, &b);
|
||||
REQUIRE(b == 1);
|
||||
@@ -213,7 +213,7 @@ TEST_CASE("Invoke ChangeAttackType script function") {
|
||||
|
||||
TEST_CASE("Invoke OnStatusMove script function") {
|
||||
auto mainLib = TestLibrary::GetLibrary();
|
||||
auto script = GetScript(mainLib, "OnStatusMoveScript");
|
||||
auto script = GetScript(mainLib, "OnStatusMoveScript"_cnc);
|
||||
|
||||
script->OnStatusMove(nullptr, nullptr, 0);
|
||||
|
||||
@@ -229,7 +229,7 @@ TEST_CASE("Invoke OnStatusMove script function") {
|
||||
|
||||
TEST_CASE("Invoke PreventSecondaryEffects script function") {
|
||||
auto mainLib = TestLibrary::GetLibrary();
|
||||
auto script = GetScript(mainLib, "PreventSecondaryEffectsScript");
|
||||
auto script = GetScript(mainLib, "PreventSecondaryEffectsScript"_cnc);
|
||||
bool b = false;
|
||||
script->PreventSecondaryEffects(nullptr, nullptr, 0, &b);
|
||||
REQUIRE(b);
|
||||
@@ -239,7 +239,7 @@ TEST_CASE("Invoke PreventSecondaryEffects script function") {
|
||||
|
||||
TEST_CASE("Invoke OnSecondaryEffect script function") {
|
||||
auto mainLib = TestLibrary::GetLibrary();
|
||||
auto script = GetScript(mainLib, "OnSecondaryEffectScript");
|
||||
auto script = GetScript(mainLib, "OnSecondaryEffectScript"_cnc);
|
||||
|
||||
script->OnSecondaryEffect(nullptr, nullptr, 0);
|
||||
|
||||
@@ -255,7 +255,7 @@ TEST_CASE("Invoke OnSecondaryEffect script function") {
|
||||
|
||||
TEST_CASE("Invoke OnAfterHits script function") {
|
||||
auto mainLib = TestLibrary::GetLibrary();
|
||||
auto script = GetScript(mainLib, "OnAfterHitsScript");
|
||||
auto script = GetScript(mainLib, "OnAfterHitsScript"_cnc);
|
||||
|
||||
script->OnAfterHits(nullptr, nullptr);
|
||||
|
||||
@@ -271,7 +271,7 @@ TEST_CASE("Invoke OnAfterHits script function") {
|
||||
|
||||
TEST_CASE("Handle script exceptions.") {
|
||||
auto mainLib = TestLibrary::GetLibrary();
|
||||
auto script = GetScript(mainLib, "throwScript");
|
||||
auto script = GetScript(mainLib, "throwScript"_cnc);
|
||||
bool b = false;
|
||||
bool hasThrown = false;
|
||||
try{
|
||||
|
||||
@@ -40,7 +40,7 @@ TEST_CASE("Build script resolver, then create object") {
|
||||
lib->CreateScript("testScript1" , _scripts["testScript1"]);
|
||||
lib->FinalizeModule();
|
||||
|
||||
auto obj = lib->LoadScript(ScriptCategory::Creature, "testScript1");
|
||||
auto obj = lib->LoadScript(ScriptCategory::Creature, "testScript1"_cnc);
|
||||
|
||||
delete obj;
|
||||
delete lib;
|
||||
@@ -53,7 +53,7 @@ TEST_CASE("Build script resolver, create object, invoke addition method") {
|
||||
lib->FinalizeModule();
|
||||
|
||||
auto obj =
|
||||
dynamic_cast<AngelScriptScript*>(lib->LoadScript(ScriptCategory::Creature, "testScript1"));
|
||||
dynamic_cast<AngelScriptScript*>(lib->LoadScript(ScriptCategory::Creature, "testScript1"_cnc));
|
||||
auto ctxPool = obj->GetContextPool();
|
||||
auto ctx = ctxPool->RequestContext();
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ static AngelScripResolver* GetScriptResolver(PkmnLib::Battling::BattleLibrary* m
|
||||
|
||||
static ScriptData GetScript(PkmnLib::Battling::BattleLibrary* mainLib, const char* funcName) {
|
||||
auto lib = GetScriptResolver(mainLib);
|
||||
auto s = lib->LoadScript(ScriptCategory::Creature, "testScript1");
|
||||
auto s = lib->LoadScript(ScriptCategory::Creature, "testScript1"_cnc);
|
||||
auto script = dynamic_cast<AngelScriptScript*>(s);
|
||||
auto ctxPool = script->GetContextPool();
|
||||
auto ctx = ctxPool->RequestContext();
|
||||
|
||||
@@ -43,7 +43,7 @@ static AngelScripResolver* GetScriptResolver(PkmnLib::Battling::BattleLibrary* m
|
||||
|
||||
static ScriptData GetScript(PkmnLib::Battling::BattleLibrary* mainLib, const char* funcName) {
|
||||
auto lib = GetScriptResolver(mainLib);
|
||||
auto s = lib->LoadScript(ScriptCategory::Creature, "testScript1");
|
||||
auto s = lib->LoadScript(ScriptCategory::Creature, "testScript1"_cnc);
|
||||
auto script = dynamic_cast<AngelScriptScript*>(s);
|
||||
auto ctxPool = script->GetContextPool();
|
||||
auto ctx = ctxPool->RequestContext();
|
||||
|
||||
@@ -39,7 +39,7 @@ static AngelScripResolver* GetScriptResolver(PkmnLib::Battling::BattleLibrary* m
|
||||
|
||||
static ScriptData GetScript(PkmnLib::Battling::BattleLibrary* mainLib, const char* funcName) {
|
||||
auto lib = GetScriptResolver(mainLib);
|
||||
auto s = lib->LoadScript(ScriptCategory::Creature, "testScript1");
|
||||
auto s = lib->LoadScript(ScriptCategory::Creature, "testScript1"_cnc);
|
||||
auto script = dynamic_cast<AngelScriptScript*>(s);
|
||||
auto ctxPool = script->GetContextPool();
|
||||
auto ctx = ctxPool->RequestContext();
|
||||
|
||||
@@ -43,7 +43,7 @@ static AngelScripResolver* GetScriptResolver(PkmnLib::Battling::BattleLibrary* m
|
||||
|
||||
static ScriptData GetScript(PkmnLib::Battling::BattleLibrary* mainLib, const char* funcName) {
|
||||
auto lib = GetScriptResolver(mainLib);
|
||||
auto s = lib->LoadScript(ScriptCategory::Creature, "testScript1");
|
||||
auto s = lib->LoadScript(ScriptCategory::Creature, "testScript1"_cnc);
|
||||
auto script = dynamic_cast<AngelScriptScript*>(s);
|
||||
auto ctxPool = script->GetContextPool();
|
||||
auto ctx = ctxPool->RequestContext();
|
||||
|
||||
@@ -41,7 +41,7 @@ static AngelScripResolver* GetScriptResolver(PkmnLib::Battling::BattleLibrary* m
|
||||
|
||||
static ScriptData GetScript(PkmnLib::Battling::BattleLibrary* mainLib, const char* funcName) {
|
||||
auto lib = GetScriptResolver(mainLib);
|
||||
auto s = lib->LoadScript(ScriptCategory::Creature, "testScript1");
|
||||
auto s = lib->LoadScript(ScriptCategory::Creature, "testScript1"_cnc);
|
||||
auto script = dynamic_cast<AngelScriptScript*>(s);
|
||||
auto ctxPool = script->GetContextPool();
|
||||
auto ctx = ctxPool->RequestContext();
|
||||
|
||||
@@ -42,7 +42,7 @@ static AngelScripResolver* GetScriptResolver(PkmnLib::Battling::BattleLibrary* m
|
||||
|
||||
static ScriptData GetScript(PkmnLib::Battling::BattleLibrary* mainLib, const char* funcName) {
|
||||
auto lib = GetScriptResolver(mainLib);
|
||||
auto s = lib->LoadScript(ScriptCategory::Creature, "testScript1");
|
||||
auto s = lib->LoadScript(ScriptCategory::Creature, "testScript1"_cnc);
|
||||
auto script = dynamic_cast<AngelScriptScript*>(s);
|
||||
auto ctxPool = script->GetContextPool();
|
||||
auto ctx = ctxPool->RequestContext();
|
||||
|
||||
Reference in New Issue
Block a user