From ca2cf9c99df7ee76f13b7c9fa2d6ad706a3968fa Mon Sep 17 00:00:00 2001 From: ludwig Date: Sat, 30 Dec 2006 12:19:53 +0000 Subject: don't use intermediate array for sorting pakfiles. avoids the MAX_PAKFILES limitation git-svn-id: svn://svn.icculus.org/quake3/trunk@1022 edf5b092-35ff-0310-97b2-ce42778d08ea --- code/qcommon/files.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) (limited to 'code') diff --git a/code/qcommon/files.c b/code/qcommon/files.c index 52fa912..df90588 100644 --- a/code/qcommon/files.c +++ b/code/qcommon/files.c @@ -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); -- cgit v1.2.3