Script: Remove command delay for non-network GS when game paused due to GS

This commit is contained in:
Jonathan G Rennison
2023-05-14 18:40:24 +01:00
parent 7bc6c4b59c
commit f06160b882
2 changed files with 9 additions and 0 deletions

View File

@@ -23,6 +23,7 @@
#include "../script_storage.hpp" #include "../script_storage.hpp"
#include "../script_instance.hpp" #include "../script_instance.hpp"
#include "../script_fatalerror.hpp" #include "../script_fatalerror.hpp"
#include "script_controller.hpp"
#include "script_error.hpp" #include "script_error.hpp"
#include "../../debug.h" #include "../../debug.h"
@@ -383,6 +384,12 @@ ScriptObject::ActiveInstance::~ActiveInstance()
} else if (_networking) { } else if (_networking) {
/* Suspend the script till the command is really executed. */ /* Suspend the script till the command is really executed. */
throw Script_Suspend(-(int)GetDoCommandDelay(), callback); throw Script_Suspend(-(int)GetDoCommandDelay(), callback);
} else if (GetActiveInstance()->GetScriptType() == ST_GS && (_pause_mode & PM_PAUSED_GAME_SCRIPT) != PM_UNPAUSED) {
/* Game is paused due to GS, just execute as fast as possible */
IncreaseDoCommandCosts(res.GetCost());
ScriptController::DecreaseOps(100);
callback(GetActiveInstance());
throw SQInteger(1);
} else { } else {
IncreaseDoCommandCosts(res.GetCost()); IncreaseDoCommandCosts(res.GetCost());

View File

@@ -329,6 +329,8 @@ private:
static bool LoadObjects(HSQUIRRELVM vm, ScriptData *data); static bool LoadObjects(HSQUIRRELVM vm, ScriptData *data);
public: public:
inline ScriptType GetScriptType() const { return this->script_type; }
inline bool IsTextParamMismatchAllowed() const { return this->allow_text_param_mismatch; } inline bool IsTextParamMismatchAllowed() const { return this->allow_text_param_mismatch; }
}; };