diff --git a/apps/openmw/mwscript/globalscripts.cpp b/apps/openmw/mwscript/globalscripts.cpp index 6900aea7f7..69806870c0 100644 --- a/apps/openmw/mwscript/globalscripts.cpp +++ b/apps/openmw/mwscript/globalscripts.cpp @@ -26,13 +26,13 @@ namespace script.mRunning = false; if (!ptr.isEmpty()) { - if (ptr.getCellRef().hasContentFile()) + if (MWBase::Environment::get().getWorld()->getPlayerPtr() == ptr) + script.mTargetId = ptr.getCellRef().getRefId(); + else if (ptr.getCellRef().getRefNum().isSet()) { script.mTargetId = ptr.getCellRef().getRefId(); script.mTargetRef = ptr.getCellRef().getRefNum(); } - else if (MWBase::Environment::get().getWorld()->getPlayerPtr() == ptr) - script.mTargetId = ptr.getCellRef().getRefId(); } return script; } @@ -60,7 +60,7 @@ namespace MWWorld::Ptr operator()(const std::pair& pair) const { - if (pair.first.hasContentFile()) + if (pair.first.isSet()) return MWBase::Environment::get().getWorldModel()->getPtr(pair.first); else if (pair.second.empty()) return MWWorld::Ptr();