1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-12 02:28:11 +02:00

Quest Log: block hide complete button when it useless

We only want to to be checkable when there is actually any complete quests in list.
This commit is contained in:
ArseniyShestakov 2015-02-17 06:08:35 +03:00
parent ae20499854
commit c0b78de6b4

View File

@ -150,14 +150,21 @@ void CQuestLog::recreateLabelList()
if (labels.size())
labels.clear();
bool completeMissing = true;
int currentLabel = 0;
for (int i = 0; i < quests.size(); ++i)
{
// Quests with MISSION_NONE type don't have text for them and can't be displayed
if (quests[i].quest->missionType == CQuest::MISSION_NONE
|| (hideComplete && quests[i].quest->progress == CQuest::COMPLETE))
if (quests[i].quest->missionType == CQuest::MISSION_NONE)
continue;
if (quests[i].quest->progress == CQuest::COMPLETE)
{
completeMissing = false;
if (hideComplete)
continue;
}
MetaString text;
quests[i].quest->getRolloverText (text, false);
if (quests[i].obj)
@ -185,6 +192,9 @@ void CQuestLog::recreateLabelList()
currentLabel = labels.size();
}
if (completeMissing) // We can't use block(completeMissing) because if false button state reset to NORMAL
hideCompleteButton->block(true);
slider->setAmount(currentLabel);
if (currentLabel > QUEST_COUNT)
{