1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-31 19:45:32 +00:00

store text in journal entries

This commit is contained in:
Marc Zinnschlag 2013-11-30 11:57:33 +01:00
parent aebc2791a5
commit 9d64c92d33
2 changed files with 12 additions and 5 deletions

View file

@ -14,21 +14,27 @@ namespace MWDialogue
JournalEntry::JournalEntry (const std::string& topic, const std::string& infoId)
: mTopic (topic), mInfoId (infoId)
{}
std::string JournalEntry::getText (const MWWorld::ESMStore& store) const
{
const ESM::Dialogue *dialogue =
store.get<ESM::Dialogue>().find (mTopic);
MWBase::Environment::get().getWorld()->getStore().get<ESM::Dialogue>().find (mTopic);
for (std::vector<ESM::DialInfo>::const_iterator iter (dialogue->mInfo.begin());
iter!=dialogue->mInfo.end(); ++iter)
if (iter->mId == mInfoId)
return iter->mResponse;
{
/// \todo text replacement
mText = iter->mResponse;
return;
}
throw std::runtime_error ("unknown info ID " + mInfoId + " for topic " + mTopic);
}
std::string JournalEntry::getText (const MWWorld::ESMStore& store) const
{
return mText;
}
JournalEntry JournalEntry::makeFromQuest (const std::string& topic, int index)
{
return JournalEntry (topic, idFromIndex (topic, index));

View file

@ -15,6 +15,7 @@ namespace MWDialogue
{
std::string mTopic;
std::string mInfoId;
std::string mText;
JournalEntry();