summaryrefslogtreecommitdiff
path: root/src/gui/windows/questswindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/windows/questswindow.cpp')
-rw-r--r--src/gui/windows/questswindow.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/gui/windows/questswindow.cpp b/src/gui/windows/questswindow.cpp
index ab204d1f8..5ffb2fc2f 100644
--- a/src/gui/windows/questswindow.cpp
+++ b/src/gui/windows/questswindow.cpp
@@ -142,6 +142,7 @@ QuestsWindow::~QuestsWindow()
delete2(mItemLinkHandler);
mQuestLinks.clear();
+ mQuestReverseLinks.clear();
if (mCompleteIcon)
{
mCompleteIcon->decRef();
@@ -183,6 +184,7 @@ void QuestsWindow::rebuild(const bool playSound)
{
mQuestsModel->clear();
mQuestLinks.clear();
+ mQuestReverseLinks.clear();
StringVect &names = mQuestsModel->getNames();
std::vector<Image*> &images = mQuestsModel->getImages();
std::vector<QuestItem*> complete;
@@ -234,6 +236,7 @@ void QuestsWindow::rebuild(const bool playSound)
}
quest->completeFlag = 1;
mQuestLinks.push_back(quest);
+ mQuestReverseLinks[quest->var] = k;
names.push_back(quest->name);
if (mCompleteIcon)
{
@@ -257,6 +260,7 @@ void QuestsWindow::rebuild(const bool playSound)
}
quest->completeFlag = 0;
mQuestLinks.push_back(quest);
+ mQuestReverseLinks[quest->var] = k;
names.push_back(quest->name);
if (mIncompleteIcon)
{
@@ -460,3 +464,18 @@ void QuestsWindow::addEffect(Being *const being)
being->addSpecialEffect(effect->effectId);
}
}
+
+void QuestsWindow::selectQuest(const int varId)
+{
+ std::map<int, int>::const_iterator it = mQuestReverseLinks.find(varId);
+ if (it == mQuestReverseLinks.end())
+ return;
+ if (mVisible == Visible_false)
+ setVisible(Visible_true);
+ const int listPos = (*it).second;
+ if (listPos < 0)
+ return;
+ showQuest(mQuestLinks[listPos]);
+ mQuestsListBox->setSelected(listPos);
+ requestMoveToTop();
+}