diff options
author | yexo <yexo@openttd.org> | 2010-02-20 13:28:56 +0000 |
---|---|---|
committer | yexo <yexo@openttd.org> | 2010-02-20 13:28:56 +0000 |
commit | 7c51a82020b414f23fee7638ec6096764e7ba7eb (patch) | |
tree | 6d1da9e6be92743ed7403362596360cc4bf37f2d | |
parent | 85856abb7cb5a7ca1e572ae6c5a96259a3db96e9 (diff) | |
download | openttd-7c51a82020b414f23fee7638ec6096764e7ba7eb.tar.xz |
(svn r19166) -Change: don't print the absolute path to AI script files in the AI debug window, use the relative path from /ai/ instead
-rw-r--r-- | src/3rdparty/squirrel/sqstdlib/sqstdaux.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/3rdparty/squirrel/sqstdlib/sqstdaux.cpp b/src/3rdparty/squirrel/sqstdlib/sqstdaux.cpp index e1f93cbf7..78b8a9c60 100644 --- a/src/3rdparty/squirrel/sqstdlib/sqstdaux.cpp +++ b/src/3rdparty/squirrel/sqstdlib/sqstdaux.cpp @@ -2,6 +2,7 @@ #include <squirrel.h> #include <sqstdaux.h> #include <assert.h> +#include <string.h> void sqstd_printcallstack(HSQUIRRELVM v) { @@ -21,7 +22,19 @@ void sqstd_printcallstack(HSQUIRRELVM v) const SQChar *fn=_SC("unknown"); const SQChar *src=_SC("unknown"); if(si.funcname)fn=si.funcname; - if(si.source)src=si.source; + if(si.source) { + /* We don't want to bother users with absolute paths to all AI files. + * Since the path only reaches NoAI code in a formatted string we have + * to strip it here. Let's hope nobody installs openttd in a subdirectory + * of a directory named /ai/. */ + src = scstrstr(si.source, _SC("\\ai\\")); + if (!src) src = scstrstr(si.source, _SC("/ai/")); + if (src) { + src += 4; + } else { + src = si.source; + } + } pf(v,_SC("*FUNCTION [%s()] %s line [%d]\n"),fn,src,si.line); level++; } |