From 0b0e4c0db6886b98fcd593c3ca496e75c24b8a1e Mon Sep 17 00:00:00 2001 From: /dev/humancontroller Date: Mon, 8 Jun 2015 14:45:35 +0200 Subject: fix up G_MapExists(), and use it more --- src/game/g_admin.c | 2 +- src/game/g_local.h | 2 +- src/game/g_maprotation.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/game/g_admin.c b/src/game/g_admin.c index 2d6aeaba..24330aa2 100644 --- a/src/game/g_admin.c +++ b/src/game/g_admin.c @@ -2044,7 +2044,7 @@ qboolean G_admin_changemap( gentity_t *ent ) trap_Argv( 1, map, sizeof( map ) ); - if( !trap_FS_FOpenFile( va( "maps/%s.bsp", map ), NULL, FS_READ ) ) + if( !G_MapExists( map ) ) { ADMP( va( "^3changemap: ^7invalid map name '%s'\n", map ) ); return qfalse; diff --git a/src/game/g_local.h b/src/game/g_local.h index 693b5bb1..262eb138 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -1071,7 +1071,7 @@ void G_StopMapRotation( void ); qboolean G_MapRotationActive( void ); void G_InitMapRotations( void ); void G_ShutdownMapRotations( void ); -qboolean G_MapExists( char *name ); +qboolean G_MapExists( const char *name ); void G_ClearRotationStack( void ); void G_PerformMapRestart( void ); void G_PerformMapChange( const char *map ); diff --git a/src/game/g_maprotation.c b/src/game/g_maprotation.c index e6d773e8..a25c9749 100644 --- a/src/game/g_maprotation.c +++ b/src/game/g_maprotation.c @@ -118,9 +118,9 @@ G_MapExists Check if a map exists =============== */ -qboolean G_MapExists( char *name ) +qboolean G_MapExists( const char *name ) { - return trap_FS_FOpenFile( va( "maps/%s.bsp", name ), NULL, FS_READ ); + return trap_FS_FOpenFile( va( "maps/%s.bsp", name ), NULL, FS_READ ) > 0; } /* -- cgit