mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-23 08:09:42 +00:00
Issue #314: added apply actions
This commit is contained in:
parent
84d846cf07
commit
29b4a5e5f7
3 changed files with 71 additions and 1 deletions
|
@ -50,7 +50,7 @@ add_openmw_dir (mwworld
|
|||
refdata worldimp physicssystem scene globals class action nullaction actionteleport
|
||||
containerstore actiontalk actiontake manualref player cellfunctors
|
||||
cells localscripts customdata weather inventorystore ptr actionopen actionread
|
||||
actionequip timestamp actionalchemy cellstore
|
||||
actionequip timestamp actionalchemy cellstore actionapply
|
||||
)
|
||||
|
||||
add_openmw_dir (mwclass
|
||||
|
|
28
apps/openmw/mwworld/actionapply.cpp
Normal file
28
apps/openmw/mwworld/actionapply.cpp
Normal file
|
@ -0,0 +1,28 @@
|
|||
|
||||
#include "actionapply.hpp"
|
||||
|
||||
#include "class.hpp"
|
||||
|
||||
namespace MWWorld
|
||||
{
|
||||
ActionApply::ActionApply (const Ptr& target, const std::string& id, const Ptr& actor)
|
||||
: mTarget (target), mId (id), mActor (actor)
|
||||
{}
|
||||
|
||||
void ActionApply::execute()
|
||||
{
|
||||
MWWorld::Class::get (mTarget).apply (mTarget, mId, mActor);
|
||||
}
|
||||
|
||||
|
||||
ActionApplyWithSkill::ActionApplyWithSkill (const Ptr& target, const std::string& id,
|
||||
const Ptr& actor, int skillIndex, int usageType)
|
||||
: mTarget (target), mId (id), mActor (actor), mSkillIndex (skillIndex), mUsageType (usageType)
|
||||
{}
|
||||
|
||||
void ActionApplyWithSkill::execute()
|
||||
{
|
||||
if (MWWorld::Class::get (mTarget).apply (mTarget, mId, mActor))
|
||||
MWWorld::Class::get (mTarget).skillUsageSucceeded (mActor, mSkillIndex, mUsageType);
|
||||
}
|
||||
}
|
42
apps/openmw/mwworld/actionapply.hpp
Normal file
42
apps/openmw/mwworld/actionapply.hpp
Normal file
|
@ -0,0 +1,42 @@
|
|||
|
||||
#ifndef GAME_MWWORLD_ACTIONAPPLY_H
|
||||
#define GAME_MWWORLD_ACTIONAPPLY_H
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "action.hpp"
|
||||
#include "ptr.hpp"
|
||||
|
||||
namespace MWWorld
|
||||
{
|
||||
class ActionApply : public Action
|
||||
{
|
||||
Ptr mTarget;
|
||||
std::string mId;
|
||||
Ptr mActor;
|
||||
|
||||
public:
|
||||
|
||||
ActionApply (const Ptr& target, const std::string& id, const Ptr& actor);
|
||||
|
||||
virtual void execute();
|
||||
};
|
||||
|
||||
class ActionApplyWithSkill : public Action
|
||||
{
|
||||
Ptr mTarget;
|
||||
std::string mId;
|
||||
Ptr mActor;
|
||||
int mSkillIndex;
|
||||
int mUsageType;
|
||||
|
||||
public:
|
||||
|
||||
ActionApplyWithSkill (const Ptr& target, const std::string& id, const Ptr& actor,
|
||||
int skillIndex, int usageType);
|
||||
|
||||
virtual void execute();
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
Loading…
Reference in a new issue