mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-21 08:23:53 +00:00
Rename objectOpened() to make its role more clear
This commit is contained in:
parent
8317dc0709
commit
c89c14bb68
5 changed files with 8 additions and 9 deletions
|
@ -143,8 +143,8 @@ namespace MWBase
|
|||
/// @param container The container the item is in; may be empty for an item in the world
|
||||
virtual void itemTaken (const MWWorld::Ptr& ptr, const MWWorld::Ptr& item, const MWWorld::Ptr& container,
|
||||
int count, bool alarm = true) = 0;
|
||||
/// Utility to check if opening (i.e. unlocking) this object is illegal and calling commitCrime if so
|
||||
virtual void objectOpened (const MWWorld::Ptr& ptr, const MWWorld::Ptr& item) = 0;
|
||||
/// Utility to check if unlocking this object is illegal and calling commitCrime if so
|
||||
virtual void unlockAttempted (const MWWorld::Ptr& ptr, const MWWorld::Ptr& item) = 0;
|
||||
/// Attempt sleeping in a bed. If this is illegal, call commitCrime.
|
||||
/// @return was it illegal, and someone saw you doing it?
|
||||
virtual bool sleepInBed (const MWWorld::Ptr& ptr, const MWWorld::Ptr& bed) = 0;
|
||||
|
|
|
@ -1034,7 +1034,7 @@ namespace MWMechanics
|
|||
return false;
|
||||
}
|
||||
|
||||
void MechanicsManager::objectOpened(const MWWorld::Ptr &ptr, const MWWorld::Ptr &item)
|
||||
void MechanicsManager::unlockAttempted(const MWWorld::Ptr &ptr, const MWWorld::Ptr &item)
|
||||
{
|
||||
MWWorld::Ptr victim;
|
||||
if (isAllowedToUse(ptr, item, victim))
|
||||
|
|
|
@ -142,8 +142,8 @@ namespace MWMechanics
|
|||
/// @param container The container the item is in; may be empty for an item in the world
|
||||
virtual void itemTaken (const MWWorld::Ptr& ptr, const MWWorld::Ptr& item, const MWWorld::Ptr& container,
|
||||
int count, bool alarm = true) override;
|
||||
/// Utility to check if opening (i.e. unlocking) this object is illegal and calling commitCrime if so
|
||||
virtual void objectOpened (const MWWorld::Ptr& ptr, const MWWorld::Ptr& item) override;
|
||||
/// Utility to check if unlocking this object is illegal and calling commitCrime if so
|
||||
virtual void unlockAttempted (const MWWorld::Ptr& ptr, const MWWorld::Ptr& item) override;
|
||||
/// Attempt sleeping in a bed. If this is illegal, call commitCrime.
|
||||
/// @return was it illegal, and someone saw you doing it? Also returns fail when enemies are nearby
|
||||
virtual bool sleepInBed (const MWWorld::Ptr& ptr, const MWWorld::Ptr& bed) override;
|
||||
|
|
|
@ -59,7 +59,7 @@ namespace MWMechanics
|
|||
resultMessage = "#{sLockFail}";
|
||||
}
|
||||
|
||||
MWBase::Environment::get().getMechanicsManager()->objectOpened(mActor, lock);
|
||||
MWBase::Environment::get().getMechanicsManager()->unlockAttempted(mActor, lock);
|
||||
int uses = lockpick.getClass().getItemHealth(lockpick);
|
||||
--uses;
|
||||
lockpick.getCellRef().setCharge(uses);
|
||||
|
@ -101,7 +101,7 @@ namespace MWMechanics
|
|||
resultMessage = "#{sTrapFail}";
|
||||
}
|
||||
|
||||
MWBase::Environment::get().getMechanicsManager()->objectOpened(mActor, trap);
|
||||
MWBase::Environment::get().getMechanicsManager()->unlockAttempted(mActor, trap);
|
||||
int uses = probe.getClass().getItemHealth(probe);
|
||||
--uses;
|
||||
probe.getCellRef().setCharge(uses);
|
||||
|
|
|
@ -721,9 +721,8 @@ namespace MWMechanics
|
|||
else
|
||||
MWBase::Environment::get().getSoundManager()->playSound3D(target, "Open Lock Fail", 1.f, 1.f);
|
||||
|
||||
// Failed attempt is a crime too
|
||||
if (!caster.isEmpty())
|
||||
MWBase::Environment::get().getMechanicsManager()->objectOpened(getPlayer(), target);
|
||||
MWBase::Environment::get().getMechanicsManager()->unlockAttempted(getPlayer(), target);
|
||||
// Use the player instead of the caster for vanilla crime compatibility
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue