OpenMW
apps/openmw/mwmechanics/aiwander.hpp
Go to the documentation of this file.
00001 #ifndef GAME_MWMECHANICS_AIWANDER_H
00002 #define GAME_MWMECHANICS_AIWANDER_H
00003 
00004 #include "aipackage.hpp"
00005 #include <vector>
00006 
00007 #include "pathfinding.hpp"
00008 
00009 #include "../mwworld/timestamp.hpp"
00010 
00011 namespace MWMechanics
00012 {
00013     class AiWander : public AiPackage
00014     {
00015         public:
00016 
00017             AiWander(int distance, int duration, int timeOfDay, const std::vector<int>& idle, bool repeat);
00018             virtual AiPackage *clone() const;
00019             virtual bool execute (const MWWorld::Ptr& actor,float duration);
00021             virtual int getTypeId() const;
00023 
00024         private:
00025             void stopWalking(const MWWorld::Ptr& actor);
00026             void playIdle(const MWWorld::Ptr& actor, unsigned short idleSelect);
00027             bool checkIdle(const MWWorld::Ptr& actor, unsigned short idleSelect);
00028 
00029             int mDistance;
00030             int mDuration;
00031             int mTimeOfDay;
00032             std::vector<int> mIdle;
00033             bool mRepeat;
00034 
00035             float mX;
00036             float mY;
00037             float mZ;
00038 
00039             int mCellX;
00040             int mCellY;
00041             float mXCell;
00042             float mYCell;
00043 
00044             bool mStoredAvailableNodes;
00045             bool mChooseAction;
00046             bool mIdleNow;
00047             bool mMoveNow;
00048             bool mWalking;
00049 
00050             float mIdleChanceMultiplier;
00051             unsigned short mPlayedIdle;
00052 
00053             MWWorld::TimeStamp mStartTime;
00054 
00055             std::vector<ESM::Pathgrid::Point> mAllowedNodes;
00056             ESM::Pathgrid::Point mCurrentNode;
00057 
00058             PathFinder mPathFinder;
00059             const ESM::Pathgrid *mPathgrid;
00060 
00061     };
00062 }
00063 
00064 #endif