1 #ifndef OPENMW_ESM_RACE_H
2 #define OPENMW_ESM_RACE_H
3 
4 #include <string>
5 
6 #include "spelllist.hpp"
7 
8 namespace ESM
9 {
10 
11 class ESMReader;
12 class ESMWriter;
13 
14 /*
15  * Race definition
16  */
17 
18 struct Race
19 {
20     static unsigned int sRecordId;
21     /// Return a string descriptor for this record type. Currently used for debugging / error logs only.
getRecordTypeESM::Race22     static std::string getRecordType() { return "Race"; }
23 
24     struct SkillBonus
25     {
26         int mSkill; // SkillEnum
27         int mBonus;
28     };
29 
30     struct MaleFemale
31     {
32         int mMale, mFemale;
33 
34         int getValue (bool male) const;
35     };
36 
37     struct MaleFemaleF
38     {
39         float mMale, mFemale;
40 
41         int getValue (bool male) const;
42     };
43 
44     enum Flags
45     {
46         Playable = 0x01,
47         Beast = 0x02
48     };
49 
50     struct RADTstruct
51     {
52         // List of skills that get a bonus
53         SkillBonus mBonus[7];
54 
55         // Attribute values for male/female
56         MaleFemale mAttributeValues[8];
57 
58         // The actual eye level height (in game units) is (probably) given
59         // as 'height' times 128. This has not been tested yet.
60         MaleFemaleF mHeight, mWeight;
61 
62         int mFlags; // 0x1 - playable, 0x2 - beast race
63 
64     }; // Size = 140 bytes
65 
66     RADTstruct mData;
67 
68     std::string mId, mName, mDescription;
69     SpellList mPowers;
70 
71     void load(ESMReader &esm, bool &isDeleted);
72     void save(ESMWriter &esm, bool isDeleted = false) const;
73 
74     void blank();
75     ///< Set record to default state (does not touch the ID/index).
76 };
77 
78 }
79 #endif
80