mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-01 15:15:33 +00:00
splitting JournalEntry into Entry and JournalEntry
This commit is contained in:
parent
16e2d67b1f
commit
b273f9e387
3 changed files with 32 additions and 19 deletions
|
@ -10,13 +10,13 @@
|
|||
|
||||
namespace MWDialogue
|
||||
{
|
||||
JournalEntry::JournalEntry() {}
|
||||
Entry::Entry() {}
|
||||
|
||||
JournalEntry::JournalEntry (const std::string& topic, const std::string& infoId)
|
||||
: mTopic (topic), mInfoId (infoId)
|
||||
Entry::Entry (const std::string& topic, const std::string& infoId)
|
||||
: mInfoId (infoId)
|
||||
{
|
||||
const ESM::Dialogue *dialogue =
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::Dialogue>().find (mTopic);
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::Dialogue>().find (topic);
|
||||
|
||||
for (std::vector<ESM::DialInfo>::const_iterator iter (dialogue->mInfo.begin());
|
||||
iter!=dialogue->mInfo.end(); ++iter)
|
||||
|
@ -27,14 +27,21 @@ namespace MWDialogue
|
|||
return;
|
||||
}
|
||||
|
||||
throw std::runtime_error ("unknown info ID " + mInfoId + " for topic " + mTopic);
|
||||
throw std::runtime_error ("unknown info ID " + mInfoId + " for topic " + topic);
|
||||
}
|
||||
|
||||
std::string JournalEntry::getText (const MWWorld::ESMStore& store) const
|
||||
std::string Entry::getText() const
|
||||
{
|
||||
return mText;
|
||||
}
|
||||
|
||||
|
||||
JournalEntry::JournalEntry() {}
|
||||
|
||||
JournalEntry::JournalEntry (const std::string& topic, const std::string& infoId)
|
||||
: Entry (topic, infoId), mTopic (topic)
|
||||
{}
|
||||
|
||||
JournalEntry JournalEntry::makeFromQuest (const std::string& topic, int index)
|
||||
{
|
||||
return JournalEntry (topic, idFromIndex (topic, index));
|
||||
|
@ -55,6 +62,7 @@ namespace MWDialogue
|
|||
throw std::runtime_error ("unknown journal index for topic " + topic);
|
||||
}
|
||||
|
||||
|
||||
StampedJournalEntry::StampedJournalEntry()
|
||||
: mDay (0), mMonth (0), mDayOfMonth (0)
|
||||
{}
|
||||
|
|
|
@ -3,26 +3,32 @@
|
|||
|
||||
#include <string>
|
||||
|
||||
namespace MWWorld
|
||||
{
|
||||
struct ESMStore;
|
||||
}
|
||||
|
||||
namespace MWDialogue
|
||||
{
|
||||
/// \brief A quest or dialogue entry
|
||||
struct JournalEntry
|
||||
/// \brief Basic quest/dialogue/topic entry
|
||||
struct Entry
|
||||
{
|
||||
std::string mTopic;
|
||||
std::string mInfoId;
|
||||
std::string mText;
|
||||
|
||||
Entry();
|
||||
|
||||
Entry (const std::string& topic, const std::string& infoId);
|
||||
|
||||
std::string getText() const;
|
||||
};
|
||||
|
||||
/// \brief A dialogue entry
|
||||
///
|
||||
/// Same as entry, but store TopicID
|
||||
struct JournalEntry : public Entry
|
||||
{
|
||||
std::string mTopic;
|
||||
|
||||
JournalEntry();
|
||||
|
||||
JournalEntry (const std::string& topic, const std::string& infoId);
|
||||
|
||||
std::string getText (const MWWorld::ESMStore& store) const;
|
||||
|
||||
static JournalEntry makeFromQuest (const std::string& topic, int index);
|
||||
|
||||
static std::string idFromIndex (const std::string& topic, int index);
|
||||
|
|
|
@ -233,7 +233,7 @@ struct JournalViewModelImpl : JournalViewModel
|
|||
|
||||
std::string getText () const
|
||||
{
|
||||
return itr->getText(MWBase::Environment::get().getWorld()->getStore());
|
||||
return itr->getText();
|
||||
}
|
||||
|
||||
Utf8Span timestamp () const
|
||||
|
@ -317,8 +317,7 @@ struct JournalViewModelImpl : JournalViewModel
|
|||
|
||||
std::string getText () const
|
||||
{
|
||||
return mTopic.getEntry (*itr).getText(MWBase::Environment::get().getWorld()->getStore());
|
||||
|
||||
return mTopic.getEntry (*itr).getText();
|
||||
}
|
||||
|
||||
Utf8Span source () const
|
||||
|
|
Loading…
Reference in a new issue