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;
|
|
|
|
|
|
|
|
/// \brief Sequence of AI-packages for a single actor
|
|
|
|
class AiSequence
|
|
|
|
{
|
|
|
|
std::list<AiPackage *> mPackages;
|
2013-09-25 16:01:36 +00:00
|
|
|
|
2012-09-04 11:25:53 +00:00
|
|
|
bool mDone;
|
|
|
|
|
|
|
|
void copy (const AiSequence& sequence);
|
|
|
|
|
2014-01-28 19:57:37 +00:00
|
|
|
// The type of AI package that ran last
|
|
|
|
int mLastAiPackage;
|
|
|
|
|
2012-09-04 11:25:53 +00:00
|
|
|
public:
|
|
|
|
|
|
|
|
AiSequence();
|
|
|
|
|
|
|
|
AiSequence (const AiSequence& sequence);
|
|
|
|
|
|
|
|
AiSequence& operator= (const AiSequence& sequence);
|
|
|
|
|
|
|
|
virtual ~AiSequence();
|
|
|
|
|
|
|
|
int getTypeId() const;
|
2014-01-07 00:12:37 +00:00
|
|
|
///< @see enum AiPackage::TypeId
|
|
|
|
|
2014-01-28 19:57:37 +00:00
|
|
|
int getLastRunTypeId() const { return mLastAiPackage; }
|
|
|
|
///< 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.
|
|
|
|
|
2014-01-07 00:12:37 +00:00
|
|
|
bool getCombatTarget (std::string &targetActorId) const;
|
|
|
|
///< Return true and assign target if combat package is currently
|
|
|
|
/// active, return false otherwise
|
|
|
|
|
|
|
|
void stopCombat();
|
|
|
|
///< Removes all combat packages until first non-combat or stack empty.
|
2014-04-02 04:18:22 +00:00
|
|
|
|
|
|
|
void stopPersue();
|
|
|
|
///< Removes all persue packages until first non-persue or stack empty.
|
2012-09-04 11:25:53 +00:00
|
|
|
|
|
|
|
bool isPackageDone() const;
|
|
|
|
///< Has a package been completed during the last update?
|
|
|
|
|
2013-10-30 19:42:50 +00:00
|
|
|
void execute (const MWWorld::Ptr& actor,float duration);
|
2012-09-04 11:25:53 +00:00
|
|
|
///< Execute package.
|
|
|
|
|
|
|
|
void clear();
|
|
|
|
///< Remove all packages.
|
2013-11-18 11:33:09 +00:00
|
|
|
|
2012-09-04 11:25:53 +00:00
|
|
|
void stack (const AiPackage& package);
|
|
|
|
///< Add \a package to the front of the sequence (suspends current package)
|
|
|
|
|
|
|
|
void queue (const AiPackage& package);
|
|
|
|
///< Add \a package to the end of the sequence (executed after all other packages have been
|
|
|
|
/// completed)
|
2013-07-30 22:55:08 +00:00
|
|
|
|
2014-01-12 13:01:54 +00:00
|
|
|
AiPackage* getActivePackage();
|
|
|
|
///< return the current active package. If there is no active package, throw an exeption
|
|
|
|
|
2013-07-30 22:55:08 +00:00
|
|
|
void fill (const ESM::AIPackageList& list);
|
2012-09-04 11:25:53 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|