Support not including standard angelscript libraries such as string and array.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2020-09-19 15:57:20 +02:00
parent f073e951b1
commit fda3c8f86d
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
2 changed files with 12 additions and 7 deletions

View File

@ -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();

View File

@ -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; }