Fix screwed up whitespace in files.c

Apologies to anyone merging this :(
This commit is contained in:
Tim Angus 2013-01-13 22:17:10 +00:00
parent 5fd456ff7c
commit 70b165ee33

View file

@ -450,9 +450,9 @@ long FS_filelength(fileHandle_t f)
h = FS_FileForHandle(f); h = FS_FileForHandle(f);
if(h == NULL) if(h == NULL)
return -1; return -1;
else else
return FS_fplength(h); return FS_fplength(h);
} }
/* /*
@ -986,7 +986,7 @@ Ignore case and seprator char distinctions
*/ */
qboolean FS_FilenameCompare( const char *s1, const char *s2 ) { qboolean FS_FilenameCompare( const char *s1, const char *s2 ) {
int c1, c2; int c1, c2;
do { do {
c1 = *s1++; c1 = *s1++;
c2 = *s2++; c2 = *s2++;
@ -1004,12 +1004,12 @@ qboolean FS_FilenameCompare( const char *s1, const char *s2 ) {
if ( c2 == '\\' || c2 == ':' ) { if ( c2 == '\\' || c2 == ':' ) {
c2 = '/'; c2 = '/';
} }
if (c1 != c2) { if (c1 != c2) {
return qtrue; // strings not equal return qtrue; // strings not equal
} }
} while (c1); } while (c1);
return qfalse; // strings are equal return qfalse; // strings are equal
} }
@ -1057,8 +1057,8 @@ qboolean FS_IsDemoExt(const char *filename, int namelen)
return qtrue; return qtrue;
#ifdef LEGACY_PROTOCOL #ifdef LEGACY_PROTOCOL
if(protocol == com_legacyprotocol->integer) if(protocol == com_legacyprotocol->integer)
return qtrue; return qtrue;
#endif #endif
for(index = 0; demo_protocols[index]; index++) for(index = 0; demo_protocols[index]; index++)
@ -1103,19 +1103,19 @@ long FS_FOpenFileReadDir(const char *filename, searchpath_t *search, fileHandle_
// be prepended, so we don't need to worry about "c:" or "//limbo" // be prepended, so we don't need to worry about "c:" or "//limbo"
if(strstr(filename, ".." ) || strstr(filename, "::")) if(strstr(filename, ".." ) || strstr(filename, "::"))
{ {
if(file == NULL) if(file == NULL)
return qfalse; return qfalse;
*file = 0; *file = 0;
return -1; return -1;
} }
// make sure the q3key file is only readable by the quake3.exe at initialization // make sure the q3key file is only readable by the quake3.exe at initialization
// any other time the key should only be accessed in memory using the provided functions // any other time the key should only be accessed in memory using the provided functions
if(com_fullyInitialized && strstr(filename, "q3key")) if(com_fullyInitialized && strstr(filename, "q3key"))
{ {
if(file == NULL) if(file == NULL)
return qfalse; return qfalse;
*file = 0; *file = 0;
return -1; return -1;
@ -1129,9 +1129,9 @@ long FS_FOpenFileReadDir(const char *filename, searchpath_t *search, fileHandle_
if(search->pack) if(search->pack)
{ {
hash = FS_HashFileName(filename, search->pack->hashSize); hash = FS_HashFileName(filename, search->pack->hashSize);
if(search->pack->hashTable[hash]) if(search->pack->hashTable[hash])
{ {
// look through all the pak file elements // look through all the pak file elements
pak = search->pack; pak = search->pack;
pakFile = pak->hashTable[hash]; pakFile = pak->hashTable[hash];
@ -1143,14 +1143,14 @@ long FS_FOpenFileReadDir(const char *filename, searchpath_t *search, fileHandle_
{ {
// found it! // found it!
if(pakFile->len) if(pakFile->len)
return pakFile->len; return pakFile->len;
else else
{ {
// It's not nice, but legacy code depends // It's not nice, but legacy code depends
// on positive value if file exists no matter // on positive value if file exists no matter
// what size // what size
return 1; return 1;
} }
} }
pakFile = pakFile->next; pakFile = pakFile->next;
@ -1160,28 +1160,28 @@ long FS_FOpenFileReadDir(const char *filename, searchpath_t *search, fileHandle_
else if(search->dir) else if(search->dir)
{ {
dir = search->dir; dir = search->dir;
netpath = FS_BuildOSPath(dir->path, dir->gamedir, filename); netpath = FS_BuildOSPath(dir->path, dir->gamedir, filename);
filep = fopen (netpath, "rb"); filep = fopen (netpath, "rb");
if(filep) if(filep)
{ {
len = FS_fplength(filep); len = FS_fplength(filep);
fclose(filep); fclose(filep);
if(len) if(len)
return len; return len;
else else
return 1; return 1;
} }
} }
return 0; return 0;
} }
*file = FS_HandleForFile(); *file = FS_HandleForFile();
fsh[*file].handleFiles.unique = uniqueFILE; fsh[*file].handleFiles.unique = uniqueFILE;
// is the element a pak file? // is the element a pak file?
if(search->pack) if(search->pack)
{ {
@ -1199,7 +1199,7 @@ long FS_FOpenFileReadDir(const char *filename, searchpath_t *search, fileHandle_
// look through all the pak file elements // look through all the pak file elements
pak = search->pack; pak = search->pack;
pakFile = pak->hashTable[hash]; pakFile = pak->hashTable[hash];
do do
{ {
// case and separator insensitive comparisons // case and separator insensitive comparisons
@ -1238,7 +1238,7 @@ long FS_FOpenFileReadDir(const char *filename, searchpath_t *search, fileHandle_
{ {
// open a new file on the pakfile // open a new file on the pakfile
fsh[*file].handleFiles.file.z = unzOpen(pak->pakFilename); fsh[*file].handleFiles.file.z = unzOpen(pak->pakFilename);
if(fsh[*file].handleFiles.file.z == NULL) if(fsh[*file].handleFiles.file.z == NULL)
Com_Error(ERR_FATAL, "Couldn't open %s", pak->pakFilename); Com_Error(ERR_FATAL, "Couldn't open %s", pak->pakFilename);
} }
@ -1247,7 +1247,7 @@ long FS_FOpenFileReadDir(const char *filename, searchpath_t *search, fileHandle_
Q_strncpyz(fsh[*file].name, filename, sizeof(fsh[*file].name)); Q_strncpyz(fsh[*file].name, filename, sizeof(fsh[*file].name));
fsh[*file].zipFile = qtrue; fsh[*file].zipFile = qtrue;
// set the file position in the zip file (also sets the current file info) // set the file position in the zip file (also sets the current file info)
unzSetOffset(fsh[*file].handleFiles.file.z, pakFile->pos); unzSetOffset(fsh[*file].handleFiles.file.z, pakFile->pos);
@ -1258,12 +1258,12 @@ long FS_FOpenFileReadDir(const char *filename, searchpath_t *search, fileHandle_
if(fs_debug->integer) if(fs_debug->integer)
{ {
Com_Printf("FS_FOpenFileRead: %s (found in '%s')\n", Com_Printf("FS_FOpenFileRead: %s (found in '%s')\n",
filename, pak->pakFilename); filename, pak->pakFilename);
} }
return pakFile->len; return pakFile->len;
} }
pakFile = pakFile->next; pakFile = pakFile->next;
} while(pakFile != NULL); } while(pakFile != NULL);
} }
@ -1301,16 +1301,16 @@ long FS_FOpenFileReadDir(const char *filename, searchpath_t *search, fileHandle_
if (filep == NULL) if (filep == NULL)
{ {
*file = 0; *file = 0;
return -1; return -1;
} }
Q_strncpyz(fsh[*file].name, filename, sizeof(fsh[*file].name)); Q_strncpyz(fsh[*file].name, filename, sizeof(fsh[*file].name));
fsh[*file].zipFile = qfalse; fsh[*file].zipFile = qfalse;
if(fs_debug->integer) if(fs_debug->integer)
{ {
Com_Printf("FS_FOpenFileRead: %s (found in '%s/%s')\n", filename, Com_Printf("FS_FOpenFileRead: %s (found in '%s/%s')\n", filename,
dir->path, dir->gamedir); dir->path, dir->gamedir);
} }
fsh[*file].handleFiles.file.o = filep; fsh[*file].handleFiles.file.o = filep;
@ -1340,19 +1340,19 @@ long FS_FOpenFileRead(const char *filename, fileHandle_t *file, qboolean uniqueF
for(search = fs_searchpaths; search; search = search->next) for(search = fs_searchpaths; search; search = search->next)
{ {
len = FS_FOpenFileReadDir(filename, search, file, uniqueFILE, qfalse); len = FS_FOpenFileReadDir(filename, search, file, uniqueFILE, qfalse);
if(file == NULL) if(file == NULL)
{ {
if(len > 0) if(len > 0)
return len; return len;
} }
else else
{ {
if(len >= 0 && *file) if(len >= 0 && *file)
return len; return len;
} }
} }
#ifdef FS_MISSING #ifdef FS_MISSING
@ -1403,7 +1403,7 @@ vmInterpret_t FS_FindVM(void **startSearch, char *found, int foundlen, const cha
if(enableDll) if(enableDll)
Com_sprintf(dllName, sizeof(dllName), "%s" ARCH_STRING DLL_EXT, name); Com_sprintf(dllName, sizeof(dllName), "%s" ARCH_STRING DLL_EXT, name);
Com_sprintf(qvmName, sizeof(qvmName), "vm/%s.qvm", name); Com_sprintf(qvmName, sizeof(qvmName), "vm/%s.qvm", name);
lastSearch = *startSearch; lastSearch = *startSearch;
@ -1411,7 +1411,7 @@ vmInterpret_t FS_FindVM(void **startSearch, char *found, int foundlen, const cha
search = fs_searchpaths; search = fs_searchpaths;
else else
search = lastSearch->next; search = lastSearch->next;
while(search) while(search)
{ {
if(search->dir && !fs_numServerPaks) if(search->dir && !fs_numServerPaks)
@ -1426,7 +1426,7 @@ vmInterpret_t FS_FindVM(void **startSearch, char *found, int foundlen, const cha
{ {
Q_strncpyz(found, netpath, foundlen); Q_strncpyz(found, netpath, foundlen);
*startSearch = search; *startSearch = search;
return VMI_NATIVE; return VMI_NATIVE;
} }
} }
@ -1441,17 +1441,17 @@ vmInterpret_t FS_FindVM(void **startSearch, char *found, int foundlen, const cha
{ {
pack = search->pack; pack = search->pack;
if(lastSearch && lastSearch->pack) if(lastSearch && lastSearch->pack)
{ {
// make sure we only try loading one VM file per game dir // make sure we only try loading one VM file per game dir
// i.e. if VM from pak7.pk3 fails we won't try one from pak6.pk3 // i.e. if VM from pak7.pk3 fails we won't try one from pak6.pk3
if(!FS_FilenameCompare(lastSearch->pack->pakPathname, pack->pakPathname)) if(!FS_FilenameCompare(lastSearch->pack->pakPathname, pack->pakPathname))
{ {
search = search->next; search = search->next;
continue; continue;
} }
} }
if(FS_FOpenFileReadDir(qvmName, search, NULL, qfalse, qfalse) > 0) if(FS_FOpenFileReadDir(qvmName, search, NULL, qfalse, qfalse) > 0)
{ {
@ -1460,7 +1460,7 @@ vmInterpret_t FS_FindVM(void **startSearch, char *found, int foundlen, const cha
return VMI_COMPILED; return VMI_COMPILED;
} }
} }
search = search->next; search = search->next;
} }
@ -1621,7 +1621,7 @@ int FS_Seek( fileHandle_t f, long offset, int origin ) {
if (fsh[f].streamed) { if (fsh[f].streamed) {
fsh[f].streamed = qfalse; fsh[f].streamed = qfalse;
FS_Seek( f, offset, origin ); FS_Seek( f, offset, origin );
fsh[f].streamed = qtrue; fsh[f].streamed = qtrue;
} }
@ -1827,7 +1827,7 @@ long FS_ReadFileDir(const char *qpath, void *searchPath, qboolean unpure, void *
{ {
// look for it in the filesystem or pack files // look for it in the filesystem or pack files
len = FS_FOpenFileRead(qpath, &h, qfalse); len = FS_FOpenFileRead(qpath, &h, qfalse);
} }
else else
{ {
// look for it in a specific search path only // look for it in a specific search path only
@ -1847,7 +1847,7 @@ long FS_ReadFileDir(const char *qpath, void *searchPath, qboolean unpure, void *
} }
return -1; return -1;
} }
if ( !buffer ) { if ( !buffer ) {
if ( isConfig && com_journal && com_journal->integer == 1 ) { if ( isConfig && com_journal && com_journal->integer == 1 ) {
Com_DPrintf( "Writing len for %s to journal file.\n", qpath ); Com_DPrintf( "Writing len for %s to journal file.\n", qpath );
@ -2088,21 +2088,21 @@ qboolean FS_CompareZipChecksum(const char *zipfile)
{ {
pack_t *thepak; pack_t *thepak;
int index, checksum; int index, checksum;
thepak = FS_LoadZipFile(zipfile, ""); thepak = FS_LoadZipFile(zipfile, "");
if(!thepak) if(!thepak)
return qfalse; return qfalse;
checksum = thepak->checksum; checksum = thepak->checksum;
FS_FreePak(thepak); FS_FreePak(thepak);
for(index = 0; index < fs_numServerReferencedPaks; index++) for(index = 0; index < fs_numServerReferencedPaks; index++)
{ {
if(checksum == fs_serverReferencedPaks[index]) if(checksum == fs_serverReferencedPaks[index])
return qtrue; return qtrue;
} }
return qfalse; return qfalse;
} }
@ -2253,7 +2253,7 @@ char **FS_ListFilteredFiles( const char *path, const char *extension, char *filt
temp = pathLength; temp = pathLength;
if (pathLength) { if (pathLength) {
temp++; // include the '/' temp++; // include the '/'
} }
nfiles = FS_AddFileToList( name + temp, list, nfiles ); nfiles = FS_AddFileToList( name + temp, list, nfiles );
} }
@ -2266,8 +2266,8 @@ char **FS_ListFilteredFiles( const char *path, const char *extension, char *filt
// don't scan directories for files if we are pure or restricted // don't scan directories for files if we are pure or restricted
if ( fs_numServerPaks && !allowNonPureFilesOnDisk ) { if ( fs_numServerPaks && !allowNonPureFilesOnDisk ) {
continue; continue;
} else { } else {
netpath = FS_BuildOSPath( search->dir->path, search->dir->gamedir, path ); netpath = FS_BuildOSPath( search->dir->path, search->dir->gamedir, path );
sysFiles = Sys_ListFiles( netpath, extension, filter, &numSysFiles, qfalse ); sysFiles = Sys_ListFiles( netpath, extension, filter, &numSysFiles, qfalse );
for ( i = 0 ; i < numSysFiles ; i++ ) { for ( i = 0 ; i < numSysFiles ; i++ ) {
@ -2277,7 +2277,7 @@ char **FS_ListFilteredFiles( const char *path, const char *extension, char *filt
} }
Sys_FreeFileList( sysFiles ); Sys_FreeFileList( sysFiles );
} }
} }
} }
// return a copy of the list // return a copy of the list
@ -2842,7 +2842,7 @@ void FS_AddGameDirectory( const char *path, const char *dir ) {
return; // we've already got this one return; // we've already got this one
} }
} }
Q_strncpyz( fs_gamedir, dir, sizeof( fs_gamedir ) ); Q_strncpyz( fs_gamedir, dir, sizeof( fs_gamedir ) );
// find all pak files in this directory // find all pak files in this directory
@ -2861,7 +2861,7 @@ void FS_AddGameDirectory( const char *path, const char *dir ) {
Q_strncpyz(pak->pakPathname, curpath, sizeof(pak->pakPathname)); Q_strncpyz(pak->pakPathname, curpath, sizeof(pak->pakPathname));
// store the game name for downloading // store the game name for downloading
Q_strncpyz(pak->pakGamename, dir, sizeof(pak->pakGamename)); Q_strncpyz(pak->pakGamename, dir, sizeof(pak->pakGamename));
fs_packFiles += pak->numfiles; fs_packFiles += pak->numfiles;
search = Z_Malloc (sizeof(searchpath_t)); search = Z_Malloc (sizeof(searchpath_t));
@ -2969,9 +2969,9 @@ qboolean FS_ComparePaks( char *neededpaks, int len, qboolean dlstring ) {
// never autodownload any of the id paks // never autodownload any of the id paks
if(FS_idPak(fs_serverReferencedPakNames[i], BASEGAME, NUM_ID_PAKS) if(FS_idPak(fs_serverReferencedPakNames[i], BASEGAME, NUM_ID_PAKS)
#ifndef STANDALONE #ifndef STANDALONE
|| FS_idPak(fs_serverReferencedPakNames[i], BASETA, NUM_TA_PAKS) || FS_idPak(fs_serverReferencedPakNames[i], BASETA, NUM_TA_PAKS)
#endif #endif
) )
{ {
continue; continue;
} }
@ -3171,14 +3171,14 @@ static void FS_Startup( const char *gameName )
FS_AddGameDirectory( fs_basepath->string, gameName ); FS_AddGameDirectory( fs_basepath->string, gameName );
} }
// fs_homepath is somewhat particular to *nix systems, only add if relevant // fs_homepath is somewhat particular to *nix systems, only add if relevant
#ifdef MACOS_X #ifdef MACOS_X
fs_apppath = Cvar_Get ("fs_apppath", Sys_DefaultAppPath(), CVAR_INIT|CVAR_PROTECTED ); fs_apppath = Cvar_Get ("fs_apppath", Sys_DefaultAppPath(), CVAR_INIT|CVAR_PROTECTED );
// Make MacOSX also include the base path included with the .app bundle // Make MacOSX also include the base path included with the .app bundle
if (fs_apppath->string[0]) if (fs_apppath->string[0])
FS_AddGameDirectory(fs_apppath->string, gameName); FS_AddGameDirectory(fs_apppath->string, gameName);
#endif #endif
// NOTE: same filtering below for mods and basegame // NOTE: same filtering below for mods and basegame
if (fs_homepath->string[0] && Q_stricmp(fs_homepath->string,fs_basepath->string)) { if (fs_homepath->string[0] && Q_stricmp(fs_homepath->string,fs_basepath->string)) {
FS_CreatePath ( fs_homepath->string ); FS_CreatePath ( fs_homepath->string );
@ -3270,80 +3270,80 @@ static void FS_CheckPak0( void )
if(!path->pack) if(!path->pack)
continue; continue;
curpack = path->pack; curpack = path->pack;
if(!Q_stricmpn( curpack->pakGamename, "demoq3", MAX_OSPATH ) if(!Q_stricmpn( curpack->pakGamename, "demoq3", MAX_OSPATH )
&& !Q_stricmpn( pakBasename, "pak0", MAX_OSPATH )) && !Q_stricmpn( pakBasename, "pak0", MAX_OSPATH ))
{ {
if(curpack->checksum == DEMO_PAK0_CHECKSUM) if(curpack->checksum == DEMO_PAK0_CHECKSUM)
founddemo = qtrue; founddemo = qtrue;
} }
else if(!Q_stricmpn( curpack->pakGamename, BASEGAME, MAX_OSPATH ) else if(!Q_stricmpn( curpack->pakGamename, BASEGAME, MAX_OSPATH )
&& strlen(pakBasename) == 4 && !Q_stricmpn( pakBasename, "pak", 3 ) && strlen(pakBasename) == 4 && !Q_stricmpn( pakBasename, "pak", 3 )
&& pakBasename[3] >= '0' && pakBasename[3] <= '0' + NUM_ID_PAKS - 1) && pakBasename[3] >= '0' && pakBasename[3] <= '0' + NUM_ID_PAKS - 1)
{ {
if( curpack->checksum != pak_checksums[pakBasename[3]-'0'] ) if( curpack->checksum != pak_checksums[pakBasename[3]-'0'] )
{ {
if(pakBasename[3] == '0') if(pakBasename[3] == '0')
{ {
Com_Printf("\n\n" Com_Printf("\n\n"
"**************************************************\n" "**************************************************\n"
"WARNING: " BASEGAME "/pak0.pk3 is present but its checksum (%u)\n" "WARNING: " BASEGAME "/pak0.pk3 is present but its checksum (%u)\n"
"is not correct. Please re-copy pak0.pk3 from your\n" "is not correct. Please re-copy pak0.pk3 from your\n"
"legitimate Q3 CDROM.\n" "legitimate Q3 CDROM.\n"
"**************************************************\n\n\n", "**************************************************\n\n\n",
curpack->checksum ); curpack->checksum );
} }
else else
{ {
Com_Printf("\n\n" Com_Printf("\n\n"
"**************************************************\n" "**************************************************\n"
"WARNING: " BASEGAME "/pak%d.pk3 is present but its checksum (%u)\n" "WARNING: " BASEGAME "/pak%d.pk3 is present but its checksum (%u)\n"
"is not correct. Please re-install the point release\n" "is not correct. Please re-install the point release\n"
"**************************************************\n\n\n", "**************************************************\n\n\n",
pakBasename[3]-'0', curpack->checksum ); pakBasename[3]-'0', curpack->checksum );
} }
} }
foundPak |= 1<<(pakBasename[3]-'0'); foundPak |= 1<<(pakBasename[3]-'0');
} }
else if(!Q_stricmpn(curpack->pakGamename, BASETA, MAX_OSPATH) else if(!Q_stricmpn(curpack->pakGamename, BASETA, MAX_OSPATH)
&& strlen(pakBasename) == 4 && !Q_stricmpn(pakBasename, "pak", 3) && strlen(pakBasename) == 4 && !Q_stricmpn(pakBasename, "pak", 3)
&& pakBasename[3] >= '0' && pakBasename[3] <= '0' + NUM_TA_PAKS - 1) && pakBasename[3] >= '0' && pakBasename[3] <= '0' + NUM_TA_PAKS - 1)
{ {
if(curpack->checksum != missionpak_checksums[pakBasename[3]-'0']) if(curpack->checksum != missionpak_checksums[pakBasename[3]-'0'])
{ {
Com_Printf("\n\n" Com_Printf("\n\n"
"**************************************************\n" "**************************************************\n"
"WARNING: " BASETA "/pak%d.pk3 is present but its checksum (%u)\n" "WARNING: " BASETA "/pak%d.pk3 is present but its checksum (%u)\n"
"is not correct. Please re-install Team Arena\n" "is not correct. Please re-install Team Arena\n"
"**************************************************\n\n\n", "**************************************************\n\n\n",
pakBasename[3]-'0', curpack->checksum ); pakBasename[3]-'0', curpack->checksum );
} }
foundTA |= 1 << (pakBasename[3]-'0'); foundTA |= 1 << (pakBasename[3]-'0');
} }
else else
{ {
int index; int index;
// Finally check whether this pak's checksum is listed because the user tried // Finally check whether this pak's checksum is listed because the user tried
// to trick us by renaming the file, and set foundPak's highest bit to indicate this case. // to trick us by renaming the file, and set foundPak's highest bit to indicate this case.
for(index = 0; index < ARRAY_LEN(pak_checksums); index++) for(index = 0; index < ARRAY_LEN(pak_checksums); index++)
{ {
if(curpack->checksum == pak_checksums[index]) if(curpack->checksum == pak_checksums[index])
{ {
Com_Printf("\n\n" Com_Printf("\n\n"
"**************************************************\n" "**************************************************\n"
"WARNING: %s is renamed pak file %s%cpak%d.pk3\n" "WARNING: %s is renamed pak file %s%cpak%d.pk3\n"
"Running in standalone mode won't work\n" "Running in standalone mode won't work\n"
"Please rename, or remove this file\n" "Please rename, or remove this file\n"
"**************************************************\n\n\n", "**************************************************\n\n\n",
curpack->pakFilename, BASEGAME, PATH_SEP, index); curpack->pakFilename, BASEGAME, PATH_SEP, index);
foundPak |= 0x80000000; foundPak |= 0x80000000;
@ -3355,12 +3355,12 @@ static void FS_CheckPak0( void )
if(curpack->checksum == missionpak_checksums[index]) if(curpack->checksum == missionpak_checksums[index])
{ {
Com_Printf("\n\n" Com_Printf("\n\n"
"**************************************************\n" "**************************************************\n"
"WARNING: %s is renamed pak file %s%cpak%d.pk3\n" "WARNING: %s is renamed pak file %s%cpak%d.pk3\n"
"Running in standalone mode won't work\n" "Running in standalone mode won't work\n"
"Please rename, or remove this file\n" "Please rename, or remove this file\n"
"**************************************************\n\n\n", "**************************************************\n\n\n",
curpack->pakFilename, BASETA, PATH_SEP, index); curpack->pakFilename, BASETA, PATH_SEP, index);
foundTA |= 0x80000000; foundTA |= 0x80000000;
} }
@ -3387,7 +3387,7 @@ static void FS_CheckPak0( void )
"from the demo. This may work fine, but it is not\n" "from the demo. This may work fine, but it is not\n"
"guaranteed or supported.\n" "guaranteed or supported.\n"
"**************************************************\n\n\n" ); "**************************************************\n\n\n" );
foundPak |= 0x01; foundPak |= 0x01;
} }
} }
@ -3401,25 +3401,25 @@ static void FS_CheckPak0( void )
if((foundPak & 0x01) != 0x01) if((foundPak & 0x01) != 0x01)
{ {
Q_strcat(errorText, sizeof(errorText), Q_strcat(errorText, sizeof(errorText),
"\"pak0.pk3\" is missing. Please copy it " "\"pak0.pk3\" is missing. Please copy it "
"from your legitimate Q3 CDROM. "); "from your legitimate Q3 CDROM. ");
} }
if((foundPak & 0x1fe) != 0x1fe) if((foundPak & 0x1fe) != 0x1fe)
{ {
Q_strcat(errorText, sizeof(errorText), Q_strcat(errorText, sizeof(errorText),
"Point Release files are missing. Please " "Point Release files are missing. Please "
"re-install the 1.32 point release. "); "re-install the 1.32 point release. ");
} }
Q_strcat(errorText, sizeof(errorText), Q_strcat(errorText, sizeof(errorText),
va("Also check that your ioq3 executable is in " va("Also check that your ioq3 executable is in "
"the correct place and that every file " "the correct place and that every file "
"in the \"%s\" directory is present and readable", BASEGAME)); "in the \"%s\" directory is present and readable", BASEGAME));
Com_Error(ERR_FATAL, "%s", errorText); Com_Error(ERR_FATAL, "%s", errorText);
} }
if(!com_standalone->integer && foundTA && (foundTA & 0x0f) != 0x0f) if(!com_standalone->integer && foundTA && (foundTA & 0x0f) != 0x0f)
{ {
char errorText[MAX_STRING_CHARS] = ""; char errorText[MAX_STRING_CHARS] = "";
@ -3427,15 +3427,15 @@ static void FS_CheckPak0( void )
if((foundTA & 0x01) != 0x01) if((foundTA & 0x01) != 0x01)
{ {
Com_sprintf(errorText, sizeof(errorText), Com_sprintf(errorText, sizeof(errorText),
"\"" BASETA "%cpak0.pk3\" is missing. Please copy it " "\"" BASETA "%cpak0.pk3\" is missing. Please copy it "
"from your legitimate Quake 3 Team Arena CDROM. ", PATH_SEP); "from your legitimate Quake 3 Team Arena CDROM. ", PATH_SEP);
} }
if((foundTA & 0x0e) != 0x0e) if((foundTA & 0x0e) != 0x0e)
{ {
Q_strcat(errorText, sizeof(errorText), Q_strcat(errorText, sizeof(errorText),
"Team Arena Point Release files are missing. Please " "Team Arena Point Release files are missing. Please "
"re-install the latest Team Arena point release."); "re-install the latest Team Arena point release.");
} }
Com_Error(ERR_FATAL, "%s", errorText); Com_Error(ERR_FATAL, "%s", errorText);
@ -3756,11 +3756,11 @@ void FS_PureServerSetReferencedPaks( const char *pakSums, const char *pakNames )
fs_serverReferencedPakNames[i] = CopyString( Cmd_Argv( i ) ); fs_serverReferencedPakNames[i] = CopyString( Cmd_Argv( i ) );
} }
} }
// ensure that there are as many checksums as there are pak names. // ensure that there are as many checksums as there are pak names.
if(d < c) if(d < c)
c = d; c = d;
fs_numServerReferencedPaks = c; fs_numServerReferencedPaks = c;
} }
@ -3870,8 +3870,8 @@ qboolean FS_ConditionalRestart(int checksumFeed, qboolean disconnect)
if(fs_gamedirvar->modified) if(fs_gamedirvar->modified)
{ {
if(FS_FilenameCompare(lastValidGame, fs_gamedirvar->string) && if(FS_FilenameCompare(lastValidGame, fs_gamedirvar->string) &&
(*lastValidGame || FS_FilenameCompare(fs_gamedirvar->string, com_basegame->string)) && (*lastValidGame || FS_FilenameCompare(fs_gamedirvar->string, com_basegame->string)) &&
(*fs_gamedirvar->string || FS_FilenameCompare(lastValidGame, com_basegame->string))) (*fs_gamedirvar->string || FS_FilenameCompare(lastValidGame, com_basegame->string)))
{ {
Com_GameRestart(checksumFeed, disconnect); Com_GameRestart(checksumFeed, disconnect);
return qtrue; return qtrue;
@ -3879,12 +3879,12 @@ qboolean FS_ConditionalRestart(int checksumFeed, qboolean disconnect)
else else
fs_gamedirvar->modified = qfalse; fs_gamedirvar->modified = qfalse;
} }
if(checksumFeed != fs_checksumFeed) if(checksumFeed != fs_checksumFeed)
FS_Restart(checksumFeed); FS_Restart(checksumFeed);
else if(fs_numServerPaks && !fs_reordered) else if(fs_numServerPaks && !fs_reordered)
FS_ReorderPurePaks(); FS_ReorderPurePaks();
return qfalse; return qfalse;
} }
@ -3903,28 +3903,28 @@ int FS_FOpenFileByMode( const char *qpath, fileHandle_t *f, fsMode_t mode ) {
sync = qfalse; sync = qfalse;
switch( mode ) { switch( mode ) {
case FS_READ: case FS_READ:
r = FS_FOpenFileRead( qpath, f, qtrue ); r = FS_FOpenFileRead( qpath, f, qtrue );
break; break;
case FS_WRITE: case FS_WRITE:
*f = FS_FOpenFileWrite( qpath ); *f = FS_FOpenFileWrite( qpath );
r = 0; r = 0;
if (*f == 0) { if (*f == 0) {
r = -1; r = -1;
} }
break; break;
case FS_APPEND_SYNC: case FS_APPEND_SYNC:
sync = qtrue; sync = qtrue;
case FS_APPEND: case FS_APPEND:
*f = FS_FOpenFileAppend( qpath ); *f = FS_FOpenFileAppend( qpath );
r = 0; r = 0;
if (*f == 0) { if (*f == 0) {
r = -1; r = -1;
} }
break; break;
default: default:
Com_Error( ERR_FATAL, "FS_FOpenFileByMode: bad mode" ); Com_Error( ERR_FATAL, "FS_FOpenFileByMode: bad mode" );
return -1; return -1;
} }
if (!f) { if (!f) {