From e35a5bac79778d1038b0de82f1687afdda3170aa Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 2 Nov 2019 20:37:15 +0100 Subject: [PATCH] - fixed: 0 is a valid resource ID for Blood. Unfortunately this means that looking up ID 0 can be a bit more costly than the rest because all ID-less entries in RFF files also use 0. For other file types -1 is used. --- source/common/filesystem/filesystem.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/common/filesystem/filesystem.cpp b/source/common/filesystem/filesystem.cpp index 68b27b65e..fba88997f 100644 --- a/source/common/filesystem/filesystem.cpp +++ b/source/common/filesystem/filesystem.cpp @@ -426,7 +426,7 @@ void FileSystem::InitHashChains (void) { hash = int(lump->LumpName[l]) % NumEntries; } - else if (l == (int)ELookupMode::IdWithType && lump->ResourceId > 0) + else if (l == (int)ELookupMode::IdWithType && lump->ResourceId >= 0) { hash = int(lump->ResourceId) % NumEntries; } @@ -449,7 +449,7 @@ void FileSystem::AddLump(FResourceLump *lump) { hash = int(lump->LumpName[l]) % NumEntries; } - else if (lump->ResourceId > 0) + else if (lump->ResourceId >= 0) { hash = int(lump->ResourceId) % NumEntries; } @@ -933,7 +933,7 @@ bool FileSystem::CreatePathlessCopy(const char *name, int id, int flags) FName fullname = oldlump->LumpName[FResourceLump::FullNameType]; // If the lump we are about to add already got the right properties, do nothing, aside from loading/locking as requested - if (filename == fullname && (id == 0 || id == oldlump->ResourceId)) + if (filename == fullname && (id == -1 || id == oldlump->ResourceId)) { if (flags & DICT_LOCK) oldlump->Lock(); else if (flags & DICT_LOAD) oldlump->Get();