mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-03 21:49:41 +00:00
Avoid rebuilding the dialogue topics pane unnecessarily
Also retaining key focus.
This commit is contained in:
parent
44720bf41a
commit
7a64098da3
2 changed files with 19 additions and 1 deletions
|
@ -241,6 +241,7 @@ namespace MWGui
|
||||||
|
|
||||||
DialogueWindow::DialogueWindow()
|
DialogueWindow::DialogueWindow()
|
||||||
: WindowBase("openmw_dialogue_window.layout")
|
: WindowBase("openmw_dialogue_window.layout")
|
||||||
|
, mIsCompanion(false)
|
||||||
, mGoodbye(false)
|
, mGoodbye(false)
|
||||||
, mPersuasionDialog()
|
, mPersuasionDialog()
|
||||||
{
|
{
|
||||||
|
@ -404,6 +405,9 @@ namespace MWGui
|
||||||
for (std::vector<DialogueText*>::iterator it = mHistoryContents.begin(); it != mHistoryContents.end(); ++it)
|
for (std::vector<DialogueText*>::iterator it = mHistoryContents.begin(); it != mHistoryContents.end(); ++it)
|
||||||
delete (*it);
|
delete (*it);
|
||||||
mHistoryContents.clear();
|
mHistoryContents.clear();
|
||||||
|
|
||||||
|
mKeywords.clear();
|
||||||
|
updateTopicsPane();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (std::vector<Link*>::iterator it = mLinks.begin(); it != mLinks.end(); ++it)
|
for (std::vector<Link*>::iterator it = mLinks.begin(); it != mLinks.end(); ++it)
|
||||||
|
@ -438,6 +442,16 @@ namespace MWGui
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogueWindow::setKeywords(std::list<std::string> keyWords)
|
void DialogueWindow::setKeywords(std::list<std::string> keyWords)
|
||||||
|
{
|
||||||
|
if (mKeywords == keyWords && isCompanion() == mIsCompanion)
|
||||||
|
return;
|
||||||
|
mIsCompanion = isCompanion();
|
||||||
|
mKeywords = keyWords;
|
||||||
|
|
||||||
|
updateTopicsPane();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DialogueWindow::updateTopicsPane()
|
||||||
{
|
{
|
||||||
mTopicsList->clear();
|
mTopicsList->clear();
|
||||||
for (std::map<std::string, Link*>::iterator it = mTopicLinks.begin(); it != mTopicLinks.end(); ++it)
|
for (std::map<std::string, Link*>::iterator it = mTopicLinks.begin(); it != mTopicLinks.end(); ++it)
|
||||||
|
@ -484,7 +498,7 @@ namespace MWGui
|
||||||
mTopicsList->addSeparator();
|
mTopicsList->addSeparator();
|
||||||
|
|
||||||
|
|
||||||
for(std::list<std::string>::iterator it = keyWords.begin(); it != keyWords.end(); ++it)
|
for(std::list<std::string>::iterator it = mKeywords.begin(); it != mKeywords.end(); ++it)
|
||||||
{
|
{
|
||||||
mTopicsList->addItem(*it);
|
mTopicsList->addItem(*it);
|
||||||
|
|
||||||
|
|
|
@ -132,6 +132,7 @@ namespace MWGui
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void updateTopics();
|
void updateTopics();
|
||||||
|
void updateTopicsPane();
|
||||||
bool isCompanion();
|
bool isCompanion();
|
||||||
|
|
||||||
void onPersuadeResult(const std::string& title, const std::string& text);
|
void onPersuadeResult(const std::string& title, const std::string& text);
|
||||||
|
@ -156,6 +157,9 @@ namespace MWGui
|
||||||
|
|
||||||
bool mEnabled;
|
bool mEnabled;
|
||||||
|
|
||||||
|
bool mIsCompanion;
|
||||||
|
std::list<std::string> mKeywords;
|
||||||
|
|
||||||
std::vector<DialogueText*> mHistoryContents;
|
std::vector<DialogueText*> mHistoryContents;
|
||||||
std::vector<std::pair<std::string, int> > mChoices;
|
std::vector<std::pair<std::string, int> > mChoices;
|
||||||
bool mGoodbye;
|
bool mGoodbye;
|
||||||
|
|
Loading…
Reference in a new issue