Merge branch 'master' into jgrpp

Bump savegame for water regions for ship pathfinder
Use ring_buffer for ShipPathCache
This commit is contained in:
Jonathan G Rennison
2024-01-09 16:30:06 +00:00
45 changed files with 1406 additions and 332 deletions

View File

@@ -361,6 +361,15 @@ void sq_setdebughook(HSQUIRRELVM v);
#define sq_isweakref(o) ((o)._type==OT_WEAKREF)
#define sq_type(o) ((o)._type)
/* Limit the total number of ops that can be consumed by an operation */
struct SQOpsLimiter {
SQOpsLimiter(HSQUIRRELVM v, SQInteger ops, const char *label);
~SQOpsLimiter();
private:
HSQUIRRELVM _v;
SQInteger _ops;
};
/* deprecated */
#define sq_createslot(v,n) sq_newslot(v,n,SQFalse)

View File

@@ -1322,3 +1322,16 @@ void sq_free(void *p,SQUnsignedInteger size)
SQ_FREE(p,size);
}
SQOpsLimiter::SQOpsLimiter(HSQUIRRELVM v, SQInteger ops, const char *label) : _v(v)
{
this->_ops = v->_ops_till_suspend_error_threshold;
if (this->_ops == INT64_MIN) {
v->_ops_till_suspend_error_threshold = v->_ops_till_suspend - ops;
v->_ops_till_suspend_error_label = label;
}
}
SQOpsLimiter::~SQOpsLimiter()
{
this->_v->_ops_till_suspend_error_threshold = this->_ops;
}