src/squirrel.hpp
branchnoai
changeset 11098 37d15a8951b8
parent 10887 5c81038449f2
equal deleted inserted replaced
11097:6967c52c78c5 11098:37d15a8951b8
   153 	 * Set a custom print function, so you can handle outputs from SQ yourself.
   153 	 * Set a custom print function, so you can handle outputs from SQ yourself.
   154 	 */
   154 	 */
   155 	void SetPrintFunction(SQPrintFunc *func) { this->print_func = func; }
   155 	void SetPrintFunction(SQPrintFunc *func) { this->print_func = func; }
   156 
   156 
   157 	/**
   157 	/**
       
   158 	 * Set a custom suspend function.
       
   159 	 */
       
   160 	void SetSuspendControl(SQSuspendControlFunc func);
       
   161 
       
   162 	/**
   158 	 * Throw a Squirrel error that will be nicely displayed to the user.
   163 	 * Throw a Squirrel error that will be nicely displayed to the user.
   159 	 */
   164 	 */
   160 	void ThrowError(const char *error) { sq_throwerror(this->vm, OTTD2FS(error)); }
   165 	void ThrowError(const char *error) { sq_throwerror(this->vm, OTTD2FS(error)); }
   161 
   166 
   162 	/**
   167 	/**
   163 	 * Release a SQ object.
   168 	 * Release a SQ object.
   164 	 */
   169 	 */
   165 	void ReleaseObject(HSQOBJECT *ptr) { sq_release(this->vm, ptr); }
   170 	void ReleaseObject(HSQOBJECT *ptr) { sq_release(this->vm, ptr); }
       
   171 
       
   172 	/**
       
   173 	 * Reset the internal SQ counter which counts the opcodes executed and
       
   174 	 *  forces SQ to pause if the counter overflows.
       
   175 	 */
       
   176 	void ResetOpcodeCounter() { sq_resetopcodecounter(this->vm); }
       
   177 
       
   178 	/**
       
   179 	 * Set the maximum of opcodes before the suspend handler is called.
       
   180 	 */
       
   181 	void SetMaxOpcodes(int32 opcodes) { sq_setmaxopcodes(this->vm, opcodes); }
   166 };
   182 };
   167 
   183 
   168 #endif /* SQUIRREL_HPP */
   184 #endif /* SQUIRREL_HPP */