Browse Source

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.
ArseniyShestakov 10 năm trước cách đây
mục cha
commit
c0b78de6b4
1 tập tin đã thay đổi với 12 bổ sung2 xóa
  1. 12 2
      client/windows/CQuestLog.cpp

+ 12 - 2
client/windows/CQuestLog.cpp

@@ -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)
 	{