2010-08-03 18:20:15 +02:00
|
|
|
#ifndef GAME_MWWORLD_ACTION_H
|
|
|
|
#define GAME_MWWORLD_ACTION_H
|
|
|
|
|
2012-07-27 12:19:25 +02:00
|
|
|
#include <string>
|
2022-08-14 14:39:58 +02:00
|
|
|
#include <string_view>
|
2012-07-27 12:19:25 +02:00
|
|
|
|
2012-09-04 15:14:33 +02:00
|
|
|
#include "ptr.hpp"
|
|
|
|
|
2010-08-03 18:20:15 +02:00
|
|
|
namespace MWWorld
|
|
|
|
{
|
|
|
|
/// \brief Abstract base for actions
|
|
|
|
class Action
|
|
|
|
{
|
2012-07-27 12:19:25 +02:00
|
|
|
std::string mSoundId;
|
2012-09-04 20:56:28 +02:00
|
|
|
bool mKeepSound;
|
2013-07-26 18:43:06 +02:00
|
|
|
float mSoundOffset;
|
2012-09-04 15:14:33 +02:00
|
|
|
Ptr mTarget;
|
2012-07-27 12:19:25 +02:00
|
|
|
|
2010-08-03 18:20:15 +02:00
|
|
|
// not implemented
|
|
|
|
Action(const Action& action);
|
|
|
|
Action& operator=(const Action& action);
|
|
|
|
|
2012-07-27 12:00:10 +02:00
|
|
|
virtual void executeImp(const Ptr& actor) = 0;
|
|
|
|
|
2012-09-04 15:14:33 +02:00
|
|
|
protected:
|
2017-01-18 21:57:50 +01:00
|
|
|
void setTarget(const Ptr&);
|
2012-09-04 15:14:33 +02:00
|
|
|
|
2022-09-22 21:26:05 +03:00
|
|
|
public:
|
2017-01-18 21:57:50 +01:00
|
|
|
const Ptr& getTarget() const;
|
2012-09-04 15:14:33 +02:00
|
|
|
|
|
|
|
Action(bool keepSound = false, const Ptr& target = Ptr());
|
2012-09-04 20:56:28 +02:00
|
|
|
///< \param keepSound Keep playing the sound even if the object the sound is played on is removed.
|
2010-08-03 18:20:15 +02:00
|
|
|
|
2017-01-18 21:57:50 +01:00
|
|
|
virtual ~Action();
|
|
|
|
|
2012-09-04 20:56:28 +02:00
|
|
|
virtual bool isNullAction() { return false; }
|
|
|
|
///< Is running this action a no-op? (default false)
|
2010-08-03 18:20:15 +02:00
|
|
|
|
2012-07-27 12:00:10 +02:00
|
|
|
void execute(const Ptr& actor, bool noSound = false);
|
2010-08-03 18:20:15 +02:00
|
|
|
|
2022-08-14 14:39:58 +02:00
|
|
|
void setSound(std::string_view id);
|
2013-07-26 18:43:06 +02:00
|
|
|
void setSoundOffset(float offset);
|
2010-08-03 18:20:15 +02:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|