r1022 - trunk/code/qcommon

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sat Dec 30 07:19:53 EST 2006


Author: ludwig
Date: 2006-12-30 07:19:53 -0500 (Sat, 30 Dec 2006)
New Revision: 1022

Modified:
   trunk/code/qcommon/files.c
Log:
don't use intermediate array for sorting pakfiles. avoids the
MAX_PAKFILES limitation


Modified: trunk/code/qcommon/files.c
===================================================================
--- trunk/code/qcommon/files.c	2006-12-30 12:13:25 UTC (rev 1021)
+++ trunk/code/qcommon/files.c	2006-12-30 12:19:53 UTC (rev 1022)
@@ -2483,7 +2483,6 @@
 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 @@
 	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 @@
 
 	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( pakfiles, numfiles, sizeof(char*), paksort );
 
-	qsort( sorted, 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);




More information about the quake3-commits mailing list