foxygit / doom Log in
commit 383693bad415070e20b66d105d9a6147fd27a39a
Author:     Simon Howard <fraggle@gmail.com>
AuthorDate: Thu Oct 20 23:05:52 2011 +0000
Commit:     Simon Howard <fraggle@gmail.com>
CommitDate: Thu Oct 20 23:05:52 2011 +0000

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

    Subversion-branch: /branches/v2-branch
    Subversion-revision: 2447
---
 src/setup/mainmenu.c |  2 +-
 src/setup/mode.c     | 14 ++++++++++++++
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/src/setup/mainmenu.c b/src/setup/mainmenu.c
index 4256c408..bfe2cdf7 100644
--- a/src/setup/mainmenu.c
+++ b/src/setup/mainmenu.c
@@ -259,12 +259,12 @@ void MainMenu(void)

 static void InitConfig(void)
 {
+    M_SetConfigDir(NULL);
     InitBindings();

     SetChatMacroDefaults();
     SetPlayerNameDefault();

-    M_SetConfigDir(NULL);
     M_LoadDefaults();
 }

diff --git a/src/setup/mode.c b/src/setup/mode.c
index 53a74314..88924ad8 100644
--- a/src/setup/mode.c
+++ b/src/setup/mode.c
@@ -128,6 +128,20 @@ static void BindMiscVariables(void)
     {
         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)