Add: [Script] Optional filter parameter to more ScriptXXXList constructors (#11698)

This commit is contained in:
Loïc Guilloux
2024-01-09 09:39:13 +01:00
committed by GitHub
parent f1e999ec59
commit c86d918921
17 changed files with 283 additions and 120 deletions

View File

@@ -11,9 +11,7 @@
#include "script_list.hpp"
#include "script_controller.hpp"
#include "../../debug.h"
#include "../../core/backup_type.hpp"
#include "../../script/squirrel.hpp"
#include <../squirrel/sqvm.h>
#include "../../safeguards.h"
@@ -869,12 +867,7 @@ SQInteger ScriptList::Valuate(HSQUIRRELVM vm)
ScriptObject::SetAllowDoCommand(false);
/* Limit the total number of ops that can be consumed by a valuate operation */
SQInteger new_ops_error_threshold = vm->_ops_till_suspend_error_threshold;
if (vm->_ops_till_suspend_error_threshold == INT64_MIN) {
new_ops_error_threshold = vm->_ops_till_suspend - MAX_VALUATE_OPS;
vm->_ops_till_suspend_error_label = "valuator function";
}
AutoRestoreBackup ops_error_threshold_backup(vm->_ops_till_suspend_error_threshold, new_ops_error_threshold);
SQOpsLimiter limiter(vm, MAX_VALUATE_OPS, "valuator function");
/* Push the function to call */
sq_push(vm, 2);