Skip to content

Commit

Permalink
Disable play button for the missing campaign option.
Browse files Browse the repository at this point in the history
  • Loading branch information
Pentarctagon committed Nov 15, 2023
1 parent b34b6e2 commit fd4b74a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/gui/dialogs/campaign_selection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ void campaign_selection::campaign_selected()
if(!tree.selected_item()->id().empty()) {
auto iter = std::find(page_ids_.begin(), page_ids_.end(), tree.selected_item()->id());

if(tree.selected_item()->id() == missing_campaign_) {
find_widget<button>(this, "ok", false).set_active(false);
} else {
find_widget<button>(this, "ok", false).set_active(true);
}

const int choice = std::distance(page_ids_.begin(), iter);
if(iter == page_ids_.end()) {
return;
Expand Down Expand Up @@ -347,7 +353,7 @@ void campaign_selection::pre_show(window& window)
missing["icon"] = "units/unknown-unit.png";
missing["name"] = _("Missing Campaigns");
missing["completed"] = false;
missing["id"] = "missing-campaign";
missing["id"] = missing_campaign_;

add_campaign_to_tree(missing);

Expand All @@ -358,7 +364,7 @@ void campaign_selection::pre_show(window& window)
data.emplace("description", item);

pages.add_page(data);
page_ids_.push_back("missing-campaign");
page_ids_.push_back(missing_campaign_);
}

//
Expand Down
2 changes: 2 additions & 0 deletions src/gui/dialogs/campaign_selection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ class campaign_selection : public modal_dialog
bool currently_sorted_asc_;

std::vector<std::string> last_search_words_;

inline const static std::string missing_campaign_ = "missing-campaign";
};

} // namespace dialogs

0 comments on commit fd4b74a

Please sign in to comment.