From 4a6d2cbaff17a27a0eac0676804db1a56ecf80b9 Mon Sep 17 00:00:00 2001 From: Andrei Kortunov Date: Mon, 16 Sep 2019 14:18:41 +0400 Subject: [PATCH] Do not allow player to take items from evidence chests (bug #3609) --- CHANGELOG.md | 1 + apps/openmw/mwclass/container.cpp | 6 ++++-- apps/openmw/mwmechanics/mechanicsmanagerimp.cpp | 5 +++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dbd44a9cf..1422eee75 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ Bug #3109: SetPos/Position handles actors differently Bug #3282: Unintended behaviour when assigning F3 and Windows keys Bug #3550: Companion from mod attacks the air after combat has ended + Bug #3609: Items from evidence chest are not considered to be stolen if player is allowed to use the chest Bug #3623: Display scaling breaks mouse recognition Bug #3725: Using script function in a non-conditional expression breaks script compilation Bug #3733: Normal maps are inverted on mirrored UVs diff --git a/apps/openmw/mwclass/container.cpp b/apps/openmw/mwclass/container.cpp index 958f8351e..243b6ce11 100644 --- a/apps/openmw/mwclass/container.cpp +++ b/apps/openmw/mwclass/container.cpp @@ -275,9 +275,11 @@ namespace MWClass if (ptr.getCellRef().getTrap() != "") text += "\n#{sTrapped}"; - if (MWBase::Environment::get().getWindowManager()->getFullHelp()) { - text += MWGui::ToolTips::getCellRefString(ptr.getCellRef()); + if (MWBase::Environment::get().getWindowManager()->getFullHelp()) + { text += MWGui::ToolTips::getCellRefString(ptr.getCellRef()); text += MWGui::ToolTips::getMiscString(ref->mBase->mScript, "Script"); + if (Misc::StringUtils::ciEqual(ptr.getCellRef().getRefId(), "stolen_goods")) + text += "\nYou can not use evidence chests"; } info.text = text; diff --git a/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp b/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp index d450c014c..6a35224bc 100644 --- a/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp +++ b/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp @@ -950,6 +950,7 @@ namespace MWMechanics return true; const MWWorld::CellRef& cellref = target.getCellRef(); + // there is no harm to use unlocked doors int lockLevel = cellref.getLockLevel(); if (target.getClass().isDoor() && @@ -1005,6 +1006,10 @@ namespace MWMechanics if (!cellref.getOwner().empty()) victim = MWBase::Environment::get().getWorld()->searchPtr(cellref.getOwner(), true, false); + // A special case for evidence chest - we should not allow to take items even if it is technically permitted + if (Misc::StringUtils::ciEqual(cellref.getRefId(), "stolen_goods")) + return false; + return (!isOwned && !isFactionOwned); }