From 6f22eeac000cef485430efe394e5423b238553e7 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 4 Jun 2022 22:11:14 +0200 Subject: [PATCH] - added a few more names to the reserved names for main folder detection. Also consolidated the access into a single function to avoid indexing errors. --- src/d_iwad.cpp | 6 ++---- src/d_main.cpp | 18 +++++++++++------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/d_iwad.cpp b/src/d_iwad.cpp index 2d2e90b5f..69be94244 100644 --- a/src/d_iwad.cpp +++ b/src/d_iwad.cpp @@ -294,8 +294,7 @@ void FIWadManager::ParseIWadInfo(const char *fn, const char *data, int datasize, // Look for IWAD definition lump // //========================================================================== -extern const char* iwad_folders[14]; -extern const char* iwad_reserved[12]; +void GetReserved(LumpFilterInfo& lfi); FIWadManager::FIWadManager(const char *firstfn, const char *optfn) { @@ -382,8 +381,7 @@ int FIWadManager::CheckIWADInfo(const char* fn) FileSystem check; LumpFilterInfo lfi; - for (auto p : iwad_folders) lfi.reservedFolders.Push(p); - for (auto p : iwad_reserved) lfi.requiredPrefixes.Push(p); + GetReserved(lfi); TArray filenames; filenames.Push(fn); diff --git a/src/d_main.cpp b/src/d_main.cpp index ab5e5ef98..ab41db0b1 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -203,9 +203,9 @@ extern bool insave; extern TDeletingArray LightDefaults; extern FName MessageBoxClass; -const char* iwad_folders[] = { "flats/", "textures/", "hires/", "sprites/", "voxels/", "colormaps/", "acs/", "maps/", "voices/", "patches/", "graphics/", "sounds/", "music/", - "materials/", "models/", "fonts/"}; -const char* iwad_reserved[12] = { "mapinfo", "zmapinfo", "gameinfo", "sndinfo", "sbarinfo", "menudef", "gldefs", "animdefs", "decorate", "zscript", "iwadinfo", "maps/" }; +static const char* iwad_folders[] = { "flats/", "textures/", "hires/", "sprites/", "voxels/", "colormaps/", "acs/", "maps/", "voices/", "patches/", "graphics/", "sounds/", "music/", + "materials/", "models/", "fonts/", "brightmaps/"}; +static const char* iwad_reserved[] = { "mapinfo", "zmapinfo", "umapinfo", "gameinfo", "sndinfo", "sndseq", "sbarinfo", "menudef", "gldefs", "animdefs", "decorate", "zscript", "iwadinfo", "maps/" }; CUSTOM_CVAR(Float, i_timescale, 1.0f, CVAR_NOINITCALL | CVAR_VIRTUAL) @@ -1877,13 +1877,18 @@ static FString ParseGameInfo(TArray &pwads, const char *fn, const char return iwad; } +void GetReserved(LumpFilterInfo& lfi) +{ + for (auto p : iwad_folders) lfi.reservedFolders.Push(p); + for (auto p : iwad_reserved) lfi.requiredPrefixes.Push(p); +} + static FString CheckGameInfo(TArray & pwads) { FileSystem check; LumpFilterInfo lfi; - for (auto p : iwad_folders) lfi.reservedFolders.Push(p); - for (auto p : iwad_reserved) lfi.requiredPrefixes.Push(p); + GetReserved(lfi); // Open the entire list as a temporary file system and look for a GAMEINFO lump. The last one will automatically win. check.InitMultipleFiles(pwads, true, &lfi); @@ -3050,8 +3055,7 @@ static int D_InitGame(const FIWADInfo* iwad_info, TArray& allwads, TArr } lfi.gameTypeFilter.Push(FStringf("game-%s", GameTypeName())); - for (auto p : iwad_folders) lfi.reservedFolders.Push(p); - for (auto p : iwad_reserved) lfi.requiredPrefixes.Push(p); + GetReserved(lfi); lfi.postprocessFunc = [&]() {