2012-09-04 11:25:53 +00:00
|
|
|
#ifndef GAME_MWMECHANICS_AISEQUENCE_H
|
|
|
|
#define GAME_MWMECHANICS_AISEQUENCE_H
|
|
|
|
|
|
|
|
#include <list>
|
|
|
|
|
2013-07-30 22:55:08 +00:00
|
|
|
#include <components/esm/loadnpc.hpp>
|
|
|
|
|
2012-09-04 11:25:53 +00:00
|
|
|
namespace MWWorld
|
|
|
|
{
|
|
|
|
class Ptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace MWMechanics
|
|
|
|
{
|
|
|
|
class AiPackage;
|
2014-04-30 03:40:59 +00:00
|
|
|
|
2012-09-04 11:25:53 +00:00
|
|
|
/// \brief Sequence of AI-packages for a single actor
|
2014-04-30 03:40:59 +00:00
|
|
|
/** Each package will be run in succession for an actor until completed **/
|
2012-09-04 11:25:53 +00:00
|
|
|
class AiSequence
|
|
|
|
{
|
2014-04-30 03:40:59 +00:00
|
|
|
///AiPackages to run though
|
2012-09-04 11:25:53 +00:00
|
|
|
std::list<AiPackage *> mPackages;
|
2013-09-25 16:01:36 +00:00
|
|
|
|
2014-04-30 03:40:59 +00:00
|
|
|
///Finished with all AiPackages
|
2012-09-04 11:25:53 +00:00
|
|
|
bool mDone;
|
|
|
|
|
2014-04-30 03:40:59 +00:00
|
|
|
///Copy AiSequence
|
2012-09-04 11:25:53 +00:00
|
|
|
void copy (const AiSequence& sequence);
|
|
|
|
|
2014-04-30 03:40:59 +00:00
|
|
|
/// The type of AI package that ran last
|
2014-01-28 19:57:37 +00:00
|
|
|
int mLastAiPackage;
|
|
|
|
|
2012-09-04 11:25:53 +00:00
|
|
|
public:
|
2014-04-30 03:40:59 +00:00
|
|
|
///Default constructor
|
2012-09-04 11:25:53 +00:00
|
|
|
AiSequence();
|
2014-04-30 03:40:59 +00:00
|
|
|
|
|
|
|
/// Copy Constructor
|
2012-09-04 11:25:53 +00:00
|
|
|
AiSequence (const AiSequence& sequence);
|
2014-04-30 03:40:59 +00:00
|
|
|
|
|
|
|
/// Assignment operator
|
2012-09-04 11:25:53 +00:00
|
|
|
AiSequence& operator= (const AiSequence& sequence);
|
2014-04-30 03:40:59 +00:00
|
|
|
|
|
|
|
/// Destructor
|
2012-09-04 11:25:53 +00:00
|
|
|
virtual ~AiSequence();
|
|
|
|
|
2014-04-30 03:40:59 +00:00
|
|
|
/// Returns currently executing AiPackage type
|
|
|
|
/** \see enum AiPackage::TypeId **/
|
2012-09-04 11:25:53 +00:00
|
|
|
int getTypeId() const;
|
2014-01-07 00:12:37 +00:00
|
|
|
|
2014-04-30 03:40:59 +00:00
|
|
|
/// Get the typeid of the Ai package that ran last
|
|
|
|
/** NOT the currently "active" Ai package that will be run in the next frame.
|
|
|
|
This difference is important when an Ai package has just finished and been removed.
|
|
|
|
\see enum AiPackage::TypeId **/
|
2014-01-28 19:57:37 +00:00
|
|
|
int getLastRunTypeId() const { return mLastAiPackage; }
|
|
|
|
|
2014-04-30 03:40:59 +00:00
|
|
|
/// Return true and assign target if combat package is currently active, return false otherwise
|
2014-01-07 00:12:37 +00:00
|
|
|
bool getCombatTarget (std::string &targetActorId) const;
|
|
|
|
|
2014-04-30 03:40:59 +00:00
|
|
|
/// Removes all combat packages until first non-combat or stack empty.
|
2014-01-07 00:12:37 +00:00
|
|
|
void stopCombat();
|
2014-04-02 04:18:22 +00:00
|
|
|
|
2014-04-30 03:40:59 +00:00
|
|
|
/// Removes all persue packages until first non-persue or stack empty.
|
2014-04-02 04:18:22 +00:00
|
|
|
void stopPersue();
|
2014-04-30 03:40:59 +00:00
|
|
|
|
|
|
|
/// Has a package been completed during the last update?
|
2012-09-04 11:25:53 +00:00
|
|
|
bool isPackageDone() const;
|
2014-04-30 03:40:59 +00:00
|
|
|
|
2014-05-04 06:06:43 +00:00
|
|
|
/// Removes all pursue packages until first non-pursue or stack empty.
|
|
|
|
void stopPursuit();
|
2014-05-12 18:49:08 +00:00
|
|
|
|
2014-04-30 03:40:59 +00:00
|
|
|
/// Execute current package, switching if needed.
|
2013-10-30 19:42:50 +00:00
|
|
|
void execute (const MWWorld::Ptr& actor,float duration);
|
2014-04-30 03:40:59 +00:00
|
|
|
|
|
|
|
/// Remove all packages.
|
2012-09-04 11:25:53 +00:00
|
|
|
void clear();
|
2013-11-18 11:33:09 +00:00
|
|
|
|
2014-04-30 03:40:59 +00:00
|
|
|
///< Add \a package to the front of the sequence
|
2014-05-12 18:49:08 +00:00
|
|
|
/** Suspends current package
|
|
|
|
@param actor The actor that owns this AiSequence **/
|
2014-04-29 07:09:51 +00:00
|
|
|
void stack (const AiPackage& package, const MWWorld::Ptr& actor);
|
2014-04-30 03:40:59 +00:00
|
|
|
|
|
|
|
/// Add \a package to the end of the sequence
|
|
|
|
/** Executed after all other packages have been completed **/
|
2012-09-04 11:25:53 +00:00
|
|
|
void queue (const AiPackage& package);
|
2013-07-30 22:55:08 +00:00
|
|
|
|
2014-04-30 03:40:59 +00:00
|
|
|
/// Return the current active package.
|
|
|
|
/** If there is no active package, it will throw an exception **/
|
2014-01-12 13:01:54 +00:00
|
|
|
AiPackage* getActivePackage();
|
|
|
|
|
2014-04-30 03:40:59 +00:00
|
|
|
/// Fills the AiSequence with packages
|
|
|
|
/** Typically used for loading from the ESM
|
|
|
|
\see ESM::AIPackageList **/
|
2013-07-30 22:55:08 +00:00
|
|
|
void fill (const ESM::AIPackageList& list);
|
2012-09-04 11:25:53 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|