forked from teamnwah/openmw-tes3coop
added journal entry struct
parent
e4a0702bb4
commit
5851e0a28c
@ -0,0 +1,27 @@
|
||||
|
||||
#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);
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
#ifndef GAME_MMDIALOGUE_JOURNALENTRY_H
|
||||
#define GAME_MWDIALOGUE_JOURNALENTRY_H
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace ESMS
|
||||
{
|
||||
struct ESMStore;
|
||||
}
|
||||
|
||||
namespace MWDialogue
|
||||
{
|
||||
/// \brief a quest or dialogue entry with a timestamp
|
||||
struct JournalEntry
|
||||
{
|
||||
int mDay;
|
||||
std::string mTopic;
|
||||
std::string mInfoId;
|
||||
|
||||
JournalEntry();
|
||||
|
||||
JournalEntry (int day, const std::string& topic, const std::string& infoId);
|
||||
|
||||
std::string getText (const ESMS::ESMStore& store) const;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue