1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-06-19 06:41:36 +00:00

use Entry instead of plain string for topic and quest entries

This commit is contained in:
Marc Zinnschlag 2013-12-01 14:50:25 +01:00
parent b273f9e387
commit 0f971163f7
4 changed files with 7 additions and 11 deletions

View file

@ -82,9 +82,9 @@ namespace MWDialogue
setIndex (index); setIndex (index);
for (TEntryIter iter (mEntries.begin()); iter!=mEntries.end(); ++iter) for (TEntryIter iter (mEntries.begin()); iter!=mEntries.end(); ++iter)
if (*iter==entry.mInfoId) if (iter->mInfoId==entry.mInfoId)
return; return;
mEntries.push_back (entry.mInfoId); mEntries.push_back (entry); // we want slicing here
} }
} }

View file

@ -24,11 +24,7 @@ namespace MWDialogue
if (entry.mTopic!=mTopic) if (entry.mTopic!=mTopic)
throw std::runtime_error ("topic does not match: " + mTopic); throw std::runtime_error ("topic does not match: " + mTopic);
for (TEntryIter iter = begin(); iter!=end(); ++iter) mEntries.push_back (entry); // we want slicing here
if (*iter==entry.mInfoId)
return;
mEntries.push_back (entry.mInfoId);
} }
std::string Topic::getName() const std::string Topic::getName() const

View file

@ -13,14 +13,14 @@ namespace MWDialogue
{ {
public: public:
typedef std::vector<std::string> TEntryContainer; typedef std::vector<Entry> TEntryContainer;
typedef TEntryContainer::const_iterator TEntryIter; typedef TEntryContainer::const_iterator TEntryIter;
protected: protected:
std::string mTopic; std::string mTopic;
std::string mName; std::string mName;
TEntryContainer mEntries; // info-IDs TEntryContainer mEntries;
public: public:

View file

@ -268,7 +268,7 @@ struct JournalViewModelImpl : JournalViewModel
{ {
for (MWDialogue::Topic::TEntryIter j = quest->begin (); j != quest->end (); ++j) for (MWDialogue::Topic::TEntryIter j = quest->begin (); j != quest->end (); ++j)
{ {
if (i->mInfoId == *j) if (i->mInfoId == j->mInfoId)
visitor (JournalEntryImpl <MWBase::Journal::TEntryIter> (this, i)); visitor (JournalEntryImpl <MWBase::Journal::TEntryIter> (this, i));
} }
} }
@ -317,7 +317,7 @@ struct JournalViewModelImpl : JournalViewModel
std::string getText () const std::string getText () const
{ {
return mTopic.getEntry (*itr).getText(); return itr->getText();
} }
Utf8Span source () const Utf8Span source () const