OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
loaddial.hpp
Go to the documentation of this file.
1 #ifndef OPENMW_ESM_DIAL_H
2 #define OPENMW_ESM_DIAL_H
3 
4 #include <string>
5 #include <list>
6 #include <map>
7 
8 #include "loadinfo.hpp"
9 
10 namespace ESM
11 {
12 
13 class ESMReader;
14 class ESMWriter;
15 
16 /*
17  * Dialogue topic and journal entries. The actual data is contained in
18  * the INFO records following the DIAL.
19  */
20 
21 struct Dialogue
22 {
23  static unsigned int sRecordId;
25  static std::string getRecordType() { return "Dialogue"; }
26 
27  enum Type
28  {
29  Topic = 0,
30  Voice = 1,
31  Greeting = 2,
33  Journal = 4,
34  Unknown = -1 // Used for deleted dialogues
35  };
36 
37  std::string mId;
38  signed char mType;
39 
40  typedef std::list<DialInfo> InfoContainer;
41 
42  // Parameters: Info ID, (Info iterator, Deleted flag)
43  typedef std::map<std::string, std::pair<InfoContainer::iterator, bool> > LookupMap;
44 
46 
47  // This is only used during the loading phase to speed up DialInfo merging.
49 
50  void load(ESMReader &esm, bool &isDeleted);
52  void loadId(ESMReader &esm);
54  void loadData(ESMReader &esm, bool &isDeleted);
56 
57  void save(ESMWriter &esm, bool isDeleted = false) const;
58 
60  void clearDeletedInfos();
61 
64  void readInfo (ESM::ESMReader& esm, bool merge);
65 
66  void blank();
68 };
69 }
70 #endif
Definition: loaddial.hpp:29
Definition: esmreader.hpp:21
InfoContainer mInfo
Definition: loaddial.hpp:45
void readInfo(ESM::ESMReader &esm, bool merge)
Definition: loaddial.cpp:77
void loadId(ESMReader &esm)
Loads NAME sub-record of Dialogue record.
Definition: loaddial.cpp:19
signed char mType
Definition: loaddial.hpp:38
Type
Definition: loaddial.hpp:27
Definition: loaddial.hpp:21
Definition: loaddial.hpp:33
LookupMap mLookup
Definition: loaddial.hpp:48
Definition: esmwriter.hpp:17
std::map< std::string, std::pair< InfoContainer::iterator, bool > > LookupMap
Definition: loaddial.hpp:43
void save(ESMWriter &esm, bool isDeleted=false) const
Definition: loaddial.cpp:59
Definition: loaddial.hpp:34
std::list< DialInfo > InfoContainer
Definition: loaddial.hpp:40
void load(ESMReader &esm, bool &isDeleted)
Loads all sub-records of Dialogue record.
Definition: loaddial.cpp:13
void clearDeletedInfos()
Remove all INFOs that are deleted.
Definition: loaddial.cpp:134
Definition: loaddial.hpp:31
void loadData(ESMReader &esm, bool &isDeleted)
Loads all sub-records of Dialogue record, except NAME sub-record.
Definition: loaddial.cpp:24
void blank()
Set record to default state (does not touch the ID and does not change the type). ...
Definition: loaddial.cpp:72
Definition: loaddial.hpp:30
Definition: loaddial.hpp:32
static unsigned int sRecordId
Definition: loaddial.hpp:23
static std::string getRecordType()
Return a string descriptor for this record type. Currently used for debugging / error logs only...
Definition: loaddial.hpp:25
std::string mId
Definition: loaddial.hpp:37