forked from OpenMW/openmw
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathloaddial.hpp
70 lines (53 loc) · 1.78 KB
/
loaddial.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#ifndef OPENMW_ESM_DIAL_H
#define OPENMW_ESM_DIAL_H
#include <string>
#include <list>
#include <map>
#include "loadinfo.hpp"
namespace ESM
{
class ESMReader;
class ESMWriter;
/*
* Dialogue topic and journal entries. The actual data is contained in
* the INFO records following the DIAL.
*/
struct Dialogue
{
static unsigned int sRecordId;
/// Return a string descriptor for this record type. Currently used for debugging / error logs only.
static std::string getRecordType() { return "Dialogue"; }
enum Type
{
Topic = 0,
Voice = 1,
Greeting = 2,
Persuasion = 3,
Journal = 4,
Unknown = -1 // Used for deleted dialogues
};
std::string mId;
signed char mType;
typedef std::list<DialInfo> InfoContainer;
// Parameters: Info ID, (Info iterator, Deleted flag)
typedef std::map<std::string, std::pair<InfoContainer::iterator, bool> > LookupMap;
InfoContainer mInfo;
// This is only used during the loading phase to speed up DialInfo merging.
LookupMap mLookup;
void load(ESMReader &esm, bool &isDeleted);
///< Loads all sub-records of Dialogue record
void loadId(ESMReader &esm);
///< Loads NAME sub-record of Dialogue record
void loadData(ESMReader &esm, bool &isDeleted);
///< Loads all sub-records of Dialogue record, except NAME sub-record
void save(ESMWriter &esm, bool isDeleted = false) const;
/// Remove all INFOs that are deleted
void clearDeletedInfos();
/// Read the next info record
/// @param merge Merge with existing list, or just push each record to the end of the list?
void readInfo (ESM::ESMReader& esm, bool merge);
void blank();
///< Set record to default state (does not touch the ID and does not change the type).
};
}
#endif