Skip to content

Commit

Permalink
- autodetect .inis when loading Blood mods.
Browse files Browse the repository at this point in the history
This works as long as the loaded mods have one single .ini file in them - in that case it is assumed that it is supposed to replace blood.ini, which will allow dragging & dropping such archives without further user intervention.
  • Loading branch information
coelckers committed Apr 5, 2021
1 parent 5984fda commit bfcedc2
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions source/games/blood/src/levels.cpp
Expand Up @@ -115,6 +115,28 @@ void levelLoadMapInfo(IniFile *pIni, MapRecord *pLevelInfo, const char *pzSectio

static const char* DefFile(void)
{
int found = -1;
if (userConfig.DefaultCon.IsEmpty() || userConfig.DefaultCon.CompareNoCase("blood.ini") == 0)
{
int numlumps = fileSystem.GetNumEntries();
for (int i = numlumps - 1; i >= 0; i--)
{
if (fileSystem.GetFileContainer(i) <= fileSystem.GetMaxIwadNum()) break;
FString fn = fileSystem.GetFileFullName(i, false);
FString ext = fn.Right(4);
if (ext.CompareNoCase(".ini") == 0)
{
if (fileSystem.CheckNumForFullName(fn) != i) continue;
if (found == -1) found = i;
else
{
found = -1;
break;
}
}
}
}
if (found >= 0) return fileSystem.GetFileFullName(found);
// The command line parser stores this in the CON field.
return userConfig.DefaultCon.IsNotEmpty() ? userConfig.DefaultCon.GetChars() : "blood.ini";
}
Expand Down

0 comments on commit bfcedc2

Please sign in to comment.