Script: Add ScriptInstance field for script type
This commit is contained in:
@@ -33,7 +33,7 @@
|
|||||||
#include "../safeguards.h"
|
#include "../safeguards.h"
|
||||||
|
|
||||||
AIInstance::AIInstance() :
|
AIInstance::AIInstance() :
|
||||||
ScriptInstance("AI")
|
ScriptInstance("AI", ST_AI)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void AIInstance::Initialize(AIInfo *info)
|
void AIInstance::Initialize(AIInfo *info)
|
||||||
|
@@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
|
|
||||||
GameInstance::GameInstance() :
|
GameInstance::GameInstance() :
|
||||||
ScriptInstance("GS")
|
ScriptInstance("GS", ST_GS)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void GameInstance::Initialize(GameInfo *info)
|
void GameInstance::Initialize(GameInfo *info)
|
||||||
|
@@ -49,7 +49,7 @@ static void PrintFunc(bool error_msg, const SQChar *message)
|
|||||||
ScriptController::Print(error_msg, message);
|
ScriptController::Print(error_msg, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
ScriptInstance::ScriptInstance(const char *APIName) :
|
ScriptInstance::ScriptInstance(const char *APIName, ScriptType script_type) :
|
||||||
engine(nullptr),
|
engine(nullptr),
|
||||||
versionAPI(nullptr),
|
versionAPI(nullptr),
|
||||||
controller(nullptr),
|
controller(nullptr),
|
||||||
@@ -63,6 +63,7 @@ ScriptInstance::ScriptInstance(const char *APIName) :
|
|||||||
in_shutdown(false),
|
in_shutdown(false),
|
||||||
callback(nullptr),
|
callback(nullptr),
|
||||||
APIName(APIName),
|
APIName(APIName),
|
||||||
|
script_type(script_type),
|
||||||
allow_text_param_mismatch(false)
|
allow_text_param_mismatch(false)
|
||||||
{
|
{
|
||||||
this->storage = new ScriptStorage();
|
this->storage = new ScriptStorage();
|
||||||
@@ -91,7 +92,7 @@ void ScriptInstance::Initialize(const char *main_script, const char *instance_na
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(this->APIName, "GS") == 0) {
|
if (this->script_type == ST_GS) {
|
||||||
if (strcmp(instance_name, "BeeRewardClass") == 0) {
|
if (strcmp(instance_name, "BeeRewardClass") == 0) {
|
||||||
this->LoadCompatibilityScripts("brgs", GAME_DIR);
|
this->LoadCompatibilityScripts("brgs", GAME_DIR);
|
||||||
}
|
}
|
||||||
|
@@ -13,6 +13,7 @@
|
|||||||
#include <variant>
|
#include <variant>
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <squirrel.h>
|
#include <squirrel.h>
|
||||||
|
#include "squirrel.hpp"
|
||||||
#include "script_suspend.hpp"
|
#include "script_suspend.hpp"
|
||||||
|
|
||||||
#include "../command_type.h"
|
#include "../command_type.h"
|
||||||
@@ -45,7 +46,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Create a new script.
|
* Create a new script.
|
||||||
*/
|
*/
|
||||||
ScriptInstance(const char *APIName);
|
ScriptInstance(const char *APIName, ScriptType script_type);
|
||||||
virtual ~ScriptInstance();
|
virtual ~ScriptInstance();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -296,6 +297,7 @@ private:
|
|||||||
Script_SuspendCallbackProc *callback; ///< Callback that should be called in the next tick the script runs.
|
Script_SuspendCallbackProc *callback; ///< Callback that should be called in the next tick the script runs.
|
||||||
size_t last_allocated_memory; ///< Last known allocated memory value (for display for crashed scripts)
|
size_t last_allocated_memory; ///< Last known allocated memory value (for display for crashed scripts)
|
||||||
const char *APIName; ///< Name of the API used for this squirrel.
|
const char *APIName; ///< Name of the API used for this squirrel.
|
||||||
|
ScriptType script_type; ///< Script type.
|
||||||
bool allow_text_param_mismatch; ///< Whether ScriptText parameter mismatches are allowed
|
bool allow_text_param_mismatch; ///< Whether ScriptText parameter mismatches are allowed
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user