- fixed: the file system's entry count was not updated before rehashing.

This broke Blood's RFS parser.
This commit is contained in:
Christoph Oelckers 2020-12-09 18:56:17 +01:00
parent b98e06cd20
commit 94d3d643d7

View file

@ -837,6 +837,7 @@ void FileSystem::InitHashChains (void)
{ {
unsigned int i, j; unsigned int i, j;
NumEntries = FileInfo.Size();
Hashes.Resize(8 * NumEntries); Hashes.Resize(8 * NumEntries);
// Mark all buckets as empty // Mark all buckets as empty
memset(Hashes.Data(), -1, Hashes.Size() * sizeof(Hashes[0])); memset(Hashes.Data(), -1, Hashes.Size() * sizeof(Hashes[0]));
@ -1522,10 +1523,11 @@ const char *FileSystem::GetResourceFileFullName (int rfnum) const noexcept
bool FileSystem::CreatePathlessCopy(const char *name, int id, int /*flags*/) bool FileSystem::CreatePathlessCopy(const char *name, int id, int /*flags*/)
{ {
FString name2, type2, path; FString name2=name, type2, path;
// The old code said 'filename' and ignored the path, this looked like a bug. // The old code said 'filename' and ignored the path, this looked like a bug.
auto lump = FindFile(name); FixPathSeperator(name2);
auto lump = FindFile(name2);
if (lump < 0) return false; // Does not exist. if (lump < 0) return false; // Does not exist.
auto oldlump = FileInfo[lump]; auto oldlump = FileInfo[lump];