From c1213b4bde16524ea07d6972c9312f8bc57d7b98 Mon Sep 17 00:00:00 2001 From: Andrey Nazarov Date: Wed, 19 Sep 2007 18:55:33 +0000 Subject: Made fs_restart command available for dedicated servers. Do not reset CVAR_LATCHED flag in Cvar_Get, as it causes problems. --- source/files.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'source/files.c') diff --git a/source/files.c b/source/files.c index 046cae7..4d51721 100644 --- a/source/files.c +++ b/source/files.c @@ -2466,7 +2466,7 @@ qboolean FS_SafeToRestart( void ) { fsFile_t *file; int i; - /* make sure no files are opened for reading */ + // make sure no files are opened for reading for( i = 0, file = fs_files; i < MAX_FILE_HANDLES; i++, file++ ) { if( file->type == FS_FREE ) { continue; @@ -2530,6 +2530,22 @@ void FS_Restart( void ) { Com_Printf( "--------------------------------\n" ); } +/* +============ +FS_Restart_f + +Console command to re-start the file system. +============ +*/ +static void FS_Restart_f( void ) { + if( !FS_SafeToRestart() ) { + Com_Printf( "Can't \"%s\", there are some open file handles.\n", Cmd_Argv( 0 ) ); + return; + } + + CL_RestartFilesystem(); +} + /* ================ FS_FillAPI @@ -2559,6 +2575,7 @@ static const cmdreg_t c_fs[] = { { "whereis", FS_WhereIs_f }, { "link", FS_Link_f, FS_Link_g }, { "unlink", FS_UnLink_f, FS_Link_g }, + { "fs_restart", FS_Restart_f }, { NULL } }; -- cgit v1.2.3