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

#include <actors.hpp>

Collaboration diagram for MWMechanics::Actors:

Public Types

typedef std::map< MWWorld::Ptr,
Actor * > 
PtrActorMap
 

Public Member Functions

 Actors ()
 
 ~Actors ()
 
PtrActorMap::const_iterator begin ()
 
PtrActorMap::const_iterator end ()
 
void updateMagicEffects (const MWWorld::Ptr &ptr)
 
void addActor (const MWWorld::Ptr &ptr, bool updateImmediately=false)
 
void removeActor (const MWWorld::Ptr &ptr)
 
void updateActor (const MWWorld::Ptr &old, const MWWorld::Ptr &ptr)
 Updates an actor with a new Ptr. More...
 
void dropActors (const MWWorld::CellStore *cellStore, const MWWorld::Ptr &ignore)
 Deregister all actors (except for ignore) in the given cell. More...
 
void update (float duration, bool paused)
 Update actor stats and store desired velocity vectors in movement. More...
 
void updateActor (const MWWorld::Ptr &ptr, float duration)
 
void engageCombat (const MWWorld::Ptr &actor1, const MWWorld::Ptr &actor2, bool againstPlayer)
 
void updateHeadTracking (const MWWorld::Ptr &actor, const MWWorld::Ptr &targetActor, MWWorld::Ptr &headTrackTarget, float &sqrHeadTrackDistance)
 
void rest (bool sleep)
 Update actors while the player is waiting or sleeping. This should be called every hour. More...
 
void restoreDynamicStats (const MWWorld::Ptr &actor, bool sleep)
 
int getHoursToRest (const MWWorld::Ptr &ptr) const
 Calculate how many hours the given actor needs to rest in order to be fully healed. More...
 
void fastForwardAi ()
 Simulate the passing of time. More...
 
int countDeaths (const std::string &id) const
 Return the number of deaths for actors with the given ID. More...
 
void forceStateUpdate (const MWWorld::Ptr &ptr)
 
bool playAnimationGroup (const MWWorld::Ptr &ptr, const std::string &groupName, int mode, int number, bool persist=false)
 
void skipAnimation (const MWWorld::Ptr &ptr)
 
bool checkAnimationPlaying (const MWWorld::Ptr &ptr, const std::string &groupName)
 
void persistAnimationStates ()
 
void getObjectsInRange (const osg::Vec3f &position, float radius, std::vector< MWWorld::Ptr > &out)
 
void cleanupSummonedCreature (CreatureStats &casterStats, int creatureActorId)
 
std::list< MWWorld::PtrgetActorsSidingWith (const MWWorld::Ptr &actor)
 Returns the list of actors which are siding with the given actor in fights. More...
 
std::list< MWWorld::PtrgetActorsFollowing (const MWWorld::Ptr &actor)
 
void getActorsFollowing (const MWWorld::Ptr &actor, std::set< MWWorld::Ptr > &out)
 Recursive version of getActorsFollowing. More...
 
void getActorsSidingWith (const MWWorld::Ptr &actor, std::set< MWWorld::Ptr > &out)
 Recursive version of getActorsSidingWith. More...
 
std::list< intgetActorsFollowingIndices (const MWWorld::Ptr &actor)
 Get the list of AiFollow::mFollowIndex for all actors following this target. More...
 
std::list< MWWorld::PtrgetActorsFighting (const MWWorld::Ptr &actor)
 Returns the list of actors which are fighting the given actor. More...
 
std::list< MWWorld::PtrgetEnemiesNearby (const MWWorld::Ptr &actor)
 Unlike getActorsFighting, also returns actors that would fight the given actor if they saw him. More...
 
void write (ESM::ESMWriter &writer, Loading::Listener &listener) const
 
void readRecord (ESM::ESMReader &reader, uint32_t type)
 
void clear ()
 
bool isReadyToBlock (const MWWorld::Ptr &ptr) const
 

Private Member Functions

void updateNpc (const MWWorld::Ptr &ptr, float duration)
 
void adjustMagicEffects (const MWWorld::Ptr &creature)
 
void calculateDynamicStats (const MWWorld::Ptr &ptr)
 
void calculateCreatureStatModifiers (const MWWorld::Ptr &ptr, float duration)
 
void calculateNpcStatModifiers (const MWWorld::Ptr &ptr, float duration)
 
void calculateRestoration (const MWWorld::Ptr &ptr, float duration)
 
void updateDrowning (const MWWorld::Ptr &ptr, float duration)
 
void updateEquippedLight (const MWWorld::Ptr &ptr, float duration)
 
void updateCrimePersuit (const MWWorld::Ptr &ptr, float duration)
 
void killDeadActors ()
 
void purgeSpellEffects (int casterActorId)
 

Private Attributes

std::map< std::string, intmDeathCount
 
PtrActorMap mActors
 

Member Typedef Documentation

Constructor & Destructor Documentation

MWMechanics::Actors::Actors ( )
MWMechanics::Actors::~Actors ( )

Here is the call graph for this function:

Member Function Documentation

void MWMechanics::Actors::addActor ( const MWWorld::Ptr ptr,
bool  updateImmediately = false 
)

Register an actor for stats management

Note
Dead actors are ignored.

Here is the call graph for this function:

Here is the caller graph for this function:

void MWMechanics::Actors::adjustMagicEffects ( const MWWorld::Ptr creature)
private

Here is the call graph for this function:

Here is the caller graph for this function:

PtrActorMap::const_iterator MWMechanics::Actors::begin ( )
inline

Here is the caller graph for this function:

void MWMechanics::Actors::calculateCreatureStatModifiers ( const MWWorld::Ptr ptr,
float  duration 
)
private

Here is the caller graph for this function:

void MWMechanics::Actors::calculateDynamicStats ( const MWWorld::Ptr ptr)
private

Here is the call graph for this function:

Here is the caller graph for this function:

void MWMechanics::Actors::calculateNpcStatModifiers ( const MWWorld::Ptr ptr,
float  duration 
)
private

Here is the call graph for this function:

Here is the caller graph for this function:

void MWMechanics::Actors::calculateRestoration ( const MWWorld::Ptr ptr,
float  duration 
)
private

Here is the call graph for this function:

Here is the caller graph for this function:

bool MWMechanics::Actors::checkAnimationPlaying ( const MWWorld::Ptr ptr,
const std::string &  groupName 
)

Here is the caller graph for this function:

void MWMechanics::Actors::cleanupSummonedCreature ( MWMechanics::CreatureStats casterStats,
int  creatureActorId 
)

Here is the call graph for this function:

Here is the caller graph for this function:

void MWMechanics::Actors::clear ( )

Here is the caller graph for this function:

int MWMechanics::Actors::countDeaths ( const std::string &  id) const

Return the number of deaths for actors with the given ID.

Here is the caller graph for this function:

void MWMechanics::Actors::dropActors ( const MWWorld::CellStore cellStore,
const MWWorld::Ptr ignore 
)

Deregister all actors (except for ignore) in the given cell.

Here is the caller graph for this function:

PtrActorMap::const_iterator MWMechanics::Actors::end ( )
inline

Here is the caller graph for this function:

void MWMechanics::Actors::engageCombat ( const MWWorld::Ptr actor1,
const MWWorld::Ptr actor2,
bool  againstPlayer 
)

Start combat between two actors : If againstPlayer = true then actor2 should be the Player. If one of the combatants is creature it should be actor1.

Here is the call graph for this function:

Here is the caller graph for this function:

void MWMechanics::Actors::fastForwardAi ( )

Simulate the passing of time.

Here is the call graph for this function:

Here is the caller graph for this function:

void MWMechanics::Actors::forceStateUpdate ( const MWWorld::Ptr ptr)

Here is the caller graph for this function:

std::list< MWWorld::Ptr > MWMechanics::Actors::getActorsFighting ( const MWWorld::Ptr actor)

Returns the list of actors which are fighting the given actor.

ie AiCombat is active and the target is the actor

Here is the call graph for this function:

Here is the caller graph for this function:

std::list< MWWorld::Ptr > MWMechanics::Actors::getActorsFollowing ( const MWWorld::Ptr actor)

Here is the call graph for this function:

Here is the caller graph for this function:

void MWMechanics::Actors::getActorsFollowing ( const MWWorld::Ptr actor,
std::set< MWWorld::Ptr > &  out 
)

Recursive version of getActorsFollowing.

Here is the call graph for this function:

std::list< int > MWMechanics::Actors::getActorsFollowingIndices ( const MWWorld::Ptr actor)

Get the list of AiFollow::mFollowIndex for all actors following this target.

Here is the call graph for this function:

Here is the caller graph for this function:

std::list< MWWorld::Ptr > MWMechanics::Actors::getActorsSidingWith ( const MWWorld::Ptr actor)

Returns the list of actors which are siding with the given actor in fights.

ie AiFollow or AiEscort is active and the target is the actor

Here is the call graph for this function:

Here is the caller graph for this function:

void MWMechanics::Actors::getActorsSidingWith ( const MWWorld::Ptr actor,
std::set< MWWorld::Ptr > &  out 
)

Recursive version of getActorsSidingWith.

Here is the call graph for this function:

std::list< MWWorld::Ptr > MWMechanics::Actors::getEnemiesNearby ( const MWWorld::Ptr actor)

Unlike getActorsFighting, also returns actors that would fight the given actor if they saw him.

Here is the call graph for this function:

Here is the caller graph for this function:

int MWMechanics::Actors::getHoursToRest ( const MWWorld::Ptr ptr) const

Calculate how many hours the given actor needs to rest in order to be fully healed.

Here is the call graph for this function:

Here is the caller graph for this function:

void MWMechanics::Actors::getObjectsInRange ( const osg::Vec3f &  position,
float  radius,
std::vector< MWWorld::Ptr > &  out 
)

Here is the caller graph for this function:

bool MWMechanics::Actors::isReadyToBlock ( const MWWorld::Ptr ptr) const

Here is the caller graph for this function:

void MWMechanics::Actors::killDeadActors ( )
private

Here is the call graph for this function:

Here is the caller graph for this function:

void MWMechanics::Actors::persistAnimationStates ( )

Here is the caller graph for this function:

bool MWMechanics::Actors::playAnimationGroup ( const MWWorld::Ptr ptr,
const std::string &  groupName,
int  mode,
int  number,
bool  persist = false 
)

Here is the call graph for this function:

Here is the caller graph for this function:

void MWMechanics::Actors::purgeSpellEffects ( int  casterActorId)
private

Here is the call graph for this function:

Here is the caller graph for this function:

void MWMechanics::Actors::readRecord ( ESM::ESMReader reader,
uint32_t  type 
)

Here is the call graph for this function:

Here is the caller graph for this function:

void MWMechanics::Actors::removeActor ( const MWWorld::Ptr ptr)

Deregister an actor for stats management

Note
Ignored, if ptr is not a registered actor.

Here is the caller graph for this function:

void MWMechanics::Actors::rest ( bool  sleep)

Update actors while the player is waiting or sleeping. This should be called every hour.

Here is the call graph for this function:

Here is the caller graph for this function:

void MWMechanics::Actors::restoreDynamicStats ( const MWWorld::Ptr actor,
bool  sleep 
)

Here is the call graph for this function:

Here is the caller graph for this function:

void MWMechanics::Actors::skipAnimation ( const MWWorld::Ptr ptr)

Here is the caller graph for this function:

void MWMechanics::Actors::update ( float  duration,
bool  paused 
)

Update actor stats and store desired velocity vectors in movement.

Todo:
move update logic to Actor class where appropriate

Here is the call graph for this function:

Here is the caller graph for this function:

void MWMechanics::Actors::updateActor ( const MWWorld::Ptr old,
const MWWorld::Ptr ptr 
)

Updates an actor with a new Ptr.

Here is the call graph for this function:

Here is the caller graph for this function:

void MWMechanics::Actors::updateActor ( const MWWorld::Ptr ptr,
float  duration 
)

This function is normally called automatically during the update process, but it can also be called explicitly at any time to force an update.

Here is the call graph for this function:

void MWMechanics::Actors::updateCrimePersuit ( const MWWorld::Ptr ptr,
float  duration 
)
private

Here is the call graph for this function:

Here is the caller graph for this function:

void MWMechanics::Actors::updateDrowning ( const MWWorld::Ptr ptr,
float  duration 
)
private

Here is the call graph for this function:

Here is the caller graph for this function:

void MWMechanics::Actors::updateEquippedLight ( const MWWorld::Ptr ptr,
float  duration 
)
private

Automatically equip NPCs torches at night and unequip them at day

Here is the call graph for this function:

Here is the caller graph for this function:

void MWMechanics::Actors::updateHeadTracking ( const MWWorld::Ptr actor,
const MWWorld::Ptr targetActor,
MWWorld::Ptr headTrackTarget,
float &  sqrHeadTrackDistance 
)

Here is the call graph for this function:

Here is the caller graph for this function:

void MWMechanics::Actors::updateMagicEffects ( const MWWorld::Ptr ptr)

Update magic effects for an actor. Usually done automatically once per frame, but if we're currently paused we may want to do it manually (after equipping permanent enchantment)

Here is the call graph for this function:

Here is the caller graph for this function:

void MWMechanics::Actors::updateNpc ( const MWWorld::Ptr ptr,
float  duration 
)
private

Here is the call graph for this function:

Here is the caller graph for this function:

void MWMechanics::Actors::write ( ESM::ESMWriter writer,
Loading::Listener listener 
) const

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

PtrActorMap MWMechanics::Actors::mActors
private
std::map<std::string, int> MWMechanics::Actors::mDeathCount
private

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