1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-08 09:37:53 +00:00
OpenMW/apps/openmw/mwdialogue/journalentry.cpp

28 lines
768 B
C++
Raw Normal View History

2011-04-19 08:54:11 +00:00
#include "journalentry.hpp"
#include <stdexcept>
#include <components/esm_store/store.hpp>
namespace MWDialogue
{
JournalEntry::JournalEntry() {}
JournalEntry::JournalEntry (int day, const std::string& topic, const std::string& infoId)
: mDay (day), mTopic (topic), mInfoId (infoId)
{}
std::string JournalEntry::getText (const ESMS::ESMStore& store) const
{
const ESM::Dialogue *dialogue = store.dialogs.find (mTopic);
for (std::vector<ESM::DialInfo>::const_iterator iter (dialogue->mInfo.begin());
iter!=dialogue->mInfo.end(); ++iter)
if (iter->id==mInfoId)
return iter->response;
throw std::runtime_error ("unknown info ID " + mInfoId + " for topic " + mTopic);
}
}