Handle 0-use items like vanilla (bug #5611)

pull/593/head
Alexei Dobrohotov 4 years ago
parent acdf4cb5e3
commit e0a5c24afe

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

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

@ -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<ESM::Lockpick>()->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<ESM::Probe>()->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);
}

Loading…
Cancel
Save