foxygit / doom Log in
commit 6e746bd6b45259360c61e5e3aa8f96a0f639d15b
Author:     Fabian Greffrath <fabian@greffrath.com>
AuthorDate: Mon Jun 24 14:33:57 2019 +0200
Commit:     Fabian Greffrath <fabian@greffrath.com>
CommitDate: Mon Jun 24 14:34:37 2019 +0200

    remove .wad extension from WAD name in default savegame name

    This saves some precious 4 bytes from the savegame name.
---
 src/doom/m_menu.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/doom/m_menu.c b/src/doom/m_menu.c
index 3507f161..859b096a 100644
--- a/src/doom/m_menu.c
+++ b/src/doom/m_menu.c
@@ -643,9 +643,18 @@ static void SetDefaultSaveName(int slot)
     }
     else
     {
+        char *wadname = M_StringDuplicate(W_WadNameForLump(maplumpinfo));
+        char *ext = strrchr(wadname, '.');
+
+        if (ext != NULL)
+        {
+            *ext = '\0';
+        }
+
         M_snprintf(savegamestrings[itemOn], SAVESTRINGSIZE,
                    "%s (%s)", maplumpinfo->name,
-                   W_WadNameForLump(maplumpinfo));
+                   wadname);
+        free(wadname);
     }
     M_ForceUppercase(savegamestrings[itemOn]);
     joypadSave = false;