From d685060aef70ae5938170db2fd3810470dbf8a62 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Sat, 27 May 2017 14:01:26 +0100 Subject: [PATCH] Store importance (nmuslumps check) to prevent having to do it again when doing d_netfil stuff. --- src/d_netfil.c | 4 ++-- src/w_wad.c | 4 +++- src/w_wad.h | 1 + 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/d_netfil.c b/src/d_netfil.c index a6b37186a..ffd39eef9 100644 --- a/src/d_netfil.c +++ b/src/d_netfil.c @@ -116,7 +116,7 @@ UINT8 *PutFileNeeded(void) for (i = 0; i < numwadfiles; i++) { // If it has only music/sound lumps, don't put it in the list - if (W_VerifyNMUSlumps(wadfiles[i]->filename)) + if (!wadfiles[i]->important) continue; else filestatus = 1; // Importance - not really used any more, holds 1 by default for backwards compat with MS @@ -339,7 +339,7 @@ INT32 CL_CheckFiles(void) CONS_Debug(DBG_NETPLAY, "game is modified; only doing basic checks\n"); for (i = 1, j = 1; i < fileneedednum || j < numwadfiles;) { - if (j < numwadfiles && W_VerifyNMUSlumps(wadfiles[j]->filename)) + if (j < numwadfiles && !wadfiles[j]->important) { // Unimportant on our side. ++j; diff --git a/src/w_wad.c b/src/w_wad.c index 32c2f3e6c..cf8e7aab0 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -298,6 +298,7 @@ UINT16 W_LoadWadFile(const char *filename) INT32 compressed = 0; size_t packetsize; UINT8 md5sum[16]; + boolean important; if (!(refreshdirmenu & REFRESHDIR_ADDFILE)) refreshdirmenu = REFRESHDIR_NORMAL|REFRESHDIR_ADDFILE; // clean out cons_alerts that happened earlier @@ -320,7 +321,7 @@ UINT16 W_LoadWadFile(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 (!W_VerifyNMUSlumps(filename)) + if ((important = !W_VerifyNMUSlumps(filename))) { packetsize = packetsizetally; @@ -474,6 +475,7 @@ UINT16 W_LoadWadFile(const char *filename) wadfile->handle = handle; wadfile->numlumps = (UINT16)numlumps; wadfile->lumpinfo = lumpinfo; + wadfile->important = important; fseek(handle, 0, SEEK_END); wadfile->filesize = (unsigned)ftell(handle); diff --git a/src/w_wad.h b/src/w_wad.h index f7ea64a56..a9ca29b35 100644 --- a/src/w_wad.h +++ b/src/w_wad.h @@ -70,6 +70,7 @@ typedef struct wadfile_s FILE *handle; UINT32 filesize; // for network UINT8 md5sum[16]; + boolean important; // also network - !W_VerifyNMUSlumps } wadfile_t; #define WADFILENUM(lumpnum) (UINT16)((lumpnum)>>16) // wad flumpnum>>16) // wad file number in upper word