2012-09-23 18:11:08 +00:00
|
|
|
#ifndef OPENMW_ESM_DIAL_H
|
|
|
|
#define OPENMW_ESM_DIAL_H
|
2010-02-28 08:18:48 +00:00
|
|
|
|
2012-09-30 20:51:54 +00:00
|
|
|
#include <string>
|
2014-02-20 15:59:20 +00:00
|
|
|
#include <list>
|
2014-05-18 13:59:45 +00:00
|
|
|
#include <map>
|
2010-08-06 13:23:13 +00:00
|
|
|
|
|
|
|
#include "loadinfo.hpp"
|
2010-02-28 08:18:48 +00:00
|
|
|
|
2011-04-08 13:58:21 +00:00
|
|
|
namespace ESM
|
|
|
|
{
|
2010-02-28 08:18:48 +00:00
|
|
|
|
2012-09-30 20:51:54 +00:00
|
|
|
class ESMReader;
|
|
|
|
class ESMWriter;
|
|
|
|
|
2010-02-28 08:18:48 +00:00
|
|
|
/*
|
|
|
|
* Dialogue topic and journal entries. The actual data is contained in
|
|
|
|
* the INFO records following the DIAL.
|
|
|
|
*/
|
|
|
|
|
2012-09-30 19:34:53 +00:00
|
|
|
struct Dialogue
|
2010-02-28 08:18:48 +00:00
|
|
|
{
|
2013-09-24 11:17:28 +00:00
|
|
|
static unsigned int sRecordId;
|
2015-06-14 00:31:00 +00: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 11:17:28 +00:00
|
|
|
|
2011-04-08 13:58:21 +00:00
|
|
|
enum Type
|
2010-02-28 08:18:48 +00:00
|
|
|
{
|
2011-04-08 13:58:21 +00:00
|
|
|
Topic = 0,
|
|
|
|
Voice = 1,
|
|
|
|
Greeting = 2,
|
|
|
|
Persuasion = 3,
|
2015-07-11 19:17:53 +00:00
|
|
|
Journal = 4,
|
|
|
|
Unknown = -1 // Used for deleted dialogues
|
2010-02-28 08:18:48 +00:00
|
|
|
};
|
|
|
|
|
2012-09-30 19:34:53 +00:00
|
|
|
std::string mId;
|
2013-02-02 15:17:20 +00:00
|
|
|
signed char mType;
|
2014-02-20 15:59:20 +00:00
|
|
|
|
|
|
|
typedef std::list<DialInfo> InfoContainer;
|
|
|
|
|
2015-07-20 14:23:14 +00:00
|
|
|
// Parameters: Info ID, (Info iterator, Deleted flag)
|
|
|
|
typedef std::map<std::string, std::pair<InfoContainer::iterator, bool> > LookupMap;
|
2014-05-18 13:59:45 +00:00
|
|
|
|
2014-02-20 15:59:20 +00:00
|
|
|
InfoContainer mInfo;
|
2010-02-28 08:18:48 +00:00
|
|
|
|
2014-05-18 13:59:45 +00:00
|
|
|
// This is only used during the loading phase to speed up DialInfo merging.
|
|
|
|
LookupMap mLookup;
|
|
|
|
|
2015-07-20 14:23:14 +00:00
|
|
|
void load(ESMReader &esm, bool &isDeleted);
|
2015-07-13 07:53:31 +00:00
|
|
|
///< Loads all sub-records of Dialogue record
|
|
|
|
void loadId(ESMReader &esm);
|
|
|
|
///< Loads NAME sub-record of Dialogue record
|
2015-07-20 14:23:14 +00:00
|
|
|
void loadData(ESMReader &esm, bool &isDeleted);
|
2015-07-13 07:53:31 +00:00
|
|
|
///< Loads all sub-records of Dialogue record, except NAME sub-record
|
|
|
|
|
2015-07-20 14:23:14 +00:00
|
|
|
void save(ESMWriter &esm, bool isDeleted = false) const;
|
2013-10-20 15:13:31 +00:00
|
|
|
|
2015-07-20 14:23:14 +00:00
|
|
|
/// Remove all INFOs that are deleted
|
2014-10-19 15:45:18 +00:00
|
|
|
void clearDeletedInfos();
|
|
|
|
|
2014-05-30 22:36:37 +00:00
|
|
|
/// Read the next info record
|
2014-02-20 15:59:20 +00:00
|
|
|
/// @param merge Merge with existing list, or just push each record to the end of the list?
|
2014-05-30 22:36:37 +00:00
|
|
|
void readInfo (ESM::ESMReader& esm, bool merge);
|
2014-02-20 15:59:20 +00:00
|
|
|
|
2013-10-20 15:13:31 +00:00
|
|
|
void blank();
|
|
|
|
///< Set record to default state (does not touch the ID and does not change the type).
|
2010-02-28 08:18:48 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|