Merge pull request #1312 from akortunov/guifixes

Split greeting from topic response
0.6.1
scrawl 8 years ago committed by GitHub
commit 6d90f5a9a5

@ -170,7 +170,7 @@ namespace MWDialogue
parseText (info->mResponse);
MWScript::InterpreterContext interpreterContext(&mActor.getRefData().getLocals(),mActor);
win->addResponse (Interpreter::fixDefinesDialog(info->mResponse, interpreterContext));
win->addResponse (Interpreter::fixDefinesDialog(info->mResponse, interpreterContext), "", false);
executeScript (info->mResultScript, mActor);
mLastTopic = Misc::StringUtils::lowerCase(it->mId);

@ -105,24 +105,23 @@ namespace MWGui
// --------------------------------------------------------------------------------------------------
Response::Response(const std::string &text, const std::string &title)
: mTitle(title)
Response::Response(const std::string &text, const std::string &title, bool needMargin)
: mTitle(title), mNeedMargin(needMargin)
{
mText = text;
}
void Response::write(BookTypesetter::Ptr typesetter, KeywordSearchT* keywordSearch, std::map<std::string, Link*>& topicLinks) const
{
BookTypesetter::Style* title = typesetter->createStyle("", getDialogueTextColour("header"));
typesetter->sectionBreak(mNeedMargin ? 9 : 0);
if (mTitle != "")
{
typesetter->sectionBreak(9);
BookTypesetter::Style* title = typesetter->createStyle("", getDialogueTextColour("header"));
typesetter->write(title, to_utf8_span(mTitle.c_str()));
typesetter->sectionBreak();
}
typesetter->sectionBreak();
typedef std::pair<size_t, size_t> Range;
std::map<Range, intptr_t> hyperLinks;
@ -552,7 +551,7 @@ namespace MWGui
mHistory->setPosition(0, static_cast<int>(pos) * -1);
}
void DialogueWindow::addResponse(const std::string &text, const std::string &title)
void DialogueWindow::addResponse(const std::string &text, const std::string &title, bool needMargin)
{
// This is called from the dialogue manager, so text is
// case-smashed - thus we have to retrieve the correct case
@ -571,7 +570,7 @@ namespace MWGui
}
}
mHistoryContents.push_back(new Response(text, realTitle));
mHistoryContents.push_back(new Response(text, realTitle, needMargin));
updateHistory();
}

@ -82,10 +82,11 @@ namespace MWGui
struct Response : DialogueText
{
Response(const std::string& text, const std::string& title = "");
Response(const std::string& text, const std::string& title = "", bool needMargin = true);
virtual void write (BookTypesetter::Ptr typesetter, KeywordSearchT* keywordSearch, std::map<std::string, Link*>& topicLinks) const;
void addTopicLink (BookTypesetter::Ptr typesetter, intptr_t topicId, size_t begin, size_t end) const;
std::string mTitle;
bool mNeedMargin;
};
struct Message : DialogueText
@ -109,7 +110,7 @@ namespace MWGui
void startDialogue(MWWorld::Ptr actor, std::string npcName, bool resetHistory);
void setKeywords(std::list<std::string> keyWord);
void addResponse (const std::string& text, const std::string& title="");
void addResponse (const std::string& text, const std::string& title="", bool needMargin = true);
void addMessageBox(const std::string& text);

Loading…
Cancel
Save