1 #ifndef OPENMW_ESM_ARMO_H
2 #define OPENMW_ESM_ARMO_H
3 
4 #include <vector>
5 #include <string>
6 
7 namespace ESM
8 {
9 
10 class ESMReader;
11 class ESMWriter;
12 
13 enum PartReferenceType
14 {
15     PRT_Head = 0,
16     PRT_Hair = 1,
17     PRT_Neck = 2,
18     PRT_Cuirass = 3,
19     PRT_Groin = 4,
20     PRT_Skirt = 5,
21     PRT_RHand = 6,
22     PRT_LHand = 7,
23     PRT_RWrist = 8,
24     PRT_LWrist = 9,
25     PRT_Shield = 10,
26     PRT_RForearm = 11,
27     PRT_LForearm = 12,
28     PRT_RUpperarm = 13,
29     PRT_LUpperarm = 14,
30     PRT_RFoot = 15,
31     PRT_LFoot = 16,
32     PRT_RAnkle = 17,
33     PRT_LAnkle = 18,
34     PRT_RKnee = 19,
35     PRT_LKnee = 20,
36     PRT_RLeg = 21,
37     PRT_LLeg = 22,
38     PRT_RPauldron = 23,
39     PRT_LPauldron = 24,
40     PRT_Weapon = 25,
41     PRT_Tail = 26,
42 
43     PRT_Count = 27
44 };
45 
46 // Reference to body parts
47 struct PartReference
48 {
49     unsigned char mPart; // possible values [0, 26]
50     std::string mMale, mFemale;
51 };
52 
53 // A list of references to body parts
54 struct PartReferenceList
55 {
56     std::vector<PartReference> mParts;
57 
58     /// Load one part, assumes the subrecord name was already read
59     void add(ESMReader &esm);
60 
61     /// TODO: remove this method. The ESM format does not guarantee that all Part subrecords follow one another.
62     void load(ESMReader &esm);
63     void save(ESMWriter &esm) const;
64 };
65 
66 struct Armor
67 {
68     static unsigned int sRecordId;
69     /// Return a string descriptor for this record type. Currently used for debugging / error logs only.
getRecordTypeESM::Armor70     static std::string getRecordType() { return "Armor"; }
71 
72     enum Type
73     {
74         Helmet = 0,
75         Cuirass = 1,
76         LPauldron = 2,
77         RPauldron = 3,
78         Greaves = 4,
79         Boots = 5,
80         LGauntlet = 6,
81         RGauntlet = 7,
82         Shield = 8,
83         LBracer = 9,
84         RBracer = 10
85     };
86 
87     struct AODTstruct
88     {
89         int mType;
90         float mWeight;
91         int mValue, mHealth, mEnchant, mArmor;
92     };
93 
94     AODTstruct mData;
95     PartReferenceList mParts;
96 
97     std::string mId, mName, mModel, mIcon, mScript, mEnchant;
98 
99     void load(ESMReader &esm, bool &isDeleted);
100     void save(ESMWriter &esm, bool isDeleted = false) const;
101 
102     void blank();
103     ///< Set record to default state (does not touch the ID).
104 };
105 }
106 #endif
107