]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - host.c
fix bug in saveconfig that caused config to get saved to weird random file names...
[xonotic/darkplaces.git] / host.c
diff --git a/host.c b/host.c
index 5089a6a588730199bb464e6814f54ce434dac1b4..511ad1131f91d44e52f42ba437edd9e776fcffba 100644 (file)
--- 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 ();