- 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.
This commit is contained in:
Christoph Oelckers 2019-11-02 20:37:15 +01:00
parent dc9d75685e
commit e35a5bac79

View file

@ -426,7 +426,7 @@ void FileSystem::InitHashChains (void)
{ {
hash = int(lump->LumpName[l]) % NumEntries; 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; hash = int(lump->ResourceId) % NumEntries;
} }
@ -449,7 +449,7 @@ void FileSystem::AddLump(FResourceLump *lump)
{ {
hash = int(lump->LumpName[l]) % NumEntries; hash = int(lump->LumpName[l]) % NumEntries;
} }
else if (lump->ResourceId > 0) else if (lump->ResourceId >= 0)
{ {
hash = int(lump->ResourceId) % NumEntries; 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]; 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 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(); if (flags & DICT_LOCK) oldlump->Lock();
else if (flags & DICT_LOAD) oldlump->Get(); else if (flags & DICT_LOAD) oldlump->Get();