OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
loadfact.hpp
Go to the documentation of this file.
1 #ifndef OPENMW_ESM_FACT_H
2 #define OPENMW_ESM_FACT_H
3 
4 #include <string>
5 #include <map>
6 
7 namespace ESM
8 {
9 
10 class ESMReader;
11 class ESMWriter;
12 
13 /*
14  * Faction definitions
15  */
16 
17 // Requirements for each rank
18 struct RankData
19 {
20  int mAttribute1, mAttribute2; // Attribute level
21 
22  int mSkill1, mSkill2; // Skill level (faction skills given in
23  // skillID below.) You need one skill at
24  // level 'skill1' and two skills at level
25  // 'skill2' to advance to this rank.
26 
27  int mFactReaction; // Reaction from faction members
28 };
29 
30 struct Faction
31 {
32  static unsigned int sRecordId;
34  static std::string getRecordType() { return "Faction"; }
35 
36  std::string mId, mName;
37 
38  struct FADTstruct
39  {
40  // Which attributes we like
41  int mAttribute[2];
42 
44 
45  int mSkills[7]; // IDs of skills this faction require
46  // Each element will either contain an ESM::Skill index, or -1.
47 
48  int mIsHidden; // 1 - hidden from player
49 
50  int& getSkill (int index, bool ignored = false);
52 
53  int getSkill (int index, bool ignored = false) const;
55  }; // 240 bytes
56 
58 
59  // <Faction ID, Reaction>
60  std::map<std::string, int> mReactions;
61 
62  // Name of faction ranks (may be empty for NPC factions)
63  std::string mRanks[10];
64 
65  void load(ESMReader &esm, bool &isDeleted);
66  void save(ESMWriter &esm, bool isDeleted = false) const;
67 
68  void blank();
70 };
71 }
72 #endif
Definition: esmreader.hpp:21
int mAttribute[2]
Definition: loadfact.hpp:41
void load(ESMReader &esm, bool &isDeleted)
Definition: loadfact.cpp:29
int mSkill1
Definition: loadfact.hpp:22
std::string mId
Definition: loadfact.hpp:36
Definition: esmwriter.hpp:17
int & getSkill(int index, bool ignored=false)
Throws an exception for invalid values of index.
Definition: loadfact.cpp:13
void blank()
Set record to default state (does not touch the ID/index).
Definition: loadfact.cpp:116
RankData mRankData[10]
Definition: loadfact.hpp:43
int mIsHidden
Definition: loadfact.hpp:48
std::string mName
Definition: loadfact.hpp:36
int mAttribute2
Definition: loadfact.hpp:20
int mSkills[7]
Definition: loadfact.hpp:45
void save(ESMWriter &esm, bool isDeleted=false) const
Definition: loadfact.cpp:87
FADTstruct mData
Definition: loadfact.hpp:57
std::string mRanks[10]
Definition: loadfact.hpp:63
std::map< std::string, int > mReactions
Definition: loadfact.hpp:60
static unsigned int sRecordId
Definition: loadfact.hpp:32
int mSkill2
Definition: loadfact.hpp:22
int mAttribute1
Definition: loadfact.hpp:20
Definition: loadfact.hpp:30
Definition: loadfact.hpp:18
static std::string getRecordType()
Return a string descriptor for this record type. Currently used for debugging / error logs only...
Definition: loadfact.hpp:34
Definition: loadfact.hpp:38
int mFactReaction
Definition: loadfact.hpp:27