mirror of
https://github.com/DrBeef/ioq3quest.git
synced 2024-11-10 23:02:01 +00:00
don't use intermediate array for sorting pakfiles. avoids the
MAX_PAKFILES limitation
This commit is contained in:
parent
1bc190caf1
commit
c3a713832c
1 changed files with 3 additions and 14 deletions
|
@ -2483,7 +2483,6 @@ Sets fs_gamedir, adds the directory to the head of the path,
|
|||
then loads the zip headers
|
||||
================
|
||||
*/
|
||||
#define MAX_PAKFILES 1024
|
||||
static void FS_AddGameDirectory( const char *path, const char *dir ) {
|
||||
searchpath_t *sp;
|
||||
int i;
|
||||
|
@ -2492,7 +2491,6 @@ static void FS_AddGameDirectory( const char *path, const char *dir ) {
|
|||
char *pakfile;
|
||||
int numfiles;
|
||||
char **pakfiles;
|
||||
char *sorted[MAX_PAKFILES];
|
||||
|
||||
// this fixes the case where fs_basepath is the same as fs_cdpath
|
||||
// which happens on full installs
|
||||
|
@ -2521,20 +2519,11 @@ static void FS_AddGameDirectory( const char *path, const char *dir ) {
|
|||
|
||||
pakfiles = Sys_ListFiles( pakfile, ".pk3", NULL, &numfiles, qfalse );
|
||||
|
||||
// sort them so that later alphabetic matches override
|
||||
// earlier ones. This makes pak1.pk3 override pak0.pk3
|
||||
if ( numfiles > MAX_PAKFILES ) {
|
||||
numfiles = MAX_PAKFILES;
|
||||
}
|
||||
for ( i = 0 ; i < numfiles ; i++ ) {
|
||||
sorted[i] = pakfiles[i];
|
||||
}
|
||||
|
||||
qsort( sorted, numfiles, sizeof(char*), paksort );
|
||||
qsort( pakfiles, numfiles, sizeof(char*), paksort );
|
||||
|
||||
for ( i = 0 ; i < numfiles ; i++ ) {
|
||||
pakfile = FS_BuildOSPath( path, dir, sorted[i] );
|
||||
if ( ( pak = FS_LoadZipFile( pakfile, sorted[i] ) ) == 0 )
|
||||
pakfile = FS_BuildOSPath( path, dir, pakfiles[i] );
|
||||
if ( ( pak = FS_LoadZipFile( pakfile, pakfiles[i] ) ) == 0 )
|
||||
continue;
|
||||
// store the game name for downloading
|
||||
strcpy(pak->pakGamename, dir);
|
||||
|
|
Loading…
Reference in a new issue