1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-21 08:23:53 +00:00

Ignore containers without resolved content for Detect spells

This commit is contained in:
Andrei Kortunov 2019-05-04 14:09:52 +04:00
parent 29cfd2c583
commit c91d1e7394

View file

@ -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)