From f3513e7edb71b1a8f04e50c642482893058eb309 Mon Sep 17 00:00:00 2001 From: James R Date: Mon, 22 Apr 2019 21:11:27 -0700 Subject: [PATCH] Don't count main WADs in packetsizetally --- src/d_main.c | 4 +--- src/filesrch.c | 1 - src/filesrch.h | 1 - src/m_menu.c | 2 +- src/p_setup.c | 2 +- src/w_wad.c | 6 +++--- src/w_wad.h | 2 +- 7 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/d_main.c b/src/d_main.c index 84d5a6f3..636356f7 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -74,7 +74,7 @@ int snprintf(char *str, size_t n, const char *fmt, ...); #include "m_cond.h" // condition initialization #include "fastcmp.h" #include "keys.h" -#include "filesrch.h" // refreshdirmenu, mainwadstally +#include "filesrch.h" // refreshdirmenu #ifdef CMAKECONFIG #include "config.h" @@ -1257,8 +1257,6 @@ void D_SRB2Main(void) #endif //ifndef DEVELOP - mainwadstally = packetsizetally; - // // search for maps // diff --git a/src/filesrch.c b/src/filesrch.c index 0276e1c9..8ebe31bc 100644 --- a/src/filesrch.c +++ b/src/filesrch.c @@ -342,7 +342,6 @@ UINT8 refreshdirmenu = 0; char *refreshdirname = NULL; size_t packetsizetally = 0; -size_t mainwadstally = 0; #if defined (_XBOX) && defined (_MSC_VER) filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *wantedmd5sum, diff --git a/src/filesrch.h b/src/filesrch.h index 01a52848..4e47b835 100644 --- a/src/filesrch.h +++ b/src/filesrch.h @@ -43,7 +43,6 @@ extern UINT8 refreshdirmenu; extern char *refreshdirname; extern size_t packetsizetally; -extern size_t mainwadstally; typedef enum { diff --git a/src/m_menu.c b/src/m_menu.c index 3ad076ff..07239458 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -4665,7 +4665,7 @@ static void M_DrawAddons(void) else { x = FixedDiv(((ssize_t)(numwadfiles) - (ssize_t)(mainwads+1))< y) y = x; if (y > FRACUNIT) // happens because of how we're shrinkin' it a little diff --git a/src/p_setup.c b/src/p_setup.c index ba4554e6..aeb9030c 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -3353,7 +3353,7 @@ boolean P_AddWadFile(const char *wadfilename) boolean mapsadded = false; boolean replacedcurrentmap = false; - if ((numlumps = W_InitFile(wadfilename)) == INT16_MAX) + if ((numlumps = W_InitFile(wadfilename, true)) == INT16_MAX) { refreshdirmenu |= REFRESHDIR_NOTLOADED; CONS_Printf(M_GetText("Errors occurred while loading %s; not added.\n"), wadfilename); diff --git a/src/w_wad.c b/src/w_wad.c index 91570184..8adba7da 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -644,7 +644,7 @@ static lumpinfo_t* ResGetLumpsZip (FILE* handle, UINT16* nlmp) // // Can now load dehacked files (.soc) // -UINT16 W_InitFile(const char *filename) +UINT16 W_InitFile(const char *filename, boolean addon) { FILE *handle; lumpinfo_t *lumpinfo = NULL; @@ -687,7 +687,7 @@ UINT16 W_InitFile(const char *filename) // Check if wad files will overflow fileneededbuffer. Only the filename part // is send in the packet; cf. // see PutFileNeeded in d_netfil.c - if ((important = !W_VerifyNMUSlumps(filename))) + if ((important = !W_VerifyNMUSlumps(filename)) && addon) { packetsize = packetsizetally + nameonlylength(filename) + 22; @@ -866,7 +866,7 @@ INT32 W_InitMultipleFiles(char **filenames, boolean addons) G_SetGameModified(true, false); //CONS_Debug(DBG_SETUP, "Loading %s\n", *filenames); - rc &= (W_InitFile(*filenames) != INT16_MAX) ? 1 : 0; + rc &= (W_InitFile(*filenames, addons) != INT16_MAX) ? 1 : 0; } if (!numwadfiles) diff --git a/src/w_wad.h b/src/w_wad.h index 762d3708..82fb696b 100644 --- a/src/w_wad.h +++ b/src/w_wad.h @@ -126,7 +126,7 @@ void W_Shutdown(void); // Opens a WAD file. Returns the FILE * handle for the file, or NULL if not found or could not be opened FILE *W_OpenWadFile(const char **filename, boolean useerrors); // Load and add a wadfile to the active wad files, returns numbers of lumps, INT16_MAX on error -UINT16 W_InitFile(const char *filename); +UINT16 W_InitFile(const char *filename, boolean addon); #ifdef DELFILE void W_UnloadWadFile(UINT16 num); #endif