@ -118,7 +118,7 @@ void Squirrel::PrintFunc(HSQUIRRELVM vm, const SQChar *s, ...)
void Squirrel : : AddMethod ( const char * method_name , SQFUNCTION proc , uint nparam , const char * params , void * userdata , int size )
{
sq_pushstring ( this - > vm , OTTD2 F S( method_name ) , - 1 ) ;
sq_pushstring ( this - > vm , OTTD2 SQ ( method_name ) , - 1 ) ;
if ( size ! = 0 ) {
void * ptr = sq_newuserdata ( vm , size ) ;
@ -126,21 +126,21 @@ void Squirrel::AddMethod(const char *method_name, SQFUNCTION proc, uint nparam,
}
sq_newclosure ( this - > vm , proc , size ! = 0 ? 1 : 0 ) ;
if ( nparam ! = 0 ) sq_setparamscheck ( this - > vm , nparam , OTTD2 F S( params ) ) ;
sq_setnativeclosurename ( this - > vm , - 1 , OTTD2 F S( method_name ) ) ;
if ( nparam ! = 0 ) sq_setparamscheck ( this - > vm , nparam , OTTD2 SQ ( params ) ) ;
sq_setnativeclosurename ( this - > vm , - 1 , OTTD2 SQ ( method_name ) ) ;
sq_newslot ( this - > vm , - 3 , SQFalse ) ;
}
void Squirrel : : AddConst ( const char * var_name , int value )
{
sq_pushstring ( this - > vm , OTTD2 F S( var_name ) , - 1 ) ;
sq_pushstring ( this - > vm , OTTD2 SQ ( var_name ) , - 1 ) ;
sq_pushinteger ( this - > vm , value ) ;
sq_newslot ( this - > vm , - 3 , SQTrue ) ;
}
void Squirrel : : AddConst ( const char * var_name , bool value )
{
sq_pushstring ( this - > vm , OTTD2 F S( var_name ) , - 1 ) ;
sq_pushstring ( this - > vm , OTTD2 SQ ( var_name ) , - 1 ) ;
sq_pushbool ( this - > vm , value ) ;
sq_newslot ( this - > vm , - 3 , SQTrue ) ;
}
@ -148,15 +148,15 @@ void Squirrel::AddConst(const char *var_name, bool value)
void Squirrel : : AddClassBegin ( const char * class_name )
{
sq_pushroottable ( this - > vm ) ;
sq_pushstring ( this - > vm , OTTD2 F S( class_name ) , - 1 ) ;
sq_pushstring ( this - > vm , OTTD2 SQ ( class_name ) , - 1 ) ;
sq_newclass ( this - > vm , SQFalse ) ;
}
void Squirrel : : AddClassBegin ( const char * class_name , const char * parent_class )
{
sq_pushroottable ( this - > vm ) ;
sq_pushstring ( this - > vm , OTTD2 F S( class_name ) , - 1 ) ;
sq_pushstring ( this - > vm , OTTD2 F S( parent_class ) , - 1 ) ;
sq_pushstring ( this - > vm , OTTD2 SQ ( class_name ) , - 1 ) ;
sq_pushstring ( this - > vm , OTTD2 SQ ( parent_class ) , - 1 ) ;
if ( SQ_FAILED ( sq_get ( this - > vm , - 3 ) ) ) {
DEBUG ( misc , 0 , " [squirrel] Failed to initialize class '%s' based on parent class '%s' " , class_name , parent_class ) ;
DEBUG ( misc , 0 , " [squirrel] Make sure that '%s' exists before trying to define '%s' " , parent_class , class_name ) ;
@ -178,7 +178,7 @@ bool Squirrel::MethodExists(HSQOBJECT instance, const char *method_name)
/* Go to the instance-root */
sq_pushobject ( this - > vm , instance ) ;
/* Find the function-name inside the script */
sq_pushstring ( this - > vm , OTTD2 F S( method_name ) , - 1 ) ;
sq_pushstring ( this - > vm , OTTD2 SQ ( method_name ) , - 1 ) ;
if ( SQ_FAILED ( sq_get ( this - > vm , - 2 ) ) ) {
sq_settop ( this - > vm , top ) ;
return false ;
@ -217,7 +217,7 @@ bool Squirrel::CallMethod(HSQOBJECT instance, const char *method_name, HSQOBJECT
/* Go to the instance-root */
sq_pushobject ( this - > vm , instance ) ;
/* Find the function-name inside the script */
sq_pushstring ( this - > vm , OTTD2 F S( method_name ) , - 1 ) ;
sq_pushstring ( this - > vm , OTTD2 SQ ( method_name ) , - 1 ) ;
if ( SQ_FAILED ( sq_get ( this - > vm , - 2 ) ) ) {
DEBUG ( misc , 0 , " [squirrel] Could not find '%s' in the class " , method_name ) ;
sq_settop ( this - > vm , top ) ;
@ -269,7 +269,7 @@ bool Squirrel::CallBoolMethod(HSQOBJECT instance, const char *method_name, bool
/* First, find the class */
sq_pushroottable ( vm ) ;
sq_pushstring ( vm , OTTD2 F S( class_name ) , - 1 ) ;
sq_pushstring ( vm , OTTD2 SQ ( class_name ) , - 1 ) ;
if ( SQ_FAILED ( sq_get ( vm , - 2 ) ) ) {
DEBUG ( misc , 0 , " [squirrel] Failed to find class by the name '%s' " , class_name ) ;
sq_settop ( vm , oldtop ) ;
@ -455,7 +455,7 @@ static SQInteger _io_file_read(SQUserPointer file, SQUserPointer buf, SQInteger
default : func = _io_file_lexfeed_ASCII ; fseek ( file , - 2 , SEEK_CUR ) ; break ; // ASCII
}
if ( SQ_SUCCEEDED ( sq_compile ( vm , func , & f , OTTD2 F S( filename ) , printerror ) ) ) {
if ( SQ_SUCCEEDED ( sq_compile ( vm , func , & f , OTTD2 SQ ( filename ) , printerror ) ) ) {
FioFCloseFile ( file ) ;
return SQ_OK ;
}