Reverse iteration order of ValidateIWADs

Scenario:
- Using `-iwad` to explicitly use an IWAD outside of your search paths
- You have other, older versions hiding in your search paths
- You then change your IWADINFO's BannerColors, cue confusion

Because `IdentifyVersion` does search paths then -iwad, and `ValidateIWADs` iterates them in normal order, the file that gets to determine the IWAD startup settings is whatever file is found on the system instead of the file specifically requested.
This commit is contained in:
Sally Coolatta 2025-08-08 02:49:15 -04:00 committed by Ricardo Luís Vaz Silva
commit 4b55e7ad14

View file

@ -543,8 +543,16 @@ void FIWadManager::ValidateIWADs()
{
TArray<int> returns;
unsigned originalsize = mIWadInfos.Size();
for (auto &p : mFoundWads)
// Iterating normally will give CheckIWADInfo name conflicts priority to
// whatever file is found first, rather than the file that the user
// specifically requests with -iwad, because IdentifyVersion appends
// the -iwad file to the end of the list. (And it's annoying to change
// to be the other way around.)
for (int i = mFoundWads.SSize() - 1; i >= 0; i--)
{
auto &p = mFoundWads[i];
int index;
auto x = strrchr(p.mFullPath.GetChars(), '.');
if (x != nullptr && (!stricmp(x, ".iwad") || !stricmp(x, ".ipk3") || !stricmp(x, ".ipk7")))