OpenMW
|
Sequence of AI-packages for a single actor. More...
#include <aisequence.hpp>
Public Member Functions | |
AiSequence () | |
Default constructor. More... | |
AiSequence (const AiSequence &sequence) | |
Copy Constructor. More... | |
AiSequence & | operator= (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 |
std::list< AiPackage * > ::const_iterator | 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 | isInCombat () const |
Is there any combat package? 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, MWMechanics::AiState &state, float duration) |
Execute current package, switching if needed. More... | |
void | fastForward (const MWWorld::Ptr &actor, AiState &state) |
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) |
AiPackage * | getActivePackage () |
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... | |
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.
MWMechanics::AiSequence::AiSequence | ( | ) |
Default constructor.
MWMechanics::AiSequence::AiSequence | ( | const AiSequence & | sequence | ) |
Copy Constructor.
|
virtual |
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
|
private |
std::list< AiPackage * >::const_iterator MWMechanics::AiSequence::erase | ( | std::list< AiPackage * >::const_iterator | package | ) |
void MWMechanics::AiSequence::execute | ( | const MWWorld::Ptr & | actor, |
CharacterController & | characterController, | ||
MWMechanics::AiState & | state, | ||
float | duration | ||
) |
Execute current package, switching if needed.
void MWMechanics::AiSequence::fastForward | ( | const MWWorld::Ptr & | actor, |
AiState & | state | ||
) |
Simulate the passing of time using the currently active AI package.
void MWMechanics::AiSequence::fill | ( | const ESM::AIPackageList & | list | ) |
Fills the AiSequence with packages.
Typically used for loading from the ESM
AiPackage * MWMechanics::AiSequence::getActivePackage | ( | ) |
Return the current active package.
If there is no active package, it will throw an exception
bool MWMechanics::AiSequence::getCombatTarget | ( | MWWorld::Ptr & | targetActor | ) | const |
Return true and assign target if combat package is currently active, return false otherwise.
|
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.
int MWMechanics::AiSequence::getTypeId | ( | ) | const |
Returns currently executing AiPackage type.
bool MWMechanics::AiSequence::isInCombat | ( | ) | const |
Is there any combat package?
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?
AiSequence & MWMechanics::AiSequence::operator= | ( | const AiSequence & | sequence | ) |
Assignment operator.
void MWMechanics::AiSequence::readState | ( | const ESM::AiSequence::AiSequence & | sequence | ) |
void MWMechanics::AiSequence::stack | ( | const AiPackage & | package, |
const MWWorld::Ptr & | actor | ||
) |
Suspends current package
actor | The actor that owns this AiSequence |
void MWMechanics::AiSequence::stopCombat | ( | ) |
Removes all combat packages until first non-combat or stack empty.
void MWMechanics::AiSequence::stopPursuit | ( | ) |
Removes all pursue packages until first non-pursue or stack empty.
void MWMechanics::AiSequence::writeState | ( | ESM::AiSequence::AiSequence & | sequence | ) | const |
|
private |
Finished with top AIPackage, set for one frame.
|
private |
The type of AI package that ran last.
|
private |
Does this AI sequence repeat (repeating of Wander packages handled separately)