Add day length compatibility fixup for BeeRewards GS
This commit is contained in:
9
bin/game/compat_brgs.nut
Normal file
9
bin/game/compat_brgs.nut
Normal file
@@ -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),
|
suspend(0),
|
||||||
is_paused(false),
|
is_paused(false),
|
||||||
in_shutdown(false),
|
in_shutdown(false),
|
||||||
callback(nullptr)
|
callback(nullptr),
|
||||||
|
APIName(APIName)
|
||||||
{
|
{
|
||||||
this->storage = new ScriptStorage();
|
this->storage = new ScriptStorage();
|
||||||
this->engine = new Squirrel(APIName);
|
this->engine = new Squirrel(APIName);
|
||||||
@@ -87,6 +88,12 @@ void ScriptInstance::Initialize(const char *main_script, const char *instance_na
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (strcmp(this->APIName, "GS") == 0) {
|
||||||
|
if (strcmp(instance_name, "BeeRewardClass") == 0) {
|
||||||
|
this->LoadCompatibilityScripts("brgs", GAME_DIR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Create the main-class */
|
/* Create the main-class */
|
||||||
this->instance = new SQObject();
|
this->instance = new SQObject();
|
||||||
if (!this->engine->CreateClassInstance(instance_name, this->controller, this->instance)) {
|
if (!this->engine->CreateClassInstance(instance_name, this->controller, this->instance)) {
|
||||||
|
@@ -256,6 +256,7 @@ private:
|
|||||||
bool in_shutdown; ///< Is this instance currently being destructed?
|
bool in_shutdown; ///< Is this instance currently being destructed?
|
||||||
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.
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Call the script Load function if it exists and data was loaded
|
* Call the script Load function if it exists and data was loaded
|
||||||
|
Reference in New Issue
Block a user