shithub: choc

Download patch

ref: 6e746bd6b45259360c61e5e3aa8f96a0f639d15b
parent: 1c6affdddcbb9f09b97bdc9081281af7d6771421
author: Fabian Greffrath <fabian@greffrath.com>
date: Mon Jun 24 10:33:57 EDT 2019

remove .wad extension from WAD name in default savegame name

This saves some precious 4 bytes from the savegame name.

--- a/src/doom/m_menu.c
+++ b/src/doom/m_menu.c
@@ -643,9 +643,18 @@
     }
     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;