forked from teamnwah/openmw-tes3coop
Issue #314: potion usage
This commit is contained in:
parent
182017b8e9
commit
782d417d5b
2 changed files with 15 additions and 0 deletions
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include "../mwworld/ptr.hpp"
|
||||
#include "../mwworld/actiontake.hpp"
|
||||
#include "../mwworld/actionapply.hpp"
|
||||
#include "../mwworld/cellstore.hpp"
|
||||
#include "../mwworld/physicssystem.hpp"
|
||||
|
||||
|
@ -144,4 +145,15 @@ namespace MWClass
|
|||
|
||||
return info;
|
||||
}
|
||||
|
||||
boost::shared_ptr<MWWorld::Action> Potion::use (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::Potion> *ref =
|
||||
ptr.get<ESM::Potion>();
|
||||
|
||||
ptr.getRefData().setCount (ptr.getRefData().getCount()-1);
|
||||
|
||||
return boost::shared_ptr<MWWorld::Action> (
|
||||
new MWWorld::ActionApply (ptr, ref->base->mId, ptr));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,6 +34,9 @@ namespace MWClass
|
|||
virtual int getValue (const MWWorld::Ptr& ptr) const;
|
||||
///< Return trade value of the object. Throws an exception, if the object can't be traded.
|
||||
|
||||
virtual boost::shared_ptr<MWWorld::Action> use (const MWWorld::Ptr& ptr) const;
|
||||
///< Generate action for using via inventory menu
|
||||
|
||||
static void registerSelf();
|
||||
|
||||
virtual std::string getUpSoundId (const MWWorld::Ptr& ptr) const;
|
||||
|
|
Loading…
Reference in a new issue