shithub: choc

Download patch

ref: c247ce4a3c8c35ad6e41fab67cb38c6e53689030
parent: fff2e0e0587eac81c8ba4c48dcb1141a08b3f450
author: Fabian Greffrath <fabian@greffrath.com>
date: Fri Jan 25 03:31:05 EST 2019

factor out some lumpinfo query into separate functions

--- 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 (maplumpinfo->wad_file == lumpinfo[0]->wad_file)
+    if (W_IsIWADLump(maplumpinfo))
     {
         M_snprintf(savegamestrings[itemOn], SAVESTRINGSIZE,
                    "%s", maplumpinfo->name);
@@ -644,7 +644,7 @@
     else
     {
         M_snprintf(savegamestrings[itemOn], SAVESTRINGSIZE,
-                   "%s: %s", M_BaseName(maplumpinfo->wad_file->path),
+                   "%s: %s", W_WadNameForLump(maplumpinfo),
                    maplumpinfo->name);
     }
     M_ForceUppercase(savegamestrings[itemOn]);
--- a/src/w_wad.c
+++ b/src/w_wad.c
@@ -618,3 +618,12 @@
     W_GenerateHashTable();
 }
 
+const char *W_WadNameForLump(const lumpinfo_t *lump)
+{
+	return M_BaseName(lump->wad_file->path);
+}
+
+boolean W_IsIWADLump(const lumpinfo_t *lump)
+{
+	return lump->wad_file == lumpinfo[0]->wad_file;
+}
--- a/src/w_wad.h
+++ b/src/w_wad.h
@@ -72,4 +72,7 @@
 void W_ReleaseLumpNum(lumpindex_t lump);
 void W_ReleaseLumpName(const char *name);
 
+const char *W_WadNameForLump(const lumpinfo_t *lump);
+boolean W_IsIWADLump(const lumpinfo_t *lump);
+
 #endif