Changeset - r21637:c861d9b309f9
[Not reviewed]
master
0 3 0
rubidium - 10 years ago 2014-09-06 17:20:45
rubidium@openttd.org
(svn r26769) -Codechange [Squirrel]: remove the difference between some platforms having wchar for SQChar and others just char; always use char (and UTF-8) like in the rest of (internal) OpenTTD
3 files changed with 7 insertions and 7 deletions:
0 comments (0 inline, 0 general)
src/3rdparty/squirrel/include/squirrel.h
Show inline comments
 
@@ -86,15 +86,15 @@ struct SQUserData;
 
struct SQFunctionProto;
 
struct SQRefCounted;
 
struct SQClass;
 
struct SQInstance;
 
struct SQDelegable;
 

	
 
#ifdef _UNICODE
 
#define SQUNICODE
 
#endif
 
//#ifdef _UNICODE
 
//#define SQUNICODE
 
//#endif
 

	
 
#ifdef SQUNICODE
 
#if (defined(_MSC_VER) && _MSC_VER >= 1400) // 1400 = VS8
 

	
 
#ifndef _WCHAR_T_DEFINED //this is if the compiler considers wchar_t as native type
 
typedef unsigned short wchar_t;
src/script/squirrel.cpp
Show inline comments
 
@@ -28,13 +28,13 @@
 
#undef strcat
 

	
 
void Squirrel::CompileError(HSQUIRRELVM vm, const SQChar *desc, const SQChar *source, SQInteger line, SQInteger column)
 
{
 
	SQChar buf[1024];
 

	
 
	scsnprintf(buf, lengthof(buf), _SC("Error %s:") SQ_PRINTF64 _SC("/") SQ_PRINTF64 _SC(": %s"), source, line, column, desc);
 
	seprintf(buf, lastof(buf), "Error %s:" SQ_PRINTF64 "/" SQ_PRINTF64 ": %s", source, line, column, desc);
 

	
 
	/* Check if we have a custom print function */
 
	Squirrel *engine = (Squirrel *)sq_getforeignptr(vm);
 
	engine->crashed = true;
 
	SQPrintFunc *func = engine->print_func;
 
	if (func == NULL) {
 
@@ -67,13 +67,13 @@ void Squirrel::RunError(HSQUIRRELVM vm, 
 
	/* Set the print function to something that prints to stderr */
 
	SQPRINTFUNCTION pf = sq_getprintfunc(vm);
 
	sq_setprintfunc(vm, &Squirrel::ErrorPrintFunc);
 

	
 
	/* Check if we have a custom print function */
 
	SQChar buf[1024];
 
	scsnprintf(buf, lengthof(buf), _SC("Your script made an error: %s\n"), error);
 
	seprintf(buf, lastof(buf), "Your script made an error: %s\n", error);
 
	Squirrel *engine = (Squirrel *)sq_getforeignptr(vm);
 
	SQPrintFunc *func = engine->print_func;
 
	if (func == NULL) {
 
		scfprintf(stderr, _SC("%s"), buf);
 
	} else {
 
		(*func)(true, buf);
src/stdafx.h
Show inline comments
 
@@ -298,14 +298,14 @@
 
			#define fopen(file, mode) _tfopen(OTTD2FS(file), _T(mode))
 
			#define unlink(file) _tunlink(OTTD2FS(file))
 
		#endif /* WINCE */
 

	
 
		const char *FS2OTTD(const TCHAR *name);
 
		const TCHAR *OTTD2FS(const char *name, bool console_cp = false);
 
		#define SQ2OTTD(name) FS2OTTD(name)
 
		#define OTTD2SQ(name) OTTD2FS(name)
 
		#define SQ2OTTD(name) (name)
 
		#define OTTD2SQ(name) (name)
 
	#else
 
		#define fopen(file, mode) fopen(OTTD2FS(file), mode)
 
		const char *FS2OTTD(const char *name);
 
		const char *OTTD2FS(const char *name);
 
		#define SQ2OTTD(name) (name)
 
		#define OTTD2SQ(name) (name)
0 comments (0 inline, 0 general)