From: divverent Date: Wed, 2 Jan 2008 09:38:35 +0000 (+0000) Subject: fix bug in saveconfig that caused config to get saved to weird random file names... X-Git-Tag: xonotic-v0.1.0preview~2602 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=2777b39a3c13900b259496ed20e351c3fffd7fff;p=xonotic%2Fdarkplaces.git fix bug in saveconfig that caused config to get saved to weird random file names on quit git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7893 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/fs.c b/fs.c index 72475b69..d37537a8 100644 --- a/fs.c +++ b/fs.c @@ -1179,7 +1179,7 @@ void FS_Rescan_f(void) FS_ChangeGameDirs ================ */ -extern void Host_SaveConfig_f (void); +extern void Host_SaveConfig (void); extern void Host_LoadConfig_f (void); qboolean FS_ChangeGameDirs(int numgamedirs, char gamedirs[][MAX_QPATH], qboolean complain, qboolean failmissing) { @@ -1225,7 +1225,7 @@ qboolean FS_ChangeGameDirs(int numgamedirs, char gamedirs[][MAX_QPATH], qboolean // halt demo playback to close the file CL_Disconnect(); - Host_SaveConfig_f(); + Host_SaveConfig(); fs_numgamedirs = numgamedirs; for (i = 0;i < fs_numgamedirs;i++) diff --git a/host.c b/host.c index 5089a6a5..511ad113 100644 --- a/host.c +++ b/host.c @@ -220,15 +220,9 @@ Host_SaveConfig_f Writes key bindings and archived cvars to config.cfg =============== */ -void Host_SaveConfig_f(void) +void Host_SaveConfig_to(const char *file) { qfile_t *f; - const char *file = "config.cfg"; - - if(Cmd_Argc() >= 2) { - file = Cmd_Argv(1); - Con_Printf("Saving to %s\n", file); - } // dedicated servers initialize the host but don't parse and set the // config.cfg cvars @@ -248,7 +242,21 @@ void Host_SaveConfig_f(void) FS_Close (f); } } +void Host_SaveConfig(void) +{ + Host_SaveConfig_to("config.cfg"); +} +void Host_SaveConfig_f(void) +{ + const char *file = "config.cfg"; + if(Cmd_Argc() >= 2) { + file = Cmd_Argv(1); + Con_Printf("Saving to %s\n", file); + } + + Host_SaveConfig_to(file); +} /* =============== @@ -1169,7 +1177,7 @@ void Host_Shutdown(void) #endif CL_Video_Shutdown(); - Host_SaveConfig_f(); + Host_SaveConfig(); CDAudio_Shutdown (); S_Terminate ();