Changeset - r11827:2c1d588e1444
[Not reviewed]
master
0 1 0
rubidium - 15 years ago 2009-05-03 21:56:46
rubidium@openttd.org
(svn r16222) -Fix: unneeded pointer dereferencing
1 file changed with 1 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/script/squirrel_std.cpp
Show inline comments
 
@@ -51,25 +51,25 @@ SQInteger SquirrelStd::require(HSQUIRREL
 
	/* Get the script-name of the current file, so we can work relative from it */
 
	SQStackInfos si;
 
	sq_stackinfos(vm, 1, &si);
 
	if (si.source == NULL) {
 
		DEBUG(misc, 0, "[squirrel] Couldn't detect the script-name of the 'require'-caller; this should never happen!");
 
		return SQ_ERROR;
 
	}
 
	real_filename = scstrdup(si.source);
 
	/* Keep the dir, remove the rest */
 
	SQChar *s = scstrrchr(real_filename, PATHSEPCHAR);
 
	if (s != NULL) {
 
		/* Keep the PATHSEPCHAR there, remove the rest */
 
		*s++;
 
		s++;
 
		*s = '\0';
 
	}
 
	/* And now we concat, so we are relative from the current script
 
	 * First, we have to make sure we have enough space for the full path */
 
	real_filename = ReallocT(real_filename, scstrlen(real_filename) + scstrlen(filename) + 1);
 
	scstrcat(real_filename, filename);
 
	/* Tars dislike opening files with '/' on Windows.. so convert it to '\\' ;) */
 
	char *filen = strdup(FS2OTTD(real_filename));
 
#if (PATHSEPCHAR != '/')
 
	for (char *n = filen; *n != '\0'; n++) if (*n == '/') *n = PATHSEPCHAR;
 
#endif
 

	
0 comments (0 inline, 0 general)