diff --git a/CHANGELOG.md b/CHANGELOG.md index dfb6532f3..7259bd1b8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -47,6 +47,7 @@ Bug #5539: Window resize breaks when going from a lower resolution to full screen resolution Bug #5548: Certain exhausted topics can be highlighted again even though there's no new dialogue Bug #5557: Diagonal movement is noticeably slower with analogue stick + Bug #5611: Usable items with "0 Uses" should be used only once Feature #390: 3rd person look "over the shoulder" Feature #2386: Distant Statics in the form of Object Paging Feature #5297: Add a search function to the "Datafiles" tab of the OpenMW launcher diff --git a/apps/openmw/mwmechanics/repair.cpp b/apps/openmw/mwmechanics/repair.cpp index 389d00d85..81886ed9b 100644 --- a/apps/openmw/mwmechanics/repair.cpp +++ b/apps/openmw/mwmechanics/repair.cpp @@ -27,7 +27,8 @@ void Repair::repair(const MWWorld::Ptr &itemToRepair) // reduce number of uses left int uses = mTool.getClass().getItemHealth(mTool); - mTool.getCellRef().setCharge(uses-1); + uses -= std::min(uses, 1); + mTool.getCellRef().setCharge(uses); MWMechanics::CreatureStats& stats = player.getClass().getCreatureStats(player); diff --git a/apps/openmw/mwmechanics/security.cpp b/apps/openmw/mwmechanics/security.cpp index 001375feb..5b79d821c 100644 --- a/apps/openmw/mwmechanics/security.cpp +++ b/apps/openmw/mwmechanics/security.cpp @@ -33,6 +33,10 @@ namespace MWMechanics !lock.getClass().hasToolTip(lock)) //If it's unlocked or can not be unlocked back out immediately return; + int uses = lockpick.getClass().getItemHealth(lockpick); + if (uses == 0) + return; + int lockStrength = lock.getCellRef().getLockLevel(); float pickQuality = lockpick.get()->mBase->mData.mQuality; @@ -61,9 +65,7 @@ namespace MWMechanics resultMessage = "#{sLockFail}"; } - int uses = lockpick.getClass().getItemHealth(lockpick); - --uses; - lockpick.getCellRef().setCharge(uses); + lockpick.getCellRef().setCharge(uses-1); if (!uses) lockpick.getContainerStore()->remove(lockpick, 1, mActor); } @@ -71,7 +73,11 @@ namespace MWMechanics void Security::probeTrap(const MWWorld::Ptr &trap, const MWWorld::Ptr &probe, std::string& resultMessage, std::string& resultSound) { - if (trap.getCellRef().getTrap() == "") + if (trap.getCellRef().getTrap().empty()) + return; + + int uses = probe.getClass().getItemHealth(probe); + if (uses == 0) return; float probeQuality = probe.get()->mBase->mData.mQuality; @@ -104,9 +110,7 @@ namespace MWMechanics resultMessage = "#{sTrapFail}"; } - int uses = probe.getClass().getItemHealth(probe); - --uses; - probe.getCellRef().setCharge(uses); + probe.getCellRef().setCharge(uses-1); if (!uses) probe.getContainerStore()->remove(probe, 1, mActor); }