OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
MWMechanics::AiSequence Class Reference

Sequence of AI-packages for a single actor. More...

#include <aisequence.hpp>

Collaboration diagram for MWMechanics::AiSequence:

Public Member Functions

 AiSequence ()
 Default constructor. More...
 
 AiSequence (const AiSequence &sequence)
 Copy Constructor. More...
 
AiSequenceoperator= (const AiSequence &sequence)
 Assignment operator. More...
 
virtual ~AiSequence ()
 
std::list< AiPackage * >
::const_iterator 
begin () const
 Iterator may be invalidated by any function calls other than begin() or end(). More...
 
std::list< AiPackage * >
::const_iterator 
end () const
 
void erase (std::list< AiPackage * >::const_iterator package)
 
int getTypeId () const
 Returns currently executing AiPackage type. More...
 
int getLastRunTypeId () const
 Get the typeid of the Ai package that ran last. More...
 
bool getCombatTarget (MWWorld::Ptr &targetActor) const
 Return true and assign target if combat package is currently active, return false otherwise. More...
 
bool getCombatTargets (std::vector< MWWorld::Ptr > &targetActors) const
 Return true and assign targets for all combat packages, or return false if there are no combat packages. More...
 
bool isInCombat () const
 Is there any combat package? More...
 
bool isEngagedWithActor () const
 Are we in combat with any other actor, who's also engaging us? More...
 
bool hasPackage (int typeId) const
 Does this AI sequence have the given package type? More...
 
bool isInCombat (const MWWorld::Ptr &actor) const
 Are we in combat with this particular actor? More...
 
bool canAddTarget (const ESM::Position &actorPos, float distToTarget) const
 Function assumes that actor can have only 1 target apart player. More...
 
void stopCombat ()
 Removes all combat packages until first non-combat or stack empty. More...
 
bool isPackageDone () const
 Has a package been completed during the last update? More...
 
void stopPursuit ()
 Removes all pursue packages until first non-pursue or stack empty. More...
 
void execute (const MWWorld::Ptr &actor, CharacterController &characterController, float duration)
 Execute current package, switching if needed. More...
 
void fastForward (const MWWorld::Ptr &actor)
 Simulate the passing of time using the currently active AI package. More...
 
void clear ()
 Remove all packages. More...
 
void stack (const AiPackage &package, const MWWorld::Ptr &actor, bool cancelOther=true)
 
AiPackagegetActivePackage ()
 Return the current active package. More...
 
void fill (const ESM::AIPackageList &list)
 Fills the AiSequence with packages. More...
 
void writeState (ESM::AiSequence::AiSequence &sequence) const
 
void readState (const ESM::AiSequence::AiSequence &sequence)
 

Private Member Functions

void copy (const AiSequence &sequence)
 Copy AiSequence. More...
 

Private Attributes

std::list< AiPackage * > mPackages
 AiPackages to run though. More...
 
bool mDone
 Finished with top AIPackage, set for one frame. More...
 
bool mRepeat
 Does this AI sequence repeat (repeating of Wander packages handled separately) More...
 
int mLastAiPackage
 The type of AI package that ran last. More...
 
AiState mAiState
 

Detailed Description

Sequence of AI-packages for a single actor.

The top-most AI package is run each frame. When completed, it is removed from the stack.

Constructor & Destructor Documentation

MWMechanics::AiSequence::AiSequence ( )

Default constructor.

MWMechanics::AiSequence::AiSequence ( const AiSequence sequence)

Copy Constructor.

Here is the call graph for this function:

MWMechanics::AiSequence::~AiSequence ( )
virtual

Here is the call graph for this function:

Member Function Documentation

std::list< AiPackage * >::const_iterator MWMechanics::AiSequence::begin ( ) const

Iterator may be invalidated by any function calls other than begin() or end().

Here is the caller graph for this function:

bool MWMechanics::AiSequence::canAddTarget ( const ESM::Position actorPos,
float  distToTarget 
) const

Function assumes that actor can have only 1 target apart player.

void MWMechanics::AiSequence::clear ( )

Remove all packages.

Add package to the front of the sequence

Here is the caller graph for this function:

void MWMechanics::AiSequence::copy ( const AiSequence sequence)
private

Copy AiSequence.

Here is the caller graph for this function:

std::list< AiPackage * >::const_iterator MWMechanics::AiSequence::end ( ) const

Here is the caller graph for this function:

void MWMechanics::AiSequence::erase ( std::list< AiPackage * >::const_iterator  package)

Here is the caller graph for this function:

void MWMechanics::AiSequence::execute ( const MWWorld::Ptr actor,
CharacterController characterController,
float  duration 
)

Execute current package, switching if needed.

Here is the call graph for this function:

Here is the caller graph for this function:

void MWMechanics::AiSequence::fastForward ( const MWWorld::Ptr actor)

Simulate the passing of time using the currently active AI package.

Here is the call graph for this function:

Here is the caller graph for this function:

void MWMechanics::AiSequence::fill ( const ESM::AIPackageList list)

Fills the AiSequence with packages.

Typically used for loading from the ESM

See Also
ESM::AIPackageList
AiPackage * MWMechanics::AiSequence::getActivePackage ( )

Return the current active package.

If there is no active package, it will throw an exception

Here is the caller graph for this function:

bool MWMechanics::AiSequence::getCombatTarget ( MWWorld::Ptr targetActor) const

Return true and assign target if combat package is currently active, return false otherwise.

Here is the call graph for this function:

Here is the caller graph for this function:

bool MWMechanics::AiSequence::getCombatTargets ( std::vector< MWWorld::Ptr > &  targetActors) const

Return true and assign targets for all combat packages, or return false if there are no combat packages.

Here is the caller graph for this function:

int MWMechanics::AiSequence::getLastRunTypeId ( ) const
inline

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 Also
enum AiPackage::TypeId

Here is the caller graph for this function:

int MWMechanics::AiSequence::getTypeId ( ) const

Returns currently executing AiPackage type.

See Also
enum AiPackage::TypeId

Here is the caller graph for this function:

bool MWMechanics::AiSequence::hasPackage ( int  typeId) const

Does this AI sequence have the given package type?

Here is the caller graph for this function:

bool MWMechanics::AiSequence::isEngagedWithActor ( ) const

Are we in combat with any other actor, who's also engaging us?

Here is the call graph for this function:

Here is the caller graph for this function:

bool MWMechanics::AiSequence::isInCombat ( ) const

Is there any combat package?

Here is the caller graph for this function:

bool MWMechanics::AiSequence::isInCombat ( const MWWorld::Ptr actor) const

Are we in combat with this particular actor?

bool MWMechanics::AiSequence::isPackageDone ( ) const

Has a package been completed during the last update?

Here is the caller graph for this function:

AiSequence & MWMechanics::AiSequence::operator= ( const AiSequence sequence)

Assignment operator.

Here is the call graph for this function:

void MWMechanics::AiSequence::readState ( const ESM::AiSequence::AiSequence sequence)

Here is the call graph for this function:

Here is the caller graph for this function:

void MWMechanics::AiSequence::stack ( const AiPackage package,
const MWWorld::Ptr actor,
bool  cancelOther = true 
)

Suspends current package

Parameters
actorThe actor that owns this AiSequence

Here is the call graph for this function:

Here is the caller graph for this function:

void MWMechanics::AiSequence::stopCombat ( )

Removes all combat packages until first non-combat or stack empty.

Here is the caller graph for this function:

void MWMechanics::AiSequence::stopPursuit ( )

Removes all pursue packages until first non-pursue or stack empty.

Here is the caller graph for this function:

void MWMechanics::AiSequence::writeState ( ESM::AiSequence::AiSequence sequence) const

Here is the caller graph for this function:

Member Data Documentation

AiState MWMechanics::AiSequence::mAiState
private
bool MWMechanics::AiSequence::mDone
private

Finished with top AIPackage, set for one frame.

int MWMechanics::AiSequence::mLastAiPackage
private

The type of AI package that ran last.

std::list<AiPackage *> MWMechanics::AiSequence::mPackages
private

AiPackages to run though.

bool MWMechanics::AiSequence::mRepeat
private

Does this AI sequence repeat (repeating of Wander packages handled separately)


The documentation for this class was generated from the following files: