From a4afa140f36673cd7dac1277aa4dd1d45618363b Mon Sep 17 00:00:00 2001 From: yexo Date: Wed, 19 Aug 2009 16:14:15 +0000 Subject: (svn r17223) -Change [NoAI] [FS#2980]: Crash an AI when it uses a DoCommand / Sleep instead of just printing an error message in the AI Debug Window --- src/3rdparty/squirrel/include/squirrel.h | 1 + src/3rdparty/squirrel/squirrel/sqapi.cpp | 8 ++++++++ 2 files changed, 9 insertions(+) (limited to 'src/3rdparty') diff --git a/src/3rdparty/squirrel/include/squirrel.h b/src/3rdparty/squirrel/include/squirrel.h index 806454721..63fb96e39 100644 --- a/src/3rdparty/squirrel/include/squirrel.h +++ b/src/3rdparty/squirrel/include/squirrel.h @@ -311,6 +311,7 @@ SQUIRREL_API void sq_setprintfunc(HSQUIRRELVM v, SQPRINTFUNCTION printfunc); SQUIRREL_API SQPRINTFUNCTION sq_getprintfunc(HSQUIRRELVM v); SQUIRREL_API SQRESULT sq_suspendvm(HSQUIRRELVM v); SQUIRREL_API bool sq_resumecatch(HSQUIRRELVM v, int suspend = -1); +SQUIRREL_API bool sq_resumeerror(HSQUIRRELVM v); SQUIRREL_API SQRESULT sq_wakeupvm(HSQUIRRELVM v,SQBool resumedret,SQBool retval,SQBool raiseerror,SQBool throwerror); SQUIRREL_API SQInteger sq_getvmstate(HSQUIRRELVM v); diff --git a/src/3rdparty/squirrel/squirrel/sqapi.cpp b/src/3rdparty/squirrel/squirrel/sqapi.cpp index 1e8b456f6..2d53d71bb 100644 --- a/src/3rdparty/squirrel/squirrel/sqapi.cpp +++ b/src/3rdparty/squirrel/squirrel/sqapi.cpp @@ -1012,6 +1012,14 @@ bool sq_resumecatch(HSQUIRRELVM v, int suspend) return v->Execute(_null_, v->_top, -1, -1, ret, SQTrue, SQVM::ET_RESUME_OPENTTD); } +bool sq_resumeerror(HSQUIRRELVM v) +{ + SQObjectPtr ret; + v->_can_suspend = true; + v->_ops_till_suspend = 1; + return v->Execute(_null_, v->_top, -1, -1, ret, SQTrue, SQVM::ET_RESUME_THROW_VM); +} + void sq_setreleasehook(HSQUIRRELVM v,SQInteger idx,SQRELEASEHOOK hook) { if(sq_gettop(v) >= 1){ -- cgit v1.2.3-70-g09d2