(svn r16502) -Fix [FS#2935]: when an AI was suspended while in a function called (indirectly) via call/acall/pcall OpenTTD crashed. Fix this by disallowing AIs to be suspended while called via call/acall/pcall.
IMPORTANT FOR AI WRITERS: AIs can no longer call any DoCommand functions (change anything, build vehicles, etc.) in a function called (indirectly) via call/acall/pcall. Where possible, please rewrite your code so it doesn't use call/acall/pcall
This commit is contained in:
1
src/3rdparty/squirrel/include/squirrel.h
vendored
1
src/3rdparty/squirrel/include/squirrel.h
vendored
@@ -275,6 +275,7 @@ typedef struct tagSQRegFunction{
|
||||
}SQRegFunction;
|
||||
|
||||
/*vm*/
|
||||
SQUIRREL_API bool sq_can_suspend(HSQUIRRELVM v);
|
||||
SQUIRREL_API HSQUIRRELVM sq_open(SQInteger initialstacksize);
|
||||
SQUIRREL_API HSQUIRRELVM sq_newthread(HSQUIRRELVM friendvm, SQInteger initialstacksize);
|
||||
SQUIRREL_API void sq_seterrorhandler(HSQUIRRELVM v);
|
||||
|
5
src/3rdparty/squirrel/squirrel/sqapi.cpp
vendored
5
src/3rdparty/squirrel/squirrel/sqapi.cpp
vendored
@@ -90,6 +90,11 @@ SQInteger sq_getvmstate(HSQUIRRELVM v)
|
||||
}
|
||||
}
|
||||
|
||||
bool sq_can_suspend(HSQUIRRELVM v)
|
||||
{
|
||||
return v->_can_suspend;
|
||||
}
|
||||
|
||||
void sq_seterrorhandler(HSQUIRRELVM v)
|
||||
{
|
||||
SQObject o = stack_get(v, -1);
|
||||
|
Reference in New Issue
Block a user