From f6eeee3ad5810635b27a8f2df53cf7a499ecd1ff Mon Sep 17 00:00:00 2001 From: Evil Eye Date: Tue, 5 Oct 2021 21:48:47 +0200 Subject: [PATCH] Detect keys and enchanted items in containers without custom data --- CHANGELOG.md | 1 + apps/openmw/mwworld/worldimp.cpp | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 54ded2a9bf..b84dfd7e80 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -52,6 +52,7 @@ Bug #6302: Teleporting disabled actor breaks its disabled state Bug #6307: Pathfinding in Infidelities quest from Tribunal addon is broken Bug #6323: Wyrmhaven: Alboin doesn't follower the player character out of his house + Bug #6326: Detect Enchantment/Key should detect items in unresolved containers Feature #890: OpenMW-CS: Column filtering Feature #2554: Modifying an object triggers the instances table to scroll to the corresponding record Feature #2780: A way to see current OpenMW version in the console diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index 299cc8676b..5218dfe249 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -3420,7 +3420,29 @@ namespace MWWorld { // but ignore containers without resolved content if (isContainer && ptr.getRefData().getCustomData() == nullptr) + { + const auto& store = MWBase::Environment::get().getWorld()->getStore(); + for(const auto& containerItem : ptr.get()->mBase->mInventory.mList) + { + if(containerItem.mCount) + { + try + { + ManualRef ref(store, containerItem.mItem, containerItem.mCount); + if(needToAdd(ref.getPtr(), mDetector)) + { + mOut.push_back(ptr); + return true; + } + } + catch (const std::exception&) + { + // Ignore invalid item id + } + } + } return true; + } MWWorld::ContainerStore& store = ptr.getClass().getContainerStore(ptr); {