Add day length compatibility fixup for BeeRewards GS

pull/167/head
Jonathan G Rennison 4 years ago
parent 501f7458db
commit 8f964ee637

@ -0,0 +1,9 @@
if ("GetTimeBetweenDates" in CompanyGoal) {
CompanyGoal._GetTimeBetweenDates <- CompanyGoal.GetTimeBetweenDates;
CompanyGoal.GetTimeBetweenDates <- function(start, end)
{
return CompanyGoal._GetTimeBetweenDates(start, start + ((end - start) / GSDate.GetDayLengthFactor()));
}
GSLog.Info("Day length compatibility in effect.");
}

@ -59,7 +59,8 @@ ScriptInstance::ScriptInstance(const char *APIName) :
suspend(0),
is_paused(false),
in_shutdown(false),
callback(nullptr)
callback(nullptr),
APIName(APIName)
{
this->storage = new ScriptStorage();
this->engine = new Squirrel(APIName);
@ -87,6 +88,12 @@ void ScriptInstance::Initialize(const char *main_script, const char *instance_na
return;
}
if (strcmp(this->APIName, "GS") == 0) {
if (strcmp(instance_name, "BeeRewardClass") == 0) {
this->LoadCompatibilityScripts("brgs", GAME_DIR);
}
}
/* Create the main-class */
this->instance = new SQObject();
if (!this->engine->CreateClassInstance(instance_name, this->controller, this->instance)) {

@ -256,6 +256,7 @@ private:
bool in_shutdown; ///< Is this instance currently being destructed?
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)
const char *APIName; ///< Name of the API used for this squirrel.
/**
* Call the script Load function if it exists and data was loaded

Loading…
Cancel
Save