diff --git a/apps/openmw/mwclass/container.cpp b/apps/openmw/mwclass/container.cpp index 55d2689f8..1a5cd354d 100644 --- a/apps/openmw/mwclass/container.cpp +++ b/apps/openmw/mwclass/container.cpp @@ -89,6 +89,10 @@ namespace MWClass ptr.get(); if (ref->mBase->mFlags & ESM::Container::Respawn) { + // Container was not touched, there is no need to modify its content. + if (ptr.getRefData().getCustomData() == nullptr) + return; + MWBase::Environment::get().getWorld()->removeContainerScripts(ptr); ptr.getRefData().setCustomData(nullptr); } diff --git a/apps/openmw/mwrender/animation.cpp b/apps/openmw/mwrender/animation.cpp index 8537060f6..2de39aee4 100644 --- a/apps/openmw/mwrender/animation.cpp +++ b/apps/openmw/mwrender/animation.cpp @@ -1990,9 +1990,7 @@ namespace MWRender mObjectRoot->accept(visitor); } - if (ptr.getTypeName() == typeid(ESM::Container).name() && - SceneUtil::hasUserDescription(mObjectRoot, Constants::HerbalismLabel) && - ptr.getRefData().getCustomData() != nullptr) + if (ptr.getRefData().getCustomData() != nullptr && canBeHarvested()) { const MWWorld::ContainerStore& store = ptr.getClass().getContainerStore(ptr); if (!store.hasVisibleItems()) diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index 1aac737c3..cd03137d7 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -3335,9 +3335,13 @@ namespace MWWorld return true; // Consider references inside containers as well (except if we are looking for a Creature, they cannot be in containers) - if (mType != World::Detect_Creature && - (ptr.getClass().isActor() || ptr.getClass().getTypeName() == typeid(ESM::Container).name())) + bool isContainer = ptr.getClass().getTypeName() == typeid(ESM::Container).name(); + if (mType != World::Detect_Creature && (ptr.getClass().isActor() || isContainer)) { + // but ignore containers without resolved content + if (isContainer && ptr.getRefData().getCustomData() == nullptr) + return true; + MWWorld::ContainerStore& store = ptr.getClass().getContainerStore(ptr); { for (MWWorld::ContainerStoreIterator it = store.begin(); it != store.end(); ++it)