Add script category to script creation function in AngelScript.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user