1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-03-03 12:39:41 +00:00

Merge branch 'dropit' into 'master'

Drop empty stacks that aren't overriding anything

See merge request OpenMW/openmw!3268
This commit is contained in:
psi29a 2023-07-24 09:11:08 +00:00
commit 7ead12e103

View file

@ -277,15 +277,16 @@ namespace
return; return;
} }
// Note: we preserve RefNum when picking up or dropping an item. So if this RefNum is not found // Note: we preserve RefNum when picking up or dropping an item. This includes non-carriable lights 'picked
// in this cell in content files, it doesn't mean that the instance is invalid. // up' through Lua. So if this RefNum is not found in this cell in content files, it doesn't mean that the
// But non-storable item are always stored in saves together with their original cell. // instance is invalid. But non-storable item are always stored in saves together with their original cell.
// If a non-storable item references a content file, but is not found in this content file, // If a non-storable item references a content file, but is not found in this content file,
// we should drop it. // we should drop it. Likewise if this stack is empty.
if (!MWWorld::ContainerStore::isStorableType<T>()) if (!MWWorld::ContainerStore::isStorableType<T>() || !state.mCount)
{ {
Log(Debug::Warning) << "Warning: Dropping reference to " << state.mRef.mRefID if (state.mCount)
<< " (invalid content file link)"; Log(Debug::Warning) << "Warning: Dropping reference to " << state.mRef.mRefID
<< " (invalid content file link)";
return; return;
} }
} }