OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
loadlevlist.hpp
Go to the documentation of this file.
1 #ifndef OPENMW_ESM_LEVLISTS_H
2 #define OPENMW_ESM_LEVLISTS_H
3 
4 #include <string>
5 #include <vector>
6 
7 namespace ESM
8 {
9 
10 class ESMReader;
11 class ESMWriter;
12 
13 /*
14  * Levelled lists. Since these have identical layout, I only bothered
15  * to implement it once.
16  *
17  * We should later implement the ability to merge levelled lists from
18  * several files.
19  */
20 
22 {
23  int mFlags;
24  unsigned char mChanceNone; // Chance that none are selected (0-100)
25  std::string mId;
26 
27  // Record name used to read references. Must be set before load() is
28  // called.
29  const char *mRecName;
30 
31  struct LevelItem
32  {
33  std::string mId;
34  short mLevel;
35  };
36 
37  std::vector<LevelItem> mList;
38 
39  void load(ESMReader &esm, bool &isDeleted);
40  void save(ESMWriter &esm, bool isDeleted = false) const;
41 
42  void blank();
44 };
45 
47 {
48  static unsigned int sRecordId;
50  static std::string getRecordType() { return "CreatureLevList"; }
51 
52  enum Flags
53  {
54 
55  AllLevels = 0x01 // Calculate from all levels <= player
56  // level, not just the closest below
57  // player.
58  };
59 
61  {
62  mRecName = "CNAM";
63  }
64 };
65 
67 {
68  static unsigned int sRecordId;
70  static std::string getRecordType() { return "ItemLevList"; }
71 
72  enum Flags
73  {
74 
75  Each = 0x01, // Select a new item each time this
76  // list is instantiated, instead of
77  // giving several identical items
78  // (used when a container has more
79  // than one instance of one levelled
80  // list.)
81  AllLevels = 0x02 // Calculate from all levels <= player
82  // level, not just the closest below
83  // player.
84  };
85 
87  {
88  mRecName = "INAM";
89  }
90 };
91 
92 }
93 #endif
std::string mId
Definition: loadlevlist.hpp:33
unsigned char mChanceNone
Definition: loadlevlist.hpp:24
Definition: esmreader.hpp:21
static unsigned int sRecordId
Definition: loadlevlist.hpp:48
static std::string getRecordType()
Return a string descriptor for this record type. Currently used for debugging / error logs only...
Definition: loadlevlist.hpp:70
void blank()
Set record to default state (does not touch the ID).
Definition: loadlevlist.cpp:98
Definition: loadlevlist.hpp:75
Flags
Definition: loadlevlist.hpp:72
void save(ESMWriter &esm, bool isDeleted=false) const
Definition: loadlevlist.cpp:77
Definition: esmwriter.hpp:17
static unsigned int sRecordId
Definition: loadlevlist.hpp:68
Definition: loadlevlist.hpp:21
const char * mRecName
Definition: loadlevlist.hpp:29
static std::string getRecordType()
Return a string descriptor for this record type. Currently used for debugging / error logs only...
Definition: loadlevlist.hpp:50
int mFlags
Definition: loadlevlist.hpp:23
Definition: loadlevlist.hpp:81
Definition: loadlevlist.hpp:46
ItemLevList()
Definition: loadlevlist.hpp:86
std::vector< LevelItem > mList
Definition: loadlevlist.hpp:37
std::string mId
Definition: loadlevlist.hpp:25
Flags
Definition: loadlevlist.hpp:52
CreatureLevList()
Definition: loadlevlist.hpp:60
short mLevel
Definition: loadlevlist.hpp:34
Definition: loadlevlist.hpp:66
Definition: loadlevlist.hpp:31
Definition: loadlevlist.hpp:55
void load(ESMReader &esm, bool &isDeleted)
Definition: loadlevlist.cpp:9