summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/cgame/cg_main.c12
-rw-r--r--src/cgame/cg_players.c2
-rw-r--r--src/cgame/cg_weapons.c2
-rw-r--r--src/game/g_client.c2
-rw-r--r--src/game/g_maprotation.c7
-rw-r--r--src/ui/ui_main.c3
6 files changed, 8 insertions, 20 deletions
diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c
index 3a591a37..67acb55f 100644
--- a/src/cgame/cg_main.c
+++ b/src/cgame/cg_main.c
@@ -662,17 +662,7 @@ Test if a specific file exists or not
*/
qboolean CG_FileExists( char *filename )
{
- fileHandle_t f;
-
- if( trap_FS_FOpenFile( filename, &f, FS_READ ) > 0 )
- {
- //file exists so close it
- trap_FS_FCloseFile( f );
-
- return qtrue;
- }
- else
- return qfalse;
+ return trap_FS_FOpenFile( filename, NULL, FS_READ );
}
/*
diff --git a/src/cgame/cg_players.c b/src/cgame/cg_players.c
index cdfbc747..78cbe8d8 100644
--- a/src/cgame/cg_players.c
+++ b/src/cgame/cg_players.c
@@ -107,7 +107,7 @@ static qboolean CG_ParseAnimationFile( const char *filename, clientInfo_t *ci )
// load the file
len = trap_FS_FOpenFile( filename, &f, FS_READ );
- if( len <= 0 )
+ if( len < 0 )
return qfalse;
if( len >= sizeof( text ) - 1 )
diff --git a/src/cgame/cg_weapons.c b/src/cgame/cg_weapons.c
index f6866bc2..e3776779 100644
--- a/src/cgame/cg_weapons.c
+++ b/src/cgame/cg_weapons.c
@@ -439,7 +439,7 @@ static qboolean CG_ParseWeaponFile( const char *filename, weaponInfo_t *wi )
// load the file
len = trap_FS_FOpenFile( filename, &f, FS_READ );
- if( len <= 0 )
+ if( len < 0 )
return qfalse;
if( len >= sizeof( text ) - 1 )
diff --git a/src/game/g_client.c b/src/game/g_client.c
index 3022a9cc..d0f9349f 100644
--- a/src/game/g_client.c
+++ b/src/game/g_client.c
@@ -887,7 +887,7 @@ static qboolean G_NonSegModel( const char *filename )
return qfalse;
}
- if( len <= 0 )
+ if( len < 0 )
return qfalse;
if( len >= sizeof( text ) - 1 )
diff --git a/src/game/g_maprotation.c b/src/game/g_maprotation.c
index b97b3b6f..b34370b8 100644
--- a/src/game/g_maprotation.c
+++ b/src/game/g_maprotation.c
@@ -310,7 +310,7 @@ static qboolean G_ParseMapRotationFile( const char *fileName )
// load the file
len = trap_FS_FOpenFile( fileName, &f, FS_READ );
- if( len <= 0 )
+ if( len < 0 )
return qfalse;
if( len >= sizeof( text ) - 1 )
@@ -773,13 +773,10 @@ Load and intialise the map rotations
void G_InitMapRotations( void )
{
const char *fileName = "maprotation.cfg";
- fileHandle_t f;
//load the file if it exists
- if( trap_FS_FOpenFile( fileName, &f, FS_READ ) > 0 )
+ if( trap_FS_FOpenFile( fileName, NULL, FS_READ ) )
{
- trap_FS_FCloseFile( f );
-
if( !G_ParseMapRotationFile( fileName ) )
G_Printf( S_COLOR_RED "ERROR: failed to parse %s file\n", fileName );
}
diff --git a/src/ui/ui_main.c b/src/ui/ui_main.c
index 4dffbd96..11971f2a 100644
--- a/src/ui/ui_main.c
+++ b/src/ui/ui_main.c
@@ -2940,12 +2940,13 @@ static void UI_RunMenuScript( char **args )
{
trap_FS_Read( text, len, f );
text[ len ] = 0;
- trap_FS_FCloseFile( f );
Com_sprintf( command, 32, "ptrcrestore %s", text );
trap_Cmd_ExecuteText( EXEC_APPEND, command );
}
+ if( len > -1 )
+ trap_FS_FCloseFile( f );
}
else if( Q_stricmp( name, "Say" ) == 0 )
{