Add script category to script creation function in AngelScript.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2020-02-13 13:59:07 +01:00
parent eeedbdac03
commit 6032610de6
11 changed files with 45 additions and 29 deletions

View File

@@ -110,7 +110,7 @@ void AngelScripResolver::FinalizeModule() {
if (r < 0)
throw CreatureException("Building Script Module failed.");
}
void AngelScripResolver::CreateScript(const char* scriptName) {
auto scriptString = _loadFunc(scriptName);
void AngelScripResolver::CreateScript(ScriptCategory category, const char* scriptName) {
auto scriptString = _loadFunc(category, scriptName);
_mainModule->AddScriptSection(scriptName, scriptString);
}

View File

@@ -15,7 +15,7 @@ private:
asIScriptEngine* _engine = nullptr;
asIScriptModule* _mainModule = nullptr;
ContextPool* _contextPool = nullptr;
const char* (*_loadFunc)(const char*) = nullptr;
const char* (*_loadFunc)(ScriptCategory category, const char*) = nullptr;
std::unordered_map<std::string, AngelScriptTypeInfo*> _types;
static void MessageCallback(const asSMessageInfo* msg, void* param);
@@ -36,9 +36,11 @@ public:
void Initialize(CreatureLib::Battling::BattleLibrary* library) override;
void SetCreateFunction(const char* (*loadFunc)(const char* scriptName)) { _loadFunc = loadFunc; }
void SetCreateFunction(const char* (*loadFunc)(ScriptCategory category, const char* scriptName)) {
_loadFunc = loadFunc;
}
void CreateScript(const char* scriptName);
void CreateScript(ScriptCategory category, const char* scriptName);
void FinalizeModule();