Changeset - r10832:d7f9164253e6
[Not reviewed]
master
0 1 0
Yexo - 15 years ago 2009-01-20 14:11:58
yexo@openttd.org
(svn r15167) -Fix [FS#2558]: The top of the stack was resetted after executing the first Ai tick causing random AI crashes.
1 file changed with 3 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/script/squirrel.cpp
Show inline comments
 
@@ -192,8 +192,9 @@ bool Squirrel::CallMethod(HSQOBJECT inst
 
	sq_pushobject(this->vm, instance);
 
	sq_call(this->vm, 1, ret == NULL ? SQFalse : SQTrue, SQTrue, suspend);
 
	if (ret != NULL) sq_getstackobj(vm, -1, ret);
 
	/* Reset the top */
 
	sq_settop(this->vm, top);
 
	/* Reset the top, but don't do so for the AI main function, as we need
 
	 *  a correct stack when resuming. */
 
	if (this->vm->_suspended == 0) sq_settop(this->vm, top);
 

	
 
	return this->vm->_suspended != 0;
 
}
0 comments (0 inline, 0 general)