use pushStringCallback in vfsListShaderFiles()
This commit is contained in:
parent
02fce47d00
commit
3b4f22ee32
|
|
@ -238,7 +238,7 @@ void vfsInitDirectory( const char *path ){
|
|||
|
||||
|
||||
// lists all .shader files
|
||||
void vfsListShaderFiles( char* list, const size_t stride, int *num ){
|
||||
void vfsListShaderFiles( StrList* list, void pushStringCallback( StrList* list, const char* string ) ){
|
||||
//char filename[PATH_MAX];
|
||||
char *dirlist;
|
||||
GDir *dir;
|
||||
|
|
@ -264,13 +264,7 @@ void vfsListShaderFiles( char* list, const size_t stride, int *num ){
|
|||
continue;
|
||||
}
|
||||
|
||||
for ( k = 0; k < *num; k++ ){
|
||||
if ( !Q_stricmp( list + stride * k, dirlist ) )
|
||||
goto shISdouplicate;
|
||||
}
|
||||
strcpy( list + stride * ( *num ), dirlist );
|
||||
( *num )++;
|
||||
shISdouplicate:
|
||||
pushStringCallback( list, dirlist );
|
||||
g_free( dirlist );
|
||||
}
|
||||
g_dir_close( dir );
|
||||
|
|
@ -291,14 +285,7 @@ shISdouplicate:
|
|||
//name + ext this time
|
||||
ext = strrchr( file->name, '/' );
|
||||
ext++;
|
||||
|
||||
for ( k = 0; k < *num; k++ ){
|
||||
if ( !Q_stricmp( list + stride * k, ext ) )
|
||||
goto shISdouplicate2;
|
||||
}
|
||||
strcpy( list + stride * ( *num ) , ext );
|
||||
( *num )++;
|
||||
shISdouplicate2:
|
||||
pushStringCallback( list, ext );
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,7 +55,8 @@ void vfsInitDirectory( const char *path );
|
|||
void vfsShutdown();
|
||||
int vfsGetFileCount( const char *filename );
|
||||
int vfsLoadFile( const char *filename, void **buffer, int index );
|
||||
void vfsListShaderFiles( char* list, const size_t stride, int *num );
|
||||
typedef struct StrList_s StrList;
|
||||
void vfsListShaderFiles( StrList* list, void pushStringCallback( StrList* list, const char* string ) );
|
||||
qboolean vfsPackFile( const char *filename, const char *packname, const int compLevel );
|
||||
qboolean vfsPackFile_Absolute_Path( const char *filepath, const char *filename, const char *packname, const int compLevel );
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
#include "autopk3.h"
|
||||
|
||||
|
||||
typedef struct
|
||||
typedef struct StrList_s
|
||||
{
|
||||
int n;
|
||||
int max;
|
||||
|
|
@ -69,6 +69,11 @@ static inline int StrList_find( const StrList* list, const char* string ){
|
|||
return 0;
|
||||
}
|
||||
|
||||
void pushStringCallback( StrList* list, const char* string ){
|
||||
if( !StrList_find( list, string ) )
|
||||
StrList_append( list, string );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Check if newcoming texture is unique and not excluded
|
||||
|
|
@ -324,7 +329,7 @@ int pk3BSPMain( int argc, char **argv ){
|
|||
}
|
||||
}
|
||||
|
||||
vfsListShaderFiles( &pk3Shaderfiles->s[0][0], sizeof( pk3Shaderfiles->s[0] ), &pk3Shaderfiles->n );
|
||||
vfsListShaderFiles( pk3Shaderfiles, pushStringCallback );
|
||||
|
||||
if( dbg ){
|
||||
Sys_Printf( "\n\tSchroider fileses.....%i\n", pk3Shaderfiles->n );
|
||||
|
|
@ -1125,7 +1130,7 @@ int repackBSPMain( int argc, char **argv ){
|
|||
|
||||
|
||||
|
||||
vfsListShaderFiles( &pk3Shaderfiles->s[0][0], sizeof( pk3Shaderfiles->s[0] ), &pk3Shaderfiles->n );
|
||||
vfsListShaderFiles( pk3Shaderfiles, pushStringCallback );
|
||||
|
||||
if( dbg ){
|
||||
Sys_Printf( "\n\tSchroider fileses.....%i\n", pk3Shaderfiles->n );
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user