diff --git a/src/ScriptResolving/AngelScript/AngelScriptResolver.cpp b/src/ScriptResolving/AngelScript/AngelScriptResolver.cpp index 73507b0..95467b2 100644 --- a/src/ScriptResolving/AngelScript/AngelScriptResolver.cpp +++ b/src/ScriptResolving/AngelScript/AngelScriptResolver.cpp @@ -42,7 +42,7 @@ static void TranslateException(asIScriptContext* ctx, void* /*userParam*/) { } } -void AngelScriptResolver::Initialize(CreatureLib::Battling::BattleLibrary* arg) { +void AngelScriptResolver::Initialize(CreatureLib::Battling::BattleLibrary* arg, bool includeStandard) { for (auto scriptCategory : ScriptCategoryHelper::GetValues()) { _typeDatabase.Insert(scriptCategory, {}); } @@ -67,16 +67,18 @@ void AngelScriptResolver::Initialize(CreatureLib::Battling::BattleLibrary* arg) _engine->SetEngineProperty(asEP_PROPERTY_ACCESSOR_MODE, 2); _engine->SetEngineProperty(asEP_COMPILER_WARNINGS, 2); - RegisterStdString(_engine); - ConstStringRegister::Register(_engine); + if (includeStandard){ + RegisterStdString(_engine); + ConstStringRegister::Register(_engine); - // Register Script Array type - RegisterScriptArray(_engine, true); + // Register Script Array type + RegisterScriptArray(_engine, true); + RegisterScriptHandle(_engine); + } r = _engine->RegisterGlobalFunction("void print(const string &in)", asFUNCTION(Print), asCALL_CDECL); if (r < 0) throw ArbUt::Exception("Registering print function failed."); - RegisterScriptHandle(_engine); _builder.StartNewModule(_engine, "pkmn"); _mainModule = _builder.GetModule(); diff --git a/src/ScriptResolving/AngelScript/AngelScriptResolver.hpp b/src/ScriptResolving/AngelScript/AngelScriptResolver.hpp index 53265f0..8f63f6e 100644 --- a/src/ScriptResolving/AngelScript/AngelScriptResolver.hpp +++ b/src/ScriptResolving/AngelScript/AngelScriptResolver.hpp @@ -38,7 +38,10 @@ public: _engine->ShutDownAndRelease(); } - void Initialize(CreatureLib::Battling::BattleLibrary* library) override; + void Initialize(CreatureLib::Battling::BattleLibrary* library) override{ + Initialize(library, true); + } + void Initialize(CreatureLib::Battling::BattleLibrary* library, bool includeStandard); void CreateScript(const char* name, const char* script); const asIScriptModule* GetMainModule() const noexcept { return _mainModule; }