Fixed spelling error in AngelScriptResolver name.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
1d5c6d696e
commit
42ea76cf53
|
@ -1,4 +1,4 @@
|
|||
#include "AngelScripResolver.hpp"
|
||||
#include "AngelScriptResolver.hpp"
|
||||
#include <CreatureLib/Battling/Models/Creature.hpp>
|
||||
#include <cassert>
|
||||
#include <regex>
|
||||
|
@ -24,7 +24,7 @@
|
|||
#include "TypeRegistry/Library/RegisterTypeLibrary.hpp"
|
||||
|
||||
CreatureLib::Battling::ScriptResolver* PkmnLib::Battling::BattleLibrary::CreateScriptResolver() {
|
||||
return new AngelScripResolver();
|
||||
return new AngelScriptResolver();
|
||||
}
|
||||
|
||||
static void TranslateException(asIScriptContext* ctx, void* /*userParam*/) {
|
||||
|
@ -40,7 +40,7 @@ static void TranslateException(asIScriptContext* ctx, void* /*userParam*/) {
|
|||
}
|
||||
}
|
||||
|
||||
void AngelScripResolver::Initialize(CreatureLib::Battling::BattleLibrary* arg) {
|
||||
void AngelScriptResolver::Initialize(CreatureLib::Battling::BattleLibrary* arg) {
|
||||
for (auto scriptCategory : ScriptCategoryHelper::GetValues()) {
|
||||
_typeDatabase.Insert(scriptCategory, {});
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ void AngelScripResolver::Initialize(CreatureLib::Battling::BattleLibrary* arg) {
|
|||
_contextPool = new ContextPool(_engine);
|
||||
}
|
||||
|
||||
void AngelScripResolver::RegisterTypes() {
|
||||
void AngelScriptResolver::RegisterTypes() {
|
||||
// Register static library types
|
||||
RegisterSpeciesTypes::Register(_engine);
|
||||
RegisterItemTypes::Register(_engine);
|
||||
|
@ -113,7 +113,7 @@ void AngelScripResolver::RegisterTypes() {
|
|||
BasicScriptClass::Register(_engine);
|
||||
}
|
||||
|
||||
void AngelScripResolver::MessageCallback(const asSMessageInfo* msg, void* param) {
|
||||
void AngelScriptResolver::MessageCallback(const asSMessageInfo* msg, void* param) {
|
||||
const char* type = "ERR ";
|
||||
if (msg->type == asMSGTYPE_WARNING)
|
||||
type = "WARN";
|
||||
|
@ -122,7 +122,7 @@ void AngelScripResolver::MessageCallback(const asSMessageInfo* msg, void* param)
|
|||
printf("%s (%d, %d) : %s : %s\n", msg->section, msg->row, msg->col, type, msg->message);
|
||||
}
|
||||
|
||||
CreatureLib::Battling::Script* AngelScripResolver::LoadScript(ScriptCategory category, const ConstString& scriptName) {
|
||||
CreatureLib::Battling::Script* AngelScriptResolver::LoadScript(ScriptCategory category, const ConstString& scriptName) {
|
||||
Dictionary<ConstString, AngelScriptTypeInfo*> innerDb;
|
||||
if (!_typeDatabase.TryGet(category, innerDb)) {
|
||||
_typeDatabase.Insert(category, innerDb);
|
||||
|
@ -141,7 +141,7 @@ CreatureLib::Battling::Script* AngelScripResolver::LoadScript(ScriptCategory cat
|
|||
_contextPool->ReturnContextToPool(ctx);
|
||||
return new AngelScriptScript(this, t, obj, _contextPool);
|
||||
}
|
||||
void AngelScripResolver::FinalizeModule() {
|
||||
void AngelScriptResolver::FinalizeModule() {
|
||||
int r = _builder.BuildModule();
|
||||
if (r < 0)
|
||||
throw CreatureException("Building Script Module failed.");
|
||||
|
@ -205,10 +205,10 @@ void AngelScripResolver::FinalizeModule() {
|
|||
}
|
||||
}
|
||||
}
|
||||
void AngelScripResolver::CreateScript(const char* name, const char* script) {
|
||||
void AngelScriptResolver::CreateScript(const char* name, const char* script) {
|
||||
_builder.AddSectionFromMemory(name, script);
|
||||
}
|
||||
void AngelScripResolver::WriteByteCodeToFile(const char* file, bool stripDebugInfo) {
|
||||
void AngelScriptResolver::WriteByteCodeToFile(const char* file, bool stripDebugInfo) {
|
||||
FILE* wFile = nullptr;
|
||||
wFile = fopen(file, "wb");
|
||||
AssertNotNull(wFile);
|
||||
|
@ -217,7 +217,7 @@ void AngelScripResolver::WriteByteCodeToFile(const char* file, bool stripDebugIn
|
|||
Assert(fclose(wFile) == 0);
|
||||
delete stream;
|
||||
}
|
||||
void AngelScripResolver::LoadByteCodeFromFile(
|
||||
void AngelScriptResolver::LoadByteCodeFromFile(
|
||||
const char* file, const Dictionary<ScriptCategory, Dictionary<ConstString, const char*>>& types) {
|
||||
FILE* rFile = nullptr;
|
||||
rFile = fopen(file, "rb");
|
||||
|
@ -227,7 +227,7 @@ void AngelScripResolver::LoadByteCodeFromFile(
|
|||
Assert(fclose(rFile) == 0);
|
||||
delete stream;
|
||||
}
|
||||
uint8_t* AngelScripResolver::WriteByteCodeToMemory(size_t& size, bool stripDebugInfo) {
|
||||
uint8_t* AngelScriptResolver::WriteByteCodeToMemory(size_t& size, bool stripDebugInfo) {
|
||||
auto stream = new MemoryByteCodeStream();
|
||||
auto result = _mainModule->SaveByteCode(stream, stripDebugInfo);
|
||||
Assert(result == asSUCCESS);
|
||||
|
@ -237,13 +237,13 @@ uint8_t* AngelScripResolver::WriteByteCodeToMemory(size_t& size, bool stripDebug
|
|||
delete stream;
|
||||
return arr;
|
||||
}
|
||||
void AngelScripResolver::LoadByteCodeFromMemory(
|
||||
void AngelScriptResolver::LoadByteCodeFromMemory(
|
||||
uint8_t* byte, size_t size, const Dictionary<ScriptCategory, Dictionary<ConstString, const char*>>& types) {
|
||||
auto stream = new MemoryByteCodeStream(byte, size);
|
||||
InitializeByteCode(stream, types);
|
||||
delete stream;
|
||||
}
|
||||
void AngelScripResolver::InitializeByteCode(
|
||||
void AngelScriptResolver::InitializeByteCode(
|
||||
asIBinaryStream* stream, const Dictionary<ScriptCategory, Dictionary<ConstString, const char*>>& types) {
|
||||
int result = _mainModule->LoadByteCode(stream);
|
||||
Assert(result == asSUCCESS);
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef PKMNLIB_ANGELSCRIPRESOLVER_HPP
|
||||
#define PKMNLIB_ANGELSCRIPRESOLVER_HPP
|
||||
#ifndef PKMNLIB_ANGELSCRIPTRESOLVER_HPP
|
||||
#define PKMNLIB_ANGELSCRIPTRESOLVER_HPP
|
||||
|
||||
#include <CreatureLib/Battling/ScriptHandling/ScriptResolver.hpp>
|
||||
#include "../../../extern/angelscript_addons/scriptbuilder/scriptbuilder.h"
|
||||
|
@ -12,7 +12,7 @@
|
|||
#include "AngelScriptTypeInfo.hpp"
|
||||
using namespace Arbutils::Collections;
|
||||
|
||||
class AngelScripResolver : public CreatureLib::Battling::ScriptResolver {
|
||||
class AngelScriptResolver : public CreatureLib::Battling::ScriptResolver {
|
||||
private:
|
||||
asIScriptEngine* _engine = nullptr;
|
||||
asIScriptModule* _mainModule = nullptr;
|
||||
|
@ -29,7 +29,7 @@ private:
|
|||
const Dictionary<ScriptCategory, Dictionary<ConstString, const char*>>& types);
|
||||
|
||||
public:
|
||||
~AngelScripResolver() override {
|
||||
~AngelScriptResolver() override {
|
||||
delete _contextPool;
|
||||
for (const auto& category : _typeDatabase) {
|
||||
for (const auto& type : category.second) {
|
|
@ -1,5 +1,5 @@
|
|||
#include "AngelScriptScript.hpp"
|
||||
#include "AngelScripResolver.hpp"
|
||||
#include "AngelScriptResolver.hpp"
|
||||
|
||||
#define CALL_HOOK(name, setup) \
|
||||
auto s = _type->Get##name(); \
|
||||
|
|
|
@ -10,17 +10,17 @@
|
|||
#include "AngelScriptTypeInfo.hpp"
|
||||
#include "ContextPool.hpp"
|
||||
|
||||
class AngelScripResolver;
|
||||
class AngelScriptResolver;
|
||||
class AngelScriptScript : public PkmnLib::Battling::PkmnScript {
|
||||
private:
|
||||
AngelScripResolver* _resolver = nullptr;
|
||||
AngelScriptResolver* _resolver = nullptr;
|
||||
AngelScriptTypeInfo* _type = nullptr;
|
||||
ContextPool* _ctxPool = nullptr;
|
||||
|
||||
asIScriptObject* _obj = nullptr;
|
||||
CScriptArray* GetEffectParameters(const List<CreatureLib::Library::EffectParameter*>& ls);
|
||||
public:
|
||||
AngelScriptScript(AngelScripResolver* resolver, AngelScriptTypeInfo* type, asIScriptObject* obj,
|
||||
AngelScriptScript(AngelScriptResolver* resolver, AngelScriptTypeInfo* type, asIScriptObject* obj,
|
||||
ContextPool* ctxPool)
|
||||
: _resolver(resolver), _type(type), _ctxPool(ctxPool), _obj(obj) {}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifdef TESTS_BUILD
|
||||
#include "../../extern/catch.hpp"
|
||||
#include "../../src/Battling/Pokemon/CreatePokemon.hpp"
|
||||
#include "../../src/ScriptResolving/AngelScript/AngelScripResolver.hpp"
|
||||
#include "../../src/ScriptResolving/AngelScript/AngelScriptResolver.hpp"
|
||||
#include "../TestLibrary/TestLibrary.hpp"
|
||||
|
||||
#define AS_CLASS(name, contents) \
|
||||
|
@ -75,10 +75,10 @@ void StopBeforeAttack(ExecutingMove@ attack, bool& result) override{
|
|||
|
||||
};
|
||||
|
||||
static AngelScripResolver* _resolverCache = nullptr;
|
||||
static AngelScripResolver* GetScriptResolver(PkmnLib::Battling::BattleLibrary* mainLib) {
|
||||
static AngelScriptResolver* _resolverCache = nullptr;
|
||||
static AngelScriptResolver* GetScriptResolver(PkmnLib::Battling::BattleLibrary* mainLib) {
|
||||
if (_resolverCache == nullptr) {
|
||||
_resolverCache = dynamic_cast<AngelScripResolver*>(PkmnLib::Battling::BattleLibrary::CreateScriptResolver());
|
||||
_resolverCache = dynamic_cast<AngelScriptResolver*>(PkmnLib::Battling::BattleLibrary::CreateScriptResolver());
|
||||
_resolverCache->Initialize(mainLib);
|
||||
for (auto kv : _scripts) {
|
||||
_resolverCache->CreateScript(kv.first, kv.second);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#ifdef TESTS_BUILD
|
||||
#include "../../extern/catch.hpp"
|
||||
#include "../../src/ScriptResolving/AngelScript/AngelScripResolver.hpp"
|
||||
#include "../../src/ScriptResolving/AngelScript/AngelScriptResolver.hpp"
|
||||
#include "../TestLibrary/TestLibrary.hpp"
|
||||
|
||||
static std::unordered_map<const char*, const char*> _scripts =
|
||||
|
@ -28,7 +28,7 @@ TEST_CASE("Get a script resolver, initialize it, then delete it") {
|
|||
}
|
||||
|
||||
TEST_CASE("Get a script resolver, set script load function, load script, then build module") {
|
||||
auto lib = dynamic_cast<AngelScripResolver*>(PkmnLib::Battling::BattleLibrary::CreateScriptResolver());
|
||||
auto lib = dynamic_cast<AngelScriptResolver*>(PkmnLib::Battling::BattleLibrary::CreateScriptResolver());
|
||||
lib->Initialize(TestLibrary::GetLibrary());
|
||||
lib->CreateScript("testScript1", _scripts["testScript1"]);
|
||||
lib->FinalizeModule();
|
||||
|
@ -36,7 +36,7 @@ TEST_CASE("Get a script resolver, set script load function, load script, then bu
|
|||
}
|
||||
|
||||
TEST_CASE("Build script resolver, then create object") {
|
||||
auto lib = dynamic_cast<AngelScripResolver*>(PkmnLib::Battling::BattleLibrary::CreateScriptResolver());
|
||||
auto lib = dynamic_cast<AngelScriptResolver*>(PkmnLib::Battling::BattleLibrary::CreateScriptResolver());
|
||||
lib->Initialize(TestLibrary::GetLibrary());
|
||||
lib->CreateScript("testScript1", _scripts["testScript1"]);
|
||||
lib->FinalizeModule();
|
||||
|
@ -48,7 +48,7 @@ TEST_CASE("Build script resolver, then create object") {
|
|||
}
|
||||
|
||||
TEST_CASE("Build script resolver, create object, invoke addition method") {
|
||||
auto lib = dynamic_cast<AngelScripResolver*>(PkmnLib::Battling::BattleLibrary::CreateScriptResolver());
|
||||
auto lib = dynamic_cast<AngelScriptResolver*>(PkmnLib::Battling::BattleLibrary::CreateScriptResolver());
|
||||
lib->Initialize(TestLibrary::GetLibrary());
|
||||
lib->CreateScript("testScript1", _scripts["testScript1"]);
|
||||
lib->FinalizeModule();
|
||||
|
@ -79,7 +79,7 @@ TEST_CASE("Build script resolver, create object, invoke addition method") {
|
|||
}
|
||||
|
||||
TEST_CASE("Get a script resolver, save the byte code to memory, create new script resolver from it") {
|
||||
auto originLib = dynamic_cast<AngelScripResolver*>(PkmnLib::Battling::BattleLibrary::CreateScriptResolver());
|
||||
auto originLib = dynamic_cast<AngelScriptResolver*>(PkmnLib::Battling::BattleLibrary::CreateScriptResolver());
|
||||
originLib->Initialize(TestLibrary::GetLibrary());
|
||||
originLib->CreateScript("testScript1", _scripts["testScript1"]);
|
||||
originLib->FinalizeModule();
|
||||
|
@ -97,7 +97,7 @@ TEST_CASE("Get a script resolver, save the byte code to memory, create new scrip
|
|||
types.Insert(innerDb.first, newInnerDb);
|
||||
}
|
||||
|
||||
auto newLib = dynamic_cast<AngelScripResolver*>(PkmnLib::Battling::BattleLibrary::CreateScriptResolver());
|
||||
auto newLib = dynamic_cast<AngelScriptResolver*>(PkmnLib::Battling::BattleLibrary::CreateScriptResolver());
|
||||
newLib->Initialize(TestLibrary::GetLibrary());
|
||||
newLib->LoadByteCodeFromMemory(byteCode, size, types);
|
||||
auto obj = dynamic_cast<AngelScriptScript*>(newLib->LoadScript(ScriptCategory::Creature, "testScript1"_cnc));
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifdef TESTS_BUILD
|
||||
#include "../../../../extern/catch.hpp"
|
||||
#include "../../../../src/Battling/Pokemon/CreatePokemon.hpp"
|
||||
#include "../../../../src/ScriptResolving/AngelScript/AngelScripResolver.hpp"
|
||||
#include "../../../../src/ScriptResolving/AngelScript/AngelScriptResolver.hpp"
|
||||
#include "../../../TestLibrary/TestLibrary.hpp"
|
||||
|
||||
static std::unordered_map<const char*, const char*> _scripts =
|
||||
|
@ -32,7 +32,7 @@ class testScript1 {
|
|||
|
||||
struct ScriptData {
|
||||
AngelScriptScript* Script = nullptr;
|
||||
AngelScripResolver* Resolver = nullptr;
|
||||
AngelScriptResolver* Resolver = nullptr;
|
||||
asIScriptFunction* Func = nullptr;
|
||||
asIScriptContext* Context = nullptr;
|
||||
|
||||
|
@ -42,10 +42,10 @@ struct ScriptData {
|
|||
}
|
||||
};
|
||||
|
||||
static AngelScripResolver* _resolverCache = nullptr;
|
||||
static AngelScripResolver* GetScriptResolver(PkmnLib::Battling::BattleLibrary* mainLib) {
|
||||
static AngelScriptResolver* _resolverCache = nullptr;
|
||||
static AngelScriptResolver* GetScriptResolver(PkmnLib::Battling::BattleLibrary* mainLib) {
|
||||
if (_resolverCache == nullptr) {
|
||||
_resolverCache = dynamic_cast<AngelScripResolver*>(PkmnLib::Battling::BattleLibrary::CreateScriptResolver());
|
||||
_resolverCache = dynamic_cast<AngelScriptResolver*>(PkmnLib::Battling::BattleLibrary::CreateScriptResolver());
|
||||
_resolverCache->Initialize(mainLib);
|
||||
_resolverCache->CreateScript("testScript1" , _scripts["testScript1"]);
|
||||
_resolverCache->FinalizeModule();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#ifdef TESTS_BUILD
|
||||
#include "../../../../extern/catch.hpp"
|
||||
#include "../../../../src/ScriptResolving/AngelScript/AngelScripResolver.hpp"
|
||||
#include "../../../../src/ScriptResolving/AngelScript/AngelScriptResolver.hpp"
|
||||
#include "../../../TestLibrary/TestLibrary.hpp"
|
||||
|
||||
static std::unordered_map<const char*, const char*> _scripts =
|
||||
|
@ -21,7 +21,7 @@ class testScript1 {
|
|||
|
||||
struct ScriptData {
|
||||
AngelScriptScript* Script = nullptr;
|
||||
AngelScripResolver* Resolver = nullptr;
|
||||
AngelScriptResolver* Resolver = nullptr;
|
||||
asIScriptFunction* Func = nullptr;
|
||||
asIScriptContext* Context = nullptr;
|
||||
|
||||
|
@ -31,10 +31,10 @@ struct ScriptData {
|
|||
}
|
||||
};
|
||||
|
||||
static AngelScripResolver* _resolverCache = nullptr;
|
||||
static AngelScripResolver* GetScriptResolver(PkmnLib::Battling::BattleLibrary* mainLib){
|
||||
static AngelScriptResolver* _resolverCache = nullptr;
|
||||
static AngelScriptResolver* GetScriptResolver(PkmnLib::Battling::BattleLibrary* mainLib){
|
||||
if (_resolverCache == nullptr){
|
||||
_resolverCache = dynamic_cast<AngelScripResolver*>(PkmnLib::Battling::BattleLibrary::CreateScriptResolver());
|
||||
_resolverCache = dynamic_cast<AngelScriptResolver*>(PkmnLib::Battling::BattleLibrary::CreateScriptResolver());
|
||||
_resolverCache->Initialize(mainLib);
|
||||
_resolverCache->CreateScript("testScript1" , _scripts["testScript1"]);
|
||||
_resolverCache->FinalizeModule();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#ifdef TESTS_BUILD
|
||||
#include "../../../../extern/catch.hpp"
|
||||
#include "../../../../src/ScriptResolving/AngelScript/AngelScripResolver.hpp"
|
||||
#include "../../../../src/ScriptResolving/AngelScript/AngelScriptResolver.hpp"
|
||||
#include "../../../TestLibrary/TestLibrary.hpp"
|
||||
|
||||
static std::unordered_map<const char*, const char*> _scripts =
|
||||
|
@ -17,7 +17,7 @@ class testScript1 {
|
|||
|
||||
struct ScriptData {
|
||||
AngelScriptScript* Script = nullptr;
|
||||
AngelScripResolver* Resolver = nullptr;
|
||||
AngelScriptResolver* Resolver = nullptr;
|
||||
asIScriptFunction* Func = nullptr;
|
||||
asIScriptContext* Context = nullptr;
|
||||
|
||||
|
@ -27,10 +27,10 @@ struct ScriptData {
|
|||
}
|
||||
};
|
||||
|
||||
static AngelScripResolver* _resolverCache = nullptr;
|
||||
static AngelScripResolver* GetScriptResolver(PkmnLib::Battling::BattleLibrary* mainLib){
|
||||
static AngelScriptResolver* _resolverCache = nullptr;
|
||||
static AngelScriptResolver* GetScriptResolver(PkmnLib::Battling::BattleLibrary* mainLib){
|
||||
if (_resolverCache == nullptr){
|
||||
_resolverCache = dynamic_cast<AngelScripResolver*>(PkmnLib::Battling::BattleLibrary::CreateScriptResolver());
|
||||
_resolverCache = dynamic_cast<AngelScriptResolver*>(PkmnLib::Battling::BattleLibrary::CreateScriptResolver());
|
||||
_resolverCache->Initialize(mainLib);
|
||||
_resolverCache->CreateScript("testScript1" , _scripts["testScript1"]);
|
||||
_resolverCache->FinalizeModule();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#ifdef TESTS_BUILD
|
||||
#include "../../../../extern/catch.hpp"
|
||||
#include "../../../../src/ScriptResolving/AngelScript/AngelScripResolver.hpp"
|
||||
#include "../../../../src/ScriptResolving/AngelScript/AngelScriptResolver.hpp"
|
||||
#include "../../../TestLibrary/TestLibrary.hpp"
|
||||
|
||||
static std::unordered_map<const char*, const char*> _scripts =
|
||||
|
@ -21,7 +21,7 @@ class testScript1 {
|
|||
|
||||
struct ScriptData {
|
||||
AngelScriptScript* Script = nullptr;
|
||||
AngelScripResolver* Resolver = nullptr;
|
||||
AngelScriptResolver* Resolver = nullptr;
|
||||
asIScriptFunction* Func = nullptr;
|
||||
asIScriptContext* Context = nullptr;
|
||||
|
||||
|
@ -31,10 +31,10 @@ struct ScriptData {
|
|||
}
|
||||
};
|
||||
|
||||
static AngelScripResolver* _resolverCache = nullptr;
|
||||
static AngelScripResolver* GetScriptResolver(PkmnLib::Battling::BattleLibrary* mainLib){
|
||||
static AngelScriptResolver* _resolverCache = nullptr;
|
||||
static AngelScriptResolver* GetScriptResolver(PkmnLib::Battling::BattleLibrary* mainLib){
|
||||
if (_resolverCache == nullptr){
|
||||
_resolverCache = dynamic_cast<AngelScripResolver*>(PkmnLib::Battling::BattleLibrary::CreateScriptResolver());
|
||||
_resolverCache = dynamic_cast<AngelScriptResolver*>(PkmnLib::Battling::BattleLibrary::CreateScriptResolver());
|
||||
_resolverCache->Initialize(mainLib);
|
||||
_resolverCache->CreateScript("testScript1" , _scripts["testScript1"]);
|
||||
_resolverCache->FinalizeModule();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#ifdef TESTS_BUILD
|
||||
#include "../../../../extern/catch.hpp"
|
||||
#include "../../../../src/ScriptResolving/AngelScript/AngelScripResolver.hpp"
|
||||
#include "../../../../src/ScriptResolving/AngelScript/AngelScriptResolver.hpp"
|
||||
#include "../../../TestLibrary/TestLibrary.hpp"
|
||||
|
||||
static std::unordered_map<const char*, const char*> _scripts =
|
||||
|
@ -19,7 +19,7 @@ class testScript1 {
|
|||
|
||||
struct ScriptData {
|
||||
AngelScriptScript* Script;
|
||||
AngelScripResolver* Resolver;
|
||||
AngelScriptResolver* Resolver;
|
||||
asIScriptFunction* Func;
|
||||
asIScriptContext* Context;
|
||||
|
||||
|
@ -29,10 +29,10 @@ struct ScriptData {
|
|||
}
|
||||
};
|
||||
|
||||
static AngelScripResolver* _resolverCache = nullptr;
|
||||
static AngelScripResolver* GetScriptResolver(PkmnLib::Battling::BattleLibrary* mainLib){
|
||||
static AngelScriptResolver* _resolverCache = nullptr;
|
||||
static AngelScriptResolver* GetScriptResolver(PkmnLib::Battling::BattleLibrary* mainLib){
|
||||
if (_resolverCache == nullptr){
|
||||
_resolverCache = dynamic_cast<AngelScripResolver*>(PkmnLib::Battling::BattleLibrary::CreateScriptResolver());
|
||||
_resolverCache = dynamic_cast<AngelScriptResolver*>(PkmnLib::Battling::BattleLibrary::CreateScriptResolver());
|
||||
_resolverCache->Initialize(mainLib);
|
||||
_resolverCache->CreateScript("testScript1" , _scripts["testScript1"]);
|
||||
_resolverCache->FinalizeModule();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#ifdef TESTS_BUILD
|
||||
#include "../../../../extern/catch.hpp"
|
||||
#include "../../../../src/ScriptResolving/AngelScript/AngelScripResolver.hpp"
|
||||
#include "../../../../src/ScriptResolving/AngelScript/AngelScriptResolver.hpp"
|
||||
#include "../../../TestLibrary/TestLibrary.hpp"
|
||||
|
||||
static std::unordered_map<const char*, const char*> _scripts =
|
||||
|
@ -20,7 +20,7 @@ class testScript1 {
|
|||
|
||||
struct ScriptData {
|
||||
AngelScriptScript* Script;
|
||||
AngelScripResolver* Resolver;
|
||||
AngelScriptResolver* Resolver;
|
||||
asIScriptFunction* Func;
|
||||
asIScriptContext* Context;
|
||||
|
||||
|
@ -30,10 +30,10 @@ struct ScriptData {
|
|||
}
|
||||
};
|
||||
|
||||
static AngelScripResolver* _resolverCache = nullptr;
|
||||
static AngelScripResolver* GetScriptResolver(PkmnLib::Battling::BattleLibrary* mainLib){
|
||||
static AngelScriptResolver* _resolverCache = nullptr;
|
||||
static AngelScriptResolver* GetScriptResolver(PkmnLib::Battling::BattleLibrary* mainLib){
|
||||
if (_resolverCache == nullptr){
|
||||
_resolverCache = dynamic_cast<AngelScripResolver*>(PkmnLib::Battling::BattleLibrary::CreateScriptResolver());
|
||||
_resolverCache = dynamic_cast<AngelScriptResolver*>(PkmnLib::Battling::BattleLibrary::CreateScriptResolver());
|
||||
_resolverCache->Initialize(mainLib);
|
||||
_resolverCache->CreateScript("testScript1" , _scripts["testScript1"]);
|
||||
_resolverCache->FinalizeModule();
|
||||
|
|
Loading…
Reference in New Issue