Q3map2:
* report full / full pk3 path on file syntax errors
This commit is contained in:
parent
0d5ebb17b2
commit
bf6dd1f2d1
|
|
@ -172,7 +172,7 @@ void UnGetToken( void ){
|
|||
|
||||
qboolean EndOfScript( qboolean crossline ){
|
||||
if ( !crossline ) {
|
||||
Error( "Line %i is incomplete\n",scriptline );
|
||||
Error( "Line %i is incomplete\nFile location be: %s\n", scriptline, g_strLoadedFileLocation );
|
||||
}
|
||||
|
||||
if ( !strcmp( script->filename, "memory buffer" ) ) {
|
||||
|
|
@ -231,7 +231,7 @@ skipspace:
|
|||
}
|
||||
if ( *script->script_p++ == '\n' ) {
|
||||
if ( !crossline ) {
|
||||
Error( "Line %i is incomplete\n",scriptline );
|
||||
Error( "Line %i is incomplete\nFile location be: %s\n", scriptline, g_strLoadedFileLocation );
|
||||
}
|
||||
script->line++;
|
||||
scriptline = script->line;
|
||||
|
|
@ -246,7 +246,7 @@ skipspace:
|
|||
if ( *script->script_p == ';' || *script->script_p == '#'
|
||||
|| ( script->script_p[0] == '/' && script->script_p[1] == '/' ) ) {
|
||||
if ( !crossline ) {
|
||||
Error( "Line %i is incomplete\n",scriptline );
|
||||
Error( "Line %i is incomplete\nFile location be: %s\n", scriptline, g_strLoadedFileLocation );
|
||||
}
|
||||
while ( *script->script_p++ != '\n' )
|
||||
if ( script->script_p >= script->end_p ) {
|
||||
|
|
@ -260,7 +260,7 @@ skipspace:
|
|||
// /* */ comments
|
||||
if ( script->script_p[0] == '/' && script->script_p[1] == '*' ) {
|
||||
if ( !crossline ) {
|
||||
Error( "Line %i is incomplete\n",scriptline );
|
||||
Error( "Line %i is incomplete\nFile location be: %s\n", scriptline, g_strLoadedFileLocation );
|
||||
}
|
||||
script->script_p += 2;
|
||||
while ( script->script_p[0] != '*' && script->script_p[1] != '/' )
|
||||
|
|
@ -293,7 +293,7 @@ skipspace:
|
|||
break;
|
||||
}
|
||||
if ( token_p == &token[MAXTOKEN] ) {
|
||||
Error( "Token too large on line %i\n",scriptline );
|
||||
Error( "Token too large on line %i\nFile location be: %s\n", scriptline, g_strLoadedFileLocation );
|
||||
}
|
||||
}
|
||||
script->script_p++;
|
||||
|
|
@ -306,7 +306,7 @@ skipspace:
|
|||
break;
|
||||
}
|
||||
if ( token_p == &token[MAXTOKEN] ) {
|
||||
Error( "Token too large on line %i\n",scriptline );
|
||||
Error( "Token too large on line %i\nFile location be: %s\n", scriptline, g_strLoadedFileLocation );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@
|
|||
|
||||
typedef struct
|
||||
{
|
||||
char* unzFilePath;
|
||||
char* name;
|
||||
unz_s zipinfo;
|
||||
unzFile zipfile;
|
||||
|
|
@ -71,6 +72,7 @@ static int g_numDirs;
|
|||
char g_strForbiddenDirs[VFS_MAXDIRS][PATH_MAX + 1];
|
||||
int g_numForbiddenDirs = 0;
|
||||
static gboolean g_bUsePak = TRUE;
|
||||
char g_strLoadedFileLocation[1024];
|
||||
|
||||
// =============================================================================
|
||||
// Static functions
|
||||
|
|
@ -120,6 +122,8 @@ static void vfsInitPakFile( const char *filename ){
|
|||
}
|
||||
unzGoToFirstFile( uf );
|
||||
|
||||
char* unzFilePath = strdup( filename );
|
||||
|
||||
for ( i = 0; i < gi.number_entry; i++ )
|
||||
{
|
||||
char filename_inzip[NAME_MAX];
|
||||
|
|
@ -140,6 +144,7 @@ static void vfsInitPakFile( const char *filename ){
|
|||
file->name = strdup( filename_inzip );
|
||||
file->size = file_info.uncompressed_size;
|
||||
file->zipfile = uf;
|
||||
file->unzFilePath = unzFilePath;
|
||||
memcpy( &file->zipinfo, uf, sizeof( unz_s ) );
|
||||
|
||||
if ( ( i + 1 ) < gi.number_entry ) {
|
||||
|
|
@ -322,6 +327,7 @@ void vfsShutdown(){
|
|||
while ( g_pakFiles )
|
||||
{
|
||||
VFS_PAKFILE* file = (VFS_PAKFILE*)g_pakFiles->data;
|
||||
free( file->unzFilePath );
|
||||
free( file->name );
|
||||
free( file );
|
||||
g_pakFiles = g_slist_remove( g_pakFiles, file );
|
||||
|
|
@ -367,6 +373,7 @@ int vfsLoadFile( const char *filename, void **bufferptr, int index ){
|
|||
|
||||
// filename is a full path
|
||||
if ( index == -1 ) {
|
||||
strcpy( g_strLoadedFileLocation, filename );
|
||||
long len;
|
||||
FILE *f;
|
||||
|
||||
|
|
@ -408,6 +415,8 @@ int vfsLoadFile( const char *filename, void **bufferptr, int index ){
|
|||
strcat( tmp, filename );
|
||||
if ( access( tmp, R_OK ) == 0 ) {
|
||||
if ( count == index ) {
|
||||
strcpy( g_strLoadedFileLocation, tmp );
|
||||
|
||||
long len;
|
||||
FILE *f;
|
||||
|
||||
|
|
@ -451,6 +460,10 @@ int vfsLoadFile( const char *filename, void **bufferptr, int index ){
|
|||
}
|
||||
|
||||
if ( count == index ) {
|
||||
strcpy( g_strLoadedFileLocation, file->unzFilePath );
|
||||
strcat( g_strLoadedFileLocation, " :: " );
|
||||
strcat( g_strLoadedFileLocation, filename );
|
||||
|
||||
memcpy( file->zipfile, &file->zipinfo, sizeof( unz_s ) );
|
||||
|
||||
if ( unzOpenCurrentFile( file->zipfile ) != UNZ_OK ) {
|
||||
|
|
|
|||
|
|
@ -61,5 +61,6 @@ qboolean vfsPackFile_Absolute_Path( const char *filepath, const char *filename,
|
|||
|
||||
extern char g_strForbiddenDirs[VFS_MAXDIRS][PATH_MAX + 1];
|
||||
extern int g_numForbiddenDirs;
|
||||
extern char g_strLoadedFileLocation[1024];
|
||||
|
||||
#endif // _VFS_H_
|
||||
|
|
|
|||
|
|
@ -395,8 +395,7 @@ void PartialLoadBSPFile( const char *filename ){
|
|||
PartialLoadIBSPFile( filename );
|
||||
|
||||
/* PartialSwapBSPFile() */
|
||||
int i, j;
|
||||
shaderInfo_t *si;
|
||||
int i;
|
||||
|
||||
/* shaders (don't swap the name) */
|
||||
for ( i = 0; i < numBSPShaders ; i++ )
|
||||
|
|
|
|||
|
|
@ -2059,8 +2059,8 @@ skipEXfile:
|
|||
break;
|
||||
}
|
||||
if ( strcmp( token, "{" ) ) {
|
||||
Error( "ParseShaderFile: %s, line %d: { not found!\nFound instead: %s",
|
||||
temp, scriptline, token );
|
||||
Error( "ParseShaderFile: %s, line %d: { not found!\nFound instead: %s\nFile location be: %s",
|
||||
temp, scriptline, token, g_strLoadedFileLocation );
|
||||
}
|
||||
|
||||
while ( 1 )
|
||||
|
|
@ -2113,8 +2113,8 @@ skipEXfile:
|
|||
break;
|
||||
}
|
||||
if ( strcmp( token, "{" ) ) {
|
||||
Error( "ParseShaderFile: %s, line %d: { not found!\nFound instead: %s",
|
||||
temp, scriptline, token );
|
||||
Error( "ParseShaderFile: %s, line %d: { not found!\nFound instead: %s\nFile location be: %s",
|
||||
temp, scriptline, token, g_strLoadedFileLocation );
|
||||
}
|
||||
|
||||
qboolean hasmap = qfalse;
|
||||
|
|
@ -3061,8 +3061,8 @@ skipEXrefile:
|
|||
break;
|
||||
}
|
||||
if ( strcmp( token, "{" ) ) {
|
||||
Error( "ParseShaderFile: %s, line %d: { not found!\nFound instead: %s",
|
||||
temp, scriptline, token );
|
||||
Error( "ParseShaderFile: %s, line %d: { not found!\nFound instead: %s\nFile location be: %s",
|
||||
temp, scriptline, token, g_strLoadedFileLocation );
|
||||
}
|
||||
strcat( shaderText, "\n{" );
|
||||
qboolean hasmap = qfalse;
|
||||
|
|
|
|||
|
|
@ -947,17 +947,17 @@ void Parse1DMatrixAppend( char *buffer, int x, vec_t *m ){
|
|||
|
||||
|
||||
if ( !GetTokenAppend( buffer, qtrue ) || strcmp( token, "(" ) ) {
|
||||
Error( "Parse1DMatrixAppend(): line %d: ( not found!", scriptline );
|
||||
Error( "Parse1DMatrixAppend(): line %d: ( not found!\nFile location be: %s\n", scriptline, g_strLoadedFileLocation );
|
||||
}
|
||||
for ( i = 0; i < x; i++ )
|
||||
{
|
||||
if ( !GetTokenAppend( buffer, qfalse ) ) {
|
||||
Error( "Parse1DMatrixAppend(): line %d: Number not found!", scriptline );
|
||||
Error( "Parse1DMatrixAppend(): line %d: Number not found!\nFile location be: %s\n", scriptline, g_strLoadedFileLocation );
|
||||
}
|
||||
m[ i ] = atof( token );
|
||||
}
|
||||
if ( !GetTokenAppend( buffer, qtrue ) || strcmp( token, ")" ) ) {
|
||||
Error( "Parse1DMatrixAppend(): line %d: ) not found!", scriptline );
|
||||
Error( "Parse1DMatrixAppend(): line %d: ) not found!\nFile location be: %s\n", scriptline, g_strLoadedFileLocation );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1019,12 +1019,12 @@ static void ParseShaderFile( const char *filename ){
|
|||
}
|
||||
if ( strcmp( token, "{" ) ) {
|
||||
if ( si != NULL ) {
|
||||
Error( "ParseShaderFile(): %s, line %d: { not found!\nFound instead: %s\nLast known shader: %s",
|
||||
filename, scriptline, token, si->shader );
|
||||
Error( "ParseShaderFile(): %s, line %d: { not found!\nFound instead: %s\nLast known shader: %s\nFile location be: %s\n",
|
||||
filename, scriptline, token, si->shader, g_strLoadedFileLocation );
|
||||
}
|
||||
else{
|
||||
Error( "ParseShaderFile(): %s, line %d: { not found!\nFound instead: %s",
|
||||
filename, scriptline, token );
|
||||
Error( "ParseShaderFile(): %s, line %d: { not found!\nFound instead: %s\nFile location be: %s\n",
|
||||
filename, scriptline, token, g_strLoadedFileLocation );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user