OpenMW
components/esm/aipackage.hpp
Go to the documentation of this file.
00001 #ifndef OPENMW_ESM_AIPACKAGE_H
00002 #define OPENMW_ESM_AIPACKAGE_H
00003 
00004 #include <vector>
00005 #include <string>
00006 
00007 #include "esmcommon.hpp"
00008 
00009 namespace ESM
00010 {
00011     class ESMReader;
00012     class ESMWriter;
00013 
00014     #pragma pack(push)
00015     #pragma pack(1)
00016 
00017     struct AIData
00018     {
00019         // These are probabilities
00020         char mHello, mU1, mFight, mFlee, mAlarm, mU2, mU3, mU4;
00021         int mServices; // See the Services enum
00022 
00023         void blank();
00025     }; // 12 bytes
00026 
00027     struct AIWander
00028     {
00029         short   mDistance;
00030         short   mDuration;
00031         unsigned char mTimeOfDay;
00032         unsigned char mIdle[8];
00033         unsigned char mUnk;
00034     };
00035 
00036     struct AITravel
00037     {
00038         float   mX, mY, mZ;
00039         int     mUnk;
00040     };
00041 
00042     struct AITarget
00043     {
00044         float   mX, mY, mZ;
00045         short   mDuration;
00046         NAME32  mId;
00047         short   mUnk;
00048     };
00049 
00050     struct AIActivate
00051     {
00052         NAME32 mName;
00053         unsigned char mUnk;
00054     };
00055 
00056     #pragma pack(pop)
00057 
00058     enum
00059     {
00060         AI_Wander = 0x575f4941,
00061         AI_Travel = 0x545f4941,
00062         AI_Follow = 0x465f4941,
00063         AI_Escort = 0x455f4941,
00064         AI_Activate = 0x415f4941
00065     };
00066 
00069     struct AIPackage
00070     {
00071         int mType;
00072 
00073         // Anonymous union
00074         union
00075         {
00076             AIWander mWander;
00077             AITravel mTravel;
00078             AITarget mTarget;
00079             AIActivate mActivate;
00080         };
00081 
00084         std::string mCellName;
00085     };
00086 
00087     struct AIPackageList
00088     {
00089         std::vector<AIPackage> mList;
00090 
00095         void load(ESMReader &esm);
00096         void save(ESMWriter &esm) const;
00097     };
00098 }
00099 
00100 #endif
00101