- 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.
This commit is contained in:
Christoph Oelckers 2022-06-04 22:11:14 +02:00
parent 3c96f7e21c
commit 6f22eeac00
2 changed files with 13 additions and 11 deletions

View file

@ -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<FString> filenames;
filenames.Push(fn);

View file

@ -203,9 +203,9 @@ extern bool insave;
extern TDeletingArray<FLightDefaults *> 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<FString> &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<FString> & 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<FString>& 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 = [&]()
{