shithub: choc

Download patch

ref: 383693bad415070e20b66d105d9a6147fd27a39a
parent: 31a58552ffc647d2c87b557441d3725c6fba2b37
author: Simon Howard <fraggle@gmail.com>
date: Thu Oct 20 19:05:52 EDT 2011

Fix bug with Hexen savedir set to "(null)" by setup tool (thanks
Alexandre Xavier).

Subversion-branch: /branches/v2-branch
Subversion-revision: 2447

--- a/src/setup/mainmenu.c
+++ b/src/setup/mainmenu.c
@@ -259,12 +259,12 @@
 
 static void InitConfig(void)
 {
+    M_SetConfigDir(NULL);
     InitBindings();
 
     SetChatMacroDefaults();
     SetPlayerNameDefault();
 
-    M_SetConfigDir(NULL);
     M_LoadDefaults();
 }
 
--- a/src/setup/mode.c
+++ b/src/setup/mode.c
@@ -128,6 +128,20 @@
     {
         M_BindVariable("savedir",           &savedir);
         M_BindVariable("messageson",        &showMessages);
+
+        // Hexen has a variable to control the savegame directory
+        // that is used.
+
+        savedir = M_GetSaveGameDir("hexen.wad");
+
+        // On Windows, hexndata\ is the default.
+
+        if (!strcmp(savedir, ""))
+        {
+            free(savedir);
+            savedir = malloc(10);
+            sprintf(savedir, "hexndata%c", DIR_SEPARATOR);
+        }
     }
 
     if (gamemission == strife)