]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - tools/quake3/common/scriplib.c
drop old MAC_STATIC_HACK no one requested to be enabled in 12 years
[xonotic/netradiant.git] / tools / quake3 / common / scriplib.c
index a33657c7b3dccb2d6a343ea16517bb815330069c..3c91386cb56f749631380fc611faf0f8d56b8901 100644 (file)
@@ -1,5 +1,5 @@
 /*
-   Copyright (C) 1999-2006 Id Software, Inc. and contributors.
+   Copyright (C) 1999-2007 id Software, Inc. and contributors.
    For a list of contributors, see the accompanying CONTRIBUTORS file.
 
    This file is part of GtkRadiant.
@@ -58,6 +58,7 @@ qboolean tokenready;                     // only qtrue if UnGetToken was just ca
  */
 void AddScriptToStack( const char *filename, int index ){
        int size;
+       void* buffer;
 
        script++;
        if ( script == &scriptstack[MAX_INCLUDES] ) {
@@ -65,10 +66,11 @@ void AddScriptToStack( const char *filename, int index ){
        }
        strcpy( script->filename, ExpandPath( filename ) );
 
-       size = vfsLoadFile( script->filename, (void **)&script->buffer, index );
+       size = vfsLoadFile( script->filename, &buffer, index );
 
        if ( size == -1 ) {
                Sys_Printf( "Script file %s was not found\n", script->filename );
+               script--;
        }
        else
        {
@@ -78,11 +80,12 @@ void AddScriptToStack( const char *filename, int index ){
                else{
                        Sys_Printf( "entering %s\n", script->filename );
                }
-       }
 
-       script->line = 1;
-       script->script_p = script->buffer;
-       script->end_p = script->buffer + size;
+               script->buffer = buffer;
+               script->line = 1;
+               script->script_p = script->buffer;
+               script->end_p = script->buffer + size;
+       }
 }
 
 
@@ -153,7 +156,7 @@ qboolean EndOfScript( qboolean crossline ){
        }
 
        if ( script->buffer == NULL ) {
-               Sys_Printf( "WARNING: Attempt to free already freed script buffer\n" );
+               Sys_FPrintf( SYS_WRN, "WARNING: Attempt to free already freed script buffer\n" );
        }
        else{
                free( script->buffer );