foxygit / doom Log in
commit 1c6affdddcbb9f09b97bdc9081281af7d6771421
Author:     Fabian Greffrath <fabian@greffrath.com>
AuthorDate: Mon Jun 24 10:08:04 2019 +0200
Commit:     Fabian Greffrath <fabian@greffrath.com>
CommitDate: Mon Jun 24 10:12:35 2019 +0200

    append WAD name to default savegame name if savegamedir is empty

    Apparently, if we have no configuration directory, i.e. on Windows, we
    have no savegame directory as well, c.f. M_GetSaveGameDir(). In this
    case, all savegames for all IWADs will be saved into the same
    directory and there is still risk of mixing them up. Thus, append the
    name of the WAD file if savegamedir is empty.

    NB: This does only work if the savegame slot is selected by pressing a
    joystick button. You are still expected to unambigiously name your
    savegames if playing with a keyboard.

    Fixes #1180, thanks @Zodomaniac.
---
 src/doom/m_menu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/doom/m_menu.c b/src/doom/m_menu.c
index f91c32d2..3507f161 100644
--- a/src/doom/m_menu.c
+++ b/src/doom/m_menu.c
@@ -636,7 +636,7 @@ void M_DoSave(int slot)
 static void SetDefaultSaveName(int slot)
 {
     // map from IWAD or PWAD?
-    if (W_IsIWADLump(maplumpinfo))
+    if (W_IsIWADLump(maplumpinfo) && strcmp(savegamedir, ""))
     {
         M_snprintf(savegamestrings[itemOn], SAVESTRINGSIZE,
                    "%s", maplumpinfo->name);
@@ -644,7 +644,7 @@ static void SetDefaultSaveName(int slot)
     else
     {
         M_snprintf(savegamestrings[itemOn], SAVESTRINGSIZE,
-                   "%s (%s)", maplumpinfo->name
+                   "%s (%s)", maplumpinfo->name,
                    W_WadNameForLump(maplumpinfo));
     }
     M_ForceUppercase(savegamestrings[itemOn]);