forked from mirror/openmw-tes3mp
subclass ESM::DialInfo to keep track of parent topic
This commit is contained in:
parent
ea0e8be0d3
commit
15b7d3263c
6 changed files with 34 additions and 18 deletions
|
@ -28,7 +28,7 @@ opencs_units_noqt (model/world
|
|||
)
|
||||
|
||||
opencs_hdrs_noqt (model/world
|
||||
columnimp idcollection collection
|
||||
columnimp idcollection collection info
|
||||
)
|
||||
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
#include "columnbase.hpp"
|
||||
#include "columns.hpp"
|
||||
#include "info.hpp"
|
||||
|
||||
namespace CSMWorld
|
||||
{
|
||||
|
@ -1334,7 +1335,7 @@ namespace CSMWorld
|
|||
{
|
||||
ESXRecordT record2 = record.get();
|
||||
|
||||
record2.mQuestStatus = static_cast<ESM::DialInfo::QuestStatus> (data.toInt());
|
||||
record2.mQuestStatus = static_cast<Info::QuestStatus> (data.toInt());
|
||||
|
||||
record.setModified (record2);
|
||||
}
|
||||
|
|
|
@ -149,14 +149,14 @@ CSMWorld::Data::Data() : mRefs (mCells)
|
|||
mJournals.addColumn (new RecordStateColumn<ESM::Dialogue>);
|
||||
mJournals.addColumn (new DialogueTypeColumn<ESM::Dialogue> (true));
|
||||
|
||||
mTopicInfos.addColumn (new StringIdColumn<ESM::DialInfo>);
|
||||
mTopicInfos.addColumn (new RecordStateColumn<ESM::DialInfo>);
|
||||
mTopicInfos.addColumn (new StringIdColumn<Info>);
|
||||
mTopicInfos.addColumn (new RecordStateColumn<Info>);
|
||||
|
||||
mJournalInfos.addColumn (new StringIdColumn<ESM::DialInfo>);
|
||||
mJournalInfos.addColumn (new RecordStateColumn<ESM::DialInfo>);
|
||||
mJournalInfos.addColumn (new QuestStatusTypeColumn<ESM::DialInfo>);
|
||||
mJournalInfos.addColumn (new QuestIndexColumn<ESM::DialInfo>);
|
||||
mJournalInfos.addColumn (new QuestDescriptionColumn<ESM::DialInfo>);
|
||||
mJournalInfos.addColumn (new StringIdColumn<Info>);
|
||||
mJournalInfos.addColumn (new RecordStateColumn<Info>);
|
||||
mJournalInfos.addColumn (new QuestStatusTypeColumn<Info>);
|
||||
mJournalInfos.addColumn (new QuestIndexColumn<Info>);
|
||||
mJournalInfos.addColumn (new QuestDescriptionColumn<Info>);
|
||||
|
||||
mCells.addColumn (new StringIdColumn<Cell>);
|
||||
mCells.addColumn (new RecordStateColumn<Cell>);
|
||||
|
|
14
apps/opencs/model/world/info.hpp
Normal file
14
apps/opencs/model/world/info.hpp
Normal file
|
@ -0,0 +1,14 @@
|
|||
#ifndef CSM_WOLRD_INFO_H
|
||||
#define CSM_WOLRD_INFO_H
|
||||
|
||||
#include <components/esm/loadinfo.hpp>
|
||||
|
||||
namespace CSMWorld
|
||||
{
|
||||
struct Info : public ESM::DialInfo
|
||||
{
|
||||
std::string mTopicId;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
|
@ -2,15 +2,16 @@
|
|||
#include "infocollection.hpp"
|
||||
|
||||
#include <components/esm/esmreader.hpp>
|
||||
#include <components/esm/loaddial.hpp>
|
||||
|
||||
void CSMWorld::InfoCollection::load (const ESM::DialInfo& record, bool base)
|
||||
void CSMWorld::InfoCollection::load (const Info& record, bool base)
|
||||
{
|
||||
int index = searchId (record.mId);
|
||||
|
||||
if (index==-1)
|
||||
{
|
||||
// new record
|
||||
Record<ESM::DialInfo> record2;
|
||||
Record<Info> record2;
|
||||
record2.mState = base ? RecordBase::State_BaseOnly : RecordBase::State_ModifiedOnly;
|
||||
(base ? record2.mBase : record2.mModified) = record;
|
||||
|
||||
|
@ -19,7 +20,7 @@ void CSMWorld::InfoCollection::load (const ESM::DialInfo& record, bool base)
|
|||
else
|
||||
{
|
||||
// old record
|
||||
Record<ESM::DialInfo> record2 = getRecord (index);
|
||||
Record<Info> record2 = getRecord (index);
|
||||
|
||||
if (base)
|
||||
record2.mBase = record;
|
||||
|
@ -56,14 +57,15 @@ void CSMWorld::InfoCollection::load (ESM::ESMReader& reader, bool base, const ES
|
|||
}
|
||||
else
|
||||
{
|
||||
Record<ESM::DialInfo> record = getRecord (index);
|
||||
Record<Info> record = getRecord (index);
|
||||
record.mState = RecordBase::State_Deleted;
|
||||
setRecord (index, record);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ESM::DialInfo record;
|
||||
Info record;
|
||||
record.mTopicId = dialogue.mId;
|
||||
record.mId = id;
|
||||
record.load (reader);
|
||||
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
#ifndef CSM_WOLRD_INFOCOLLECTION_H
|
||||
#define CSM_WOLRD_INFOCOLLECTION_H
|
||||
|
||||
#include <components/esm/loadinfo.hpp>
|
||||
|
||||
#include "collection.hpp"
|
||||
#include "info.hpp"
|
||||
|
||||
namespace ESM
|
||||
{
|
||||
|
@ -12,9 +11,9 @@ namespace ESM
|
|||
|
||||
namespace CSMWorld
|
||||
{
|
||||
class InfoCollection : public Collection<ESM::DialInfo, IdAccessor<ESM::DialInfo> >
|
||||
class InfoCollection : public Collection<Info, IdAccessor<Info> >
|
||||
{
|
||||
void load (const ESM::DialInfo& record, bool base);
|
||||
void load (const Info& record, bool base);
|
||||
|
||||
public:
|
||||
|
||||
|
|
Loading…
Reference in a new issue