1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-02-23 17:39:43 +00:00

Issue #314: added apply actions

This commit is contained in:
Marc Zinnschlag 2012-07-13 09:41:38 +02:00
parent 84d846cf07
commit 29b4a5e5f7
3 changed files with 71 additions and 1 deletions

View file

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

View 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);
}
}

View 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