From 24c1909d5222921f1b932837f4487ad277605e43 Mon Sep 17 00:00:00 2001 From: Evil Eye Date: Sun, 11 Jun 2023 09:43:42 +0200 Subject: [PATCH] Don't unlock unlocked objects now that unlock is no longer idempotent --- apps/openmw/mwmechanics/spelleffects.cpp | 2 +- apps/openmw/mwscript/miscextensions.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/openmw/mwmechanics/spelleffects.cpp b/apps/openmw/mwmechanics/spelleffects.cpp index 6293242709..44729044a5 100644 --- a/apps/openmw/mwmechanics/spelleffects.cpp +++ b/apps/openmw/mwmechanics/spelleffects.cpp @@ -954,8 +954,8 @@ namespace MWMechanics if (caster == getPlayer()) MWBase::Environment::get().getWindowManager()->messageBox("#{sMagicOpenSuccess}"); + target.getCellRef().unlock(); } - target.getCellRef().unlock(); } else { diff --git a/apps/openmw/mwscript/miscextensions.cpp b/apps/openmw/mwscript/miscextensions.cpp index cd07a34575..43da00afe3 100644 --- a/apps/openmw/mwscript/miscextensions.cpp +++ b/apps/openmw/mwscript/miscextensions.cpp @@ -366,8 +366,8 @@ namespace MWScript void execute(Interpreter::Runtime& runtime) override { MWWorld::Ptr ptr = R()(runtime); - - ptr.getCellRef().unlock(); + if (ptr.getCellRef().isLocked()) + ptr.getCellRef().unlock(); } };