OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
aipackage.hpp
Go to the documentation of this file.
1 #ifndef OPENMW_ESM_AIPACKAGE_H
2 #define OPENMW_ESM_AIPACKAGE_H
3 
4 #include <vector>
5 #include <string>
6 
7 #include "esmcommon.hpp"
8 
9 namespace ESM
10 {
11  class ESMReader;
12  class ESMWriter;
13 
14  #pragma pack(push)
15  #pragma pack(1)
16 
17  struct AIData
18  {
19  unsigned char mHello;
20  char mU1;
21  unsigned char mFight, mFlee, mAlarm; // These are probabilities [0, 100]
22  char mU2, mU3, mU4; // Unknown values
23  int mServices; // See the Services enum
24 
25  void blank();
27  }; // 12 bytes
28 
29  struct AIWander
30  {
31  short mDistance;
32  short mDuration;
33  unsigned char mTimeOfDay;
34  unsigned char mIdle[8];
35  unsigned char mShouldRepeat;
36  };
37 
38  struct AITravel
39  {
40  float mX, mY, mZ;
41  int mUnk;
42  };
43 
44  struct AITarget
45  {
46  float mX, mY, mZ;
47  short mDuration;
49  short mUnk;
50  };
51 
52  struct AIActivate
53  {
55  unsigned char mUnk;
56  };
57 
58  #pragma pack(pop)
59 
60  enum
61  {
62  AI_Wander = 0x575f4941,
63  AI_Travel = 0x545f4941,
64  AI_Follow = 0x465f4941,
65  AI_Escort = 0x455f4941,
66  AI_Activate = 0x415f4941,
67  AI_CNDT = 0x54444e43
68  };
69 
72  struct AIPackage
73  {
74  int mType;
75 
76  // Anonymous union
77  union
78  {
83  };
84 
87  std::string mCellName;
88  };
89 
91  {
92  std::vector<AIPackage> mList;
93 
95  void add(ESMReader &esm);
96 
97  void save(ESMWriter &esm) const;
98  };
99 }
100 
101 #endif
102 
std::vector< AIPackage > mList
Definition: aipackage.hpp:92
Definition: aipackage.hpp:66
void add(ESMReader &esm)
Add a single AIPackage, assumes subrecord name was already read.
Definition: aipackage.cpp:14
Definition: aipackage.hpp:90
char mU4
Definition: aipackage.hpp:22
Definition: aipackage.hpp:17
AIWander mWander
Definition: aipackage.hpp:79
int mUnk
Definition: aipackage.hpp:41
Definition: esmreader.hpp:21
std::string mCellName
Definition: aipackage.hpp:87
AITarget mTarget
Definition: aipackage.hpp:81
short mDuration
Definition: aipackage.hpp:32
char mU2
Definition: aipackage.hpp:22
Definition: aipackage.hpp:29
Definition: aipackage.hpp:63
AIActivate mActivate
Definition: aipackage.hpp:82
unsigned char mAlarm
Definition: aipackage.hpp:21
int mType
Definition: aipackage.hpp:74
NAME32 mName
Definition: aipackage.hpp:54
Definition: aipackage.hpp:62
float mZ
Definition: aipackage.hpp:46
Definition: esmwriter.hpp:17
Definition: aipackage.hpp:44
Definition: aipackage.hpp:67
float mY
Definition: aipackage.hpp:46
unsigned char mUnk
Definition: aipackage.hpp:55
unsigned char mFlee
Definition: aipackage.hpp:21
Definition: aipackage.hpp:65
int mServices
Definition: aipackage.hpp:23
char mU1
Definition: aipackage.hpp:20
AITravel mTravel
Definition: aipackage.hpp:80
unsigned char mTimeOfDay
Definition: aipackage.hpp:33
Definition: aipackage.hpp:72
short mDistance
Definition: aipackage.hpp:31
short mUnk
Definition: aipackage.hpp:49
Definition: aipackage.hpp:38
short mDuration
Definition: aipackage.hpp:47
float mX
Definition: aipackage.hpp:40
float mX
Definition: aipackage.hpp:46
Definition: aipackage.hpp:64
Definition: aipackage.hpp:52
NAME32 mId
Definition: aipackage.hpp:48
float mY
Definition: aipackage.hpp:40
unsigned char mIdle[8]
Definition: aipackage.hpp:34
unsigned char mFight
Definition: aipackage.hpp:21
unsigned char mShouldRepeat
Definition: aipackage.hpp:35
void blank()
Set record to default state (does not touch the ID).
Definition: aipackage.cpp:8
void save(ESMWriter &esm) const
Definition: aipackage.cpp:44
unsigned char mHello
Definition: aipackage.hpp:19
char mU3
Definition: aipackage.hpp:22
float mZ
Definition: aipackage.hpp:40