- add duplication checking to file list, prevent loading the same file twice unless explicitly asked by the user

This commit is contained in:
Rachael Alexanderson 2022-02-17 01:05:30 -05:00
parent 590f45441f
commit 28d9fe68ae

View file

@ -216,6 +216,19 @@ void FileSystem::InitMultipleFiles (TArray<FString> &filenames, bool quiet, Lump
DeleteAll(); DeleteAll();
numfiles = 0; numfiles = 0;
// first, check for duplicates
if (!Args->CheckParm("-allowduplicates"))
{
for (unsigned i=0;i<filenames.Size(); i++)
{
for (unsigned j=i+1;j<filenames.Size(); j++)
{
if (strcmp(filenames[i], filenames[j]) == 0)
filenames.Delete(j);
}
}
}
for(unsigned i=0;i<filenames.Size(); i++) for(unsigned i=0;i<filenames.Size(); i++)
{ {
AddFile (filenames[i], nullptr, quiet, filter); AddFile (filenames[i], nullptr, quiet, filter);