2012-09-23 22:11:08 +04:00
|
|
|
#ifndef OPENMW_ESM_DIAL_H
|
|
|
|
#define OPENMW_ESM_DIAL_H
|
2010-02-28 09:18:48 +01:00
|
|
|
|
2012-10-01 00:51:54 +04:00
|
|
|
#include <string>
|
2014-02-20 16:59:20 +01:00
|
|
|
#include <list>
|
2014-05-18 15:59:45 +02:00
|
|
|
#include <map>
|
2010-08-06 15:23:13 +02:00
|
|
|
|
|
|
|
#include "loadinfo.hpp"
|
2010-02-28 09:18:48 +01:00
|
|
|
|
2011-04-08 17:58:21 +04:00
|
|
|
namespace ESM
|
|
|
|
{
|
2010-02-28 09:18:48 +01:00
|
|
|
|
2012-10-01 00:51:54 +04:00
|
|
|
class ESMReader;
|
|
|
|
class ESMWriter;
|
|
|
|
|
2010-02-28 09:18:48 +01:00
|
|
|
/*
|
|
|
|
* Dialogue topic and journal entries. The actual data is contained in
|
|
|
|
* the INFO records following the DIAL.
|
|
|
|
*/
|
|
|
|
|
2012-09-30 23:34:53 +04:00
|
|
|
struct Dialogue
|
2010-02-28 09:18:48 +01:00
|
|
|
{
|
2013-09-24 13:17:28 +02:00
|
|
|
static unsigned int sRecordId;
|
2015-06-14 02:31:00 +02:00
|
|
|
/// Return a string descriptor for this record type. Currently used for debugging / error logs only.
|
|
|
|
static std::string getRecordType() { return "Dialogue"; }
|
2013-09-24 13:17:28 +02:00
|
|
|
|
2011-04-08 17:58:21 +04:00
|
|
|
enum Type
|
2010-02-28 09:18:48 +01:00
|
|
|
{
|
2011-04-08 17:58:21 +04:00
|
|
|
Topic = 0,
|
|
|
|
Voice = 1,
|
|
|
|
Greeting = 2,
|
|
|
|
Persuasion = 3,
|
|
|
|
Journal = 4,
|
|
|
|
Deleted = -1
|
2010-02-28 09:18:48 +01:00
|
|
|
};
|
|
|
|
|
2012-09-30 23:34:53 +04:00
|
|
|
std::string mId;
|
2013-02-02 10:17:20 -05:00
|
|
|
signed char mType;
|
2014-02-20 16:59:20 +01:00
|
|
|
|
|
|
|
typedef std::list<DialInfo> InfoContainer;
|
|
|
|
|
2014-05-18 15:59:45 +02:00
|
|
|
typedef std::map<std::string, InfoContainer::iterator> LookupMap;
|
|
|
|
|
2014-02-20 16:59:20 +01:00
|
|
|
InfoContainer mInfo;
|
2010-02-28 09:18:48 +01:00
|
|
|
|
2014-05-18 15:59:45 +02:00
|
|
|
// This is only used during the loading phase to speed up DialInfo merging.
|
|
|
|
LookupMap mLookup;
|
|
|
|
|
2011-04-08 17:58:21 +04:00
|
|
|
void load(ESMReader &esm);
|
2013-09-16 12:32:35 +02:00
|
|
|
void save(ESMWriter &esm) const;
|
2013-10-20 17:13:31 +02:00
|
|
|
|
2014-10-19 17:45:18 +02:00
|
|
|
/// Remove all INFOs marked as QS_Deleted from mInfos.
|
|
|
|
void clearDeletedInfos();
|
|
|
|
|
2014-05-31 00:36:37 +02:00
|
|
|
/// Read the next info record
|
2014-02-20 16:59:20 +01:00
|
|
|
/// @param merge Merge with existing list, or just push each record to the end of the list?
|
2014-05-31 00:36:37 +02:00
|
|
|
void readInfo (ESM::ESMReader& esm, bool merge);
|
2014-02-20 16:59:20 +01:00
|
|
|
|
2013-10-20 17:13:31 +02:00
|
|
|
void blank();
|
|
|
|
///< Set record to default state (does not touch the ID and does not change the type).
|
2010-02-28 09:18:48 +01:00
|
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|