Skip to content

Commit

Permalink
Show an error when mainline campaigns are missing.
Browse files Browse the repository at this point in the history
A Linux packaging issue has, for apparently multiple years now, resulted in Wesnoth getting installed with only the tutorial campaign available. So, check for that and alert the player that there's an issue so they don't think Wesnoth actually only has a tutorial available.

Fixes wesnoth#7875
  • Loading branch information
Pentarctagon committed Nov 12, 2023
1 parent ec0f8f9 commit a01fd2e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/gui/dialogs/campaign_selection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@

#include "gui/dialogs/campaign_selection.hpp"

#include "filesystem.hpp"
#include "font/text_formatting.hpp"
#include "gui/dialogs/campaign_difficulty.hpp"
#include "gui/auxiliary/find_widget.hpp"
#include "gui/dialogs/campaign_difficulty.hpp"
#include "gui/dialogs/message.hpp"
#include "gui/widgets/button.hpp"
#include "gui/widgets/image.hpp"
#include "gui/widgets/listbox.hpp"
Expand Down Expand Up @@ -288,6 +290,12 @@ void campaign_selection::filter_text_changed(const std::string& text)

void campaign_selection::pre_show(window& window)
{
std::vector<std::string> dirs;
filesystem::get_files_in_dir(game_config::path + "/data/campaigns", nullptr, &dirs);
if(dirs.size() <= 1) {
gui2::show_error_message(_("Most mainline campaigns are missing. If you’re on Linux, then this means the incorrect package was installed. To get the rest of the campaigns you will need to either: correctly install the wesnoth metapackage, install each campaign’s package one by one, or install Wesnoth via Steam or Flatpak."));
}

text_box* filter = find_widget<text_box>(&window, "filter_box", false, true);
filter->set_text_changed_callback(
std::bind(&campaign_selection::filter_text_changed, this, std::placeholders::_2));
Expand Down

0 comments on commit a01fd2e

Please sign in to comment.