Update lookup only after sorting files

pull/593/head
CedricMocquillon 4 years ago
parent 3920477618
commit b61249841e

@ -182,8 +182,6 @@ void BSAFile::readHeader()
if(fs.offset + fs.fileSize > fsize) if(fs.offset + fs.fileSize > fsize)
fail("Archive contains offsets outside itself"); fail("Archive contains offsets outside itself");
// Add the file name to the lookup
mLookup[fs.name()] = i;
} }
mStringBuf.resize(endOfNameBuffer); mStringBuf.resize(endOfNameBuffer);
@ -191,6 +189,13 @@ void BSAFile::readHeader()
return left.offset < right.offset; return left.offset < right.offset;
}); });
for (size_t i = 0; i < filenum; i++)
{
FileStruct& fs = mFiles[i];
// Add the file name to the lookup
mLookup[fs.name()] = i;
}
mIsLoaded = true; mIsLoaded = true;
} }

Loading…
Cancel
Save