From c80574299dfdbd179a7ee01437ef1db4efa3fd9a Mon Sep 17 00:00:00 2001 From: Evil Eye Date: Sun, 23 Jul 2023 14:51:58 +0200 Subject: [PATCH] Drop non-carriable lights and empty stacks that aren't overriding anything --- apps/openmw/mwworld/cellstore.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/apps/openmw/mwworld/cellstore.cpp b/apps/openmw/mwworld/cellstore.cpp index d31669e91a..a360ab6314 100644 --- a/apps/openmw/mwworld/cellstore.cpp +++ b/apps/openmw/mwworld/cellstore.cpp @@ -277,15 +277,16 @@ namespace return; } - // Note: we preserve RefNum when picking up or dropping an item. So if this RefNum is not found - // in this cell in content files, it doesn't mean that the instance is invalid. - // But non-storable item are always stored in saves together with their original cell. + // Note: we preserve RefNum when picking up or dropping an item. This includes non-carriable lights 'picked + // up' through Lua. So if this RefNum is not found in this cell in content files, it doesn't mean that the + // 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, - // we should drop it. - if (!MWWorld::ContainerStore::isStorableType()) + // we should drop it. Likewise if this stack is empty. + if (!MWWorld::ContainerStore::isStorableType() || !state.mCount) { - Log(Debug::Warning) << "Warning: Dropping reference to " << state.mRef.mRefID - << " (invalid content file link)"; + if (state.mCount) + Log(Debug::Warning) << "Warning: Dropping reference to " << state.mRef.mRefID + << " (invalid content file link)"; return; } }