Merge branch 'dialogue' into 'master'

Don't regenerate the topics list unconditionally

See merge request OpenMW/openmw!459
pull/593/head
psi29a 4 years ago
commit 3e87c35005

@ -451,6 +451,7 @@ namespace MWGui
setTitle(mPtr.getClass().getName(mPtr)); setTitle(mPtr.getClass().getName(mPtr));
updateTopics(); updateTopics();
updateTopicsPane(); // force update for new services
updateDisposition(); updateDisposition();
restock(); restock();
@ -487,12 +488,14 @@ namespace MWGui
mHistoryContents.clear(); mHistoryContents.clear();
} }
void DialogueWindow::setKeywords(std::list<std::string> keyWords) bool DialogueWindow::setKeywords(std::list<std::string> keyWords)
{ {
if (mKeywords == keyWords && isCompanion() == mIsCompanion) if (mKeywords == keyWords && isCompanion() == mIsCompanion)
return; return false;
mIsCompanion = isCompanion(); mIsCompanion = isCompanion();
mKeywords = keyWords; mKeywords = keyWords;
updateTopicsPane();
return true;
} }
void DialogueWindow::updateTopicsPane() void DialogueWindow::updateTopicsPane()
@ -556,6 +559,8 @@ namespace MWGui
mTopicsList->adjustSize(); mTopicsList->adjustSize();
updateHistory(); updateHistory();
// The topics list has been regenerated so topic formatting needs to be updated
updateTopicFormat();
} }
void DialogueWindow::updateHistory(bool scrollbar) void DialogueWindow::updateHistory(bool scrollbar)
@ -758,9 +763,9 @@ namespace MWGui
void DialogueWindow::updateTopics() void DialogueWindow::updateTopics()
{ {
setKeywords(MWBase::Environment::get().getDialogueManager()->getAvailableTopics()); // Topic formatting needs to be updated regardless of whether the topic list has changed
updateTopicsPane(); if (!setKeywords(MWBase::Environment::get().getDialogueManager()->getAvailableTopics()))
updateTopicFormat(); updateTopicFormat();
} }
bool DialogueWindow::isCompanion() bool DialogueWindow::isCompanion()

@ -122,7 +122,8 @@ namespace MWGui
void setPtr(const MWWorld::Ptr& actor) override; void setPtr(const MWWorld::Ptr& actor) override;
void setKeywords(std::list<std::string> keyWord); /// @return true if stale keywords were updated successfully
bool setKeywords(std::list<std::string> keyWord);
void addResponse (const std::string& title, const std::string& text, bool needMargin = true); void addResponse (const std::string& title, const std::string& text, bool needMargin = true);

Loading…
Cancel
Save