shithub: choc

Download patch

ref: 1c6affdddcbb9f09b97bdc9081281af7d6771421
parent: 5a04f3310ecb84e01130ebd4ce3717dd75676074
author: Fabian Greffrath <[email protected]>
date: Mon Jun 24 06:08:04 EDT 2019

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.

--- a/src/doom/m_menu.c
+++ b/src/doom/m_menu.c
@@ -636,7 +636,7 @@
 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 @@
     else
     {
         M_snprintf(savegamestrings[itemOn], SAVESTRINGSIZE,
-                   "%s (%s)", maplumpinfo->name
+                   "%s (%s)", maplumpinfo->name,
                    W_WadNameForLump(maplumpinfo));
     }
     M_ForceUppercase(savegamestrings[itemOn]);