mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 18:19:55 +00:00
Feature #764: Store the actor that gave the dialog response
This commit is contained in:
parent
a988a0d6dc
commit
f89b3cac02
9 changed files with 19 additions and 14 deletions
|
@ -54,7 +54,7 @@ namespace MWBase
|
|||
virtual int getJournalIndex (const std::string& id) const = 0;
|
||||
///< Get the journal index.
|
||||
|
||||
virtual void addTopic (const std::string& topicId, const std::string& infoId) = 0;
|
||||
virtual void addTopic (const std::string& topicId, const std::string& infoId, const std::string& actorName) = 0;
|
||||
|
||||
virtual TEntryIter begin() const = 0;
|
||||
///< Iterator pointing to the begin of the main journal.
|
||||
|
|
|
@ -286,7 +286,7 @@ namespace MWDialogue
|
|||
|
||||
MWScript::InterpreterContext interpreterContext(&mActor.getRefData().getLocals(),mActor);
|
||||
win->addResponse (Interpreter::fixDefinesDialog(info->mResponse, interpreterContext), title);
|
||||
MWBase::Environment::get().getJournal()->addTopic (topic, info->mId);
|
||||
MWBase::Environment::get().getJournal()->addTopic (topic, info->mId, mActor.getClass().getName(mActor));
|
||||
|
||||
executeScript (info->mResultScript);
|
||||
|
||||
|
@ -451,7 +451,7 @@ namespace MWDialogue
|
|||
|
||||
MWScript::InterpreterContext interpreterContext(&mActor.getRefData().getLocals(),mActor);
|
||||
MWBase::Environment::get().getWindowManager()->getDialogueWindow()->addResponse (Interpreter::fixDefinesDialog(text, interpreterContext));
|
||||
MWBase::Environment::get().getJournal()->addTopic (mLastTopic, info->mId);
|
||||
MWBase::Environment::get().getJournal()->addTopic (mLastTopic, info->mId, mActor.getClass().getName(mActor));
|
||||
executeScript (info->mResultScript);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ namespace MWDialogue
|
|||
throw std::runtime_error ("unknown info ID " + mInfoId + " for topic " + topic);
|
||||
}
|
||||
|
||||
Entry::Entry (const ESM::JournalEntry& record) : mInfoId (record.mInfo), mText (record.mText) {}
|
||||
Entry::Entry (const ESM::JournalEntry& record) : mInfoId (record.mInfo), mText (record.mText), mActorName(record.mActorName) {}
|
||||
|
||||
std::string Entry::getText() const
|
||||
{
|
||||
|
@ -43,6 +43,7 @@ namespace MWDialogue
|
|||
{
|
||||
entry.mInfo = mInfoId;
|
||||
entry.mText = mText;
|
||||
entry.mActorName = mActorName;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ namespace MWDialogue
|
|||
{
|
||||
std::string mInfoId;
|
||||
std::string mText;
|
||||
std::string mActorName; // optional
|
||||
|
||||
Entry();
|
||||
|
||||
|
|
|
@ -103,11 +103,13 @@ namespace MWDialogue
|
|||
quest.setIndex (index);
|
||||
}
|
||||
|
||||
void Journal::addTopic (const std::string& topicId, const std::string& infoId)
|
||||
void Journal::addTopic (const std::string& topicId, const std::string& infoId, const std::string& actorName)
|
||||
{
|
||||
Topic& topic = getTopic (topicId);
|
||||
|
||||
topic.addEntry (JournalEntry (topicId, infoId));
|
||||
JournalEntry entry(topicId, infoId);
|
||||
entry.mActorName = actorName;
|
||||
topic.addEntry (entry);
|
||||
}
|
||||
|
||||
int Journal::getJournalIndex (const std::string& id) const
|
||||
|
|
|
@ -38,7 +38,7 @@ namespace MWDialogue
|
|||
virtual int getJournalIndex (const std::string& id) const;
|
||||
///< Get the journal index.
|
||||
|
||||
virtual void addTopic (const std::string& topicId, const std::string& infoId);
|
||||
virtual void addTopic (const std::string& topicId, const std::string& infoId, const std::string& actorName);
|
||||
|
||||
virtual TEntryIter begin() const;
|
||||
///< Iterator pointing to the begin of the main journal.
|
||||
|
|
|
@ -311,8 +311,6 @@ struct JournalViewModelImpl : JournalViewModel
|
|||
{
|
||||
MWDialogue::Topic const & mTopic;
|
||||
|
||||
mutable std::string source_buffer;
|
||||
|
||||
TopicEntryImpl (JournalViewModelImpl const * model, MWDialogue::Topic const & topic, iterator_t itr) :
|
||||
BaseEntry (model, itr), mTopic (topic)
|
||||
{}
|
||||
|
@ -324,9 +322,7 @@ struct JournalViewModelImpl : JournalViewModel
|
|||
|
||||
Utf8Span source () const
|
||||
{
|
||||
if (source_buffer.empty ())
|
||||
source_buffer = "someone";
|
||||
return toUtf8Span (source_buffer);
|
||||
return toUtf8Span (itr->mActorName);
|
||||
}
|
||||
|
||||
};
|
||||
|
|
|
@ -17,6 +17,8 @@ void ESM::JournalEntry::load (ESMReader &esm)
|
|||
esm.getHNT (mMonth, "JEMO");
|
||||
esm.getHNT (mDayOfMonth, "JEDM");
|
||||
}
|
||||
else if (mType==Type_Topic)
|
||||
mActorName = esm.getHNOString("ACT_");
|
||||
}
|
||||
|
||||
void ESM::JournalEntry::save (ESMWriter &esm) const
|
||||
|
@ -32,4 +34,6 @@ void ESM::JournalEntry::save (ESMWriter &esm) const
|
|||
esm.writeHNT ("JEMO", mMonth);
|
||||
esm.writeHNT ("JEDM", mDayOfMonth);
|
||||
}
|
||||
else if (mType==Type_Topic)
|
||||
esm.writeHNString ("ACT_", mActorName);
|
||||
}
|
|
@ -23,6 +23,7 @@ namespace ESM
|
|||
std::string mTopic;
|
||||
std::string mInfo;
|
||||
std::string mText;
|
||||
std::string mActorName; // Could also be Actor ID to allow switching of localisation, but since mText is plaintext anyway...
|
||||
int mDay; // time stamp
|
||||
int mMonth;
|
||||
int mDayOfMonth;
|
||||
|
|
Loading…
Reference in a new issue