mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-10 15:39:02 +00:00
47 lines
905 B
C++
47 lines
905 B
C++
|
|
||
|
#include "topic.hpp"
|
||
|
|
||
|
#include <components/esm_store/store.hpp>
|
||
|
|
||
|
#include "../mwworld/world.hpp"
|
||
|
|
||
|
namespace MWDialogue
|
||
|
{
|
||
|
Topic::Topic()
|
||
|
{}
|
||
|
|
||
|
Topic::Topic (const std::string& topic)
|
||
|
: mTopic (topic)
|
||
|
{}
|
||
|
|
||
|
Topic::~Topic()
|
||
|
{}
|
||
|
|
||
|
void Topic::addEntry (const JournalEntry& entry, const MWWorld::World& world)
|
||
|
{
|
||
|
if (entry.mTopic!=mTopic)
|
||
|
throw std::runtime_error ("topic does not match: " + mTopic);
|
||
|
|
||
|
for (TEntryIter iter = begin(); iter!=end(); ++iter)
|
||
|
if (*iter==entry.mInfoId)
|
||
|
return;
|
||
|
|
||
|
mEntries.push_back (entry.mInfoId);
|
||
|
}
|
||
|
|
||
|
Topic::TEntryIter Topic::begin()
|
||
|
{
|
||
|
return mEntries.begin();
|
||
|
}
|
||
|
|
||
|
Topic::TEntryIter Topic::end()
|
||
|
{
|
||
|
return mEntries.end();
|
||
|
}
|
||
|
|
||
|
JournalEntry Topic::getEntry (const std::string& infoId)
|
||
|
{
|
||
|
return JournalEntry (mTopic, infoId);
|
||
|
}
|
||
|
}
|