1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-09 12:42:11 +00:00
OpenMW/apps/openmw/mwmechanics/aisequence.hpp
Thomas 645d174a96 Merge remote-tracking branch 'upstream/master'
Conflicts:
	apps/openmw/mwmechanics/aisequence.hpp
2014-05-12 14:49:08 -04:00

98 lines
3.1 KiB
C++

#ifndef GAME_MWMECHANICS_AISEQUENCE_H
#define GAME_MWMECHANICS_AISEQUENCE_H
#include <list>
#include <components/esm/loadnpc.hpp>
namespace MWWorld
{
class Ptr;
}
namespace MWMechanics
{
class AiPackage;
/// \brief Sequence of AI-packages for a single actor
/** Each package will be run in succession for an actor until completed **/
class AiSequence
{
///AiPackages to run though
std::list<AiPackage *> mPackages;
///Finished with all AiPackages
bool mDone;
///Copy AiSequence
void copy (const AiSequence& sequence);
/// The type of AI package that ran last
int mLastAiPackage;
public:
///Default constructor
AiSequence();
/// Copy Constructor
AiSequence (const AiSequence& sequence);
/// Assignment operator
AiSequence& operator= (const AiSequence& sequence);
/// Destructor
virtual ~AiSequence();
/// Returns currently executing AiPackage type
/** \see enum AiPackage::TypeId **/
int getTypeId() const;
/// 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 **/
int getLastRunTypeId() const { return mLastAiPackage; }
/// Return true and assign target if combat package is currently active, return false otherwise
bool getCombatTarget (std::string &targetActorId) const;
/// Removes all combat packages until first non-combat or stack empty.
void stopCombat();
/// Removes all persue packages until first non-persue or stack empty.
void stopPersue();
/// Has a package been completed during the last update?
bool isPackageDone() const;
/// Removes all pursue packages until first non-pursue or stack empty.
void stopPursuit();
/// Execute current package, switching if needed.
void execute (const MWWorld::Ptr& actor,float duration);
/// Remove all packages.
void clear();
///< Add \a package to the front of the sequence
/** Suspends current package
@param actor The actor that owns this AiSequence **/
void stack (const AiPackage& package, const MWWorld::Ptr& actor);
/// Add \a package to the end of the sequence
/** Executed after all other packages have been completed **/
void queue (const AiPackage& package);
/// Return the current active package.
/** If there is no active package, it will throw an exception **/
AiPackage* getActivePackage();
/// Fills the AiSequence with packages
/** Typically used for loading from the ESM
\see ESM::AIPackageList **/
void fill (const ESM::AIPackageList& list);
};
}
#endif