The Battle for Wesnoth 1.21.0-dev
 
Loading...
Searching...
No Matches
game_load.cpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2008 - 2025
3 by Jörg Hinrichs <joerg.hinrichs@alice-dsl.de>
4 Part of the Battle for Wesnoth Project https://www.wesnoth.org/
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY.
12
13 See the COPYING file for more details.
14*/
15
16#define GETTEXT_DOMAIN "wesnoth-lib"
17
19
20#include "desktop/open.hpp"
21#include "filesystem.hpp"
22#include "formatter.hpp"
24#include "game_config.hpp"
26#include "gettext.hpp"
31#include "gui/widgets/label.hpp"
38#include "language.hpp"
39#include "picture.hpp"
43#include "utils/general.hpp"
44#include "utils/ci_searcher.hpp"
45#include "game_config_view.hpp"
46
47#include <functional>
48
49
50static lg::log_domain log_gameloaddlg{"gui/dialogs/game_load_dialog"};
51#define ERR_GAMELOADDLG LOG_STREAM(err, log_gameloaddlg)
52#define WRN_GAMELOADDLG LOG_STREAM(warn, log_gameloaddlg)
53#define LOG_GAMELOADDLG LOG_STREAM(info, log_gameloaddlg)
54#define DBG_GAMELOADDLG LOG_STREAM(debug, log_gameloaddlg)
55
56namespace gui2::dialogs
57{
58
59REGISTER_DIALOG(game_load)
60
61bool game_load::execute(savegame::load_game_metadata& data)
62{
63 if(savegame::save_index_class::default_saves_dir()->get_saves_list().empty()) {
64 bool found_files = false;
65 for(const auto& dir : filesystem::find_other_version_saves_dirs()) {
66 if(!found_files) {
67 // this needs to be a shared_ptr because get_saves_list() uses shared_from_this
68 auto index = std::make_shared<savegame::save_index_class>(dir.path);
69 found_files = !index->get_saves_list().empty();
70 }
71 }
72
73 if(!found_files) {
74 gui2::show_transient_message(_("No Saved Games"), _("There are no saved games to load."));
75 return false;
76 }
77 }
78
79 return game_load(data).show();
80}
81
83 : modal_dialog(window_id())
85 , save_index_manager_(data.manager)
86 , show_replay_(register_bool("show_replay", true, data.show_replay))
87 , cancel_orders_(register_bool("cancel_orders", true, data.cancel_orders))
88 , difficulty_(data.difficulty)
89 , random_mode_(data.random_mode)
90 , summary_(data.summary)
91 , games_()
92 , cache_config_(game_config_manager::get()->game_config())
93{
94}
95
97{
98 // Allow deleting saves with the Delete key.
99 connect_signal_pre_key_press(*this, std::bind(&game_load::key_press_callback, this, std::placeholders::_5));
100
101 text_box* filter = find_widget<text_box>("txtFilter", false, true);
102
103 filter->on_modified([this](const auto& box) { apply_filter_text(box.text()); });
104
105 listbox& list = find_widget<listbox>("savegame_list");
106
107 connect_signal_notify_modified(list, std::bind(&game_load::display_savegame, this));
108
109#ifdef __IPHONEOS__
110 // On iOS, opening the load dialog should not immediately summon the
111 // software keyboard just because the optional filter field exists.
112 keyboard_capture(&list);
113#else
114 keyboard_capture(filter);
115#endif
117
118 list.set_sorters(
119 [this](const std::size_t i) { return games_[i].name(); },
120 [this](const std::size_t i) { return games_[i].modified(); }
121 );
122
124
125 connect_signal_mouse_left_click(find_widget<button>("delete"),
126 std::bind(&game_load::delete_button_callback, this));
127
128 connect_signal_mouse_left_click(find_widget<button>("browse_saves_folder"),
129 std::bind(&game_load::browse_button_callback, this));
130
131 menu_button& dir_list = find_widget<menu_button>("dirList");
132
133 dir_list.set_use_markup(true);
134 set_save_dir_list(dir_list);
135
136 connect_signal_notify_modified(dir_list, std::bind(&game_load::handle_dir_select, this));
137
139}
140
142{
143 if(get_retval() != retval::OK) {
144 return;
145 }
146
147 const menu_button& difficulty_menu = find_widget<menu_button>("difficulty_menu");
148 if(difficulty_menu.get_active()) {
149 difficulty_ = difficulty_menu.get_value_config()["define"].str();
150 }
151
152 const menu_button& rng_menu = find_widget<menu_button>("rng_menu");
153 if(rng_menu.get_active()) {
155 }
156}
157
159{
160 const auto other_dirs = filesystem::find_other_version_saves_dirs();
161 if(other_dirs.empty()) {
163 return;
164 }
165
166 std::vector<config> options;
167
168 // The first option in the list is the current version's save dir
169 options.emplace_back("label", _("game_version^Current Version"), "path", "");
170
171 for(const auto& known_dir : other_dirs) {
172 options.emplace_back(
173 "label", VGETTEXT("game_version^Wesnoth $version", utils::string_map{{"version", known_dir.version}}),
174 "path", known_dir.path
175 );
176 }
177
178 dir_list.set_values(options);
179}
180
182{
183 listbox& list = find_widget<listbox>("savegame_list");
184
185 list.clear();
186
187 games_ = save_index_manager_->get_saves_list();
188
189 for(const auto& game : games_) {
190 std::string name = game.name();
191 utils::ellipsis_truncate(name, 40);
192
193 list.add_row(widget_data{
194 { "filename", {
195 { "label", std::move(name) }
196 }},
197 { "date", {
198 { "label", game.format_time_summary() }
199 }},
200 });
201 }
202
203 find_widget<button>("delete").set_active(!save_index_manager_->read_only());
204}
205
207{
208 filename_ = game.name();
209 summary_ = game.summary();
210
211 find_widget<minimap>("minimap")
212 .set_map_data(summary_["map_data"]);
213
214 find_widget<label>("lblScenario")
215 .set_label(summary_["label"].t_str());
216
217 listbox& leader_list = find_widget<listbox>("leader_list");
218
219 leader_list.clear();
220
221 const std::string sprite_scale_mod = (formatter() << "~SCALE_INTO(" << game_config::tile_size << ',' << game_config::tile_size << ')').str();
222
223 unsigned li = 0;
224 for(const auto& leader : summary_.child_range("leader")) {
226 widget_item item;
227
228 // First, we evaluate whether the leader image as provided exists.
229 // If not, we try getting a binary path-independent path. If that still doesn't
230 // work, we fallback on unknown-unit.png.
231 std::string leader_image = leader["leader_image"].str();
232 if(!::image::exists(leader_image)) {
233 auto indep_path = filesystem::get_independent_binary_file_path("images", leader_image);
234
235 // The leader TC modifier isn't appending if the independent image path can't
236 // be resolved during save_index entry creation, so we need to add it here.
237 if(indep_path) {
238 leader_image = indep_path.value() + leader["leader_image_tc_modifier"].str();
239 }
240 }
241
242 if(leader_image.empty()) {
243 leader_image = "units/unknown-unit.png" + leader["leader_image_tc_modifier"].str();
244 } else {
245 // Scale down any sprites larger than 72x72
246 leader_image += sprite_scale_mod + "~FL(horiz)";
247 }
248
249 item["label"] = leader_image;
250 data.emplace("imgLeader", item);
251
252 item["label"] = leader["leader_name"].t_str();
253 data.emplace("leader_name", item);
254
255 item["label"] = leader["gold"].str();
256 data.emplace("leader_gold", item);
257
258 // TRANSLATORS: "reserve" refers to units on the recall list
259 item["label"] = VGETTEXT("$active active, $reserve reserve", {{"active", leader["units"].str()}, {"reserve", leader["recall_units"].str()}});
260 data.emplace("leader_troops", item);
261
262 leader_list.add_row(data);
263
264 // FIXME: hack. In order to use the listbox in view-only mode, you also need to
265 // disable the max number of "selected items", since in this mode, "selected" is
266 // synonymous with "visible". This basically just flags all rows as visible. Need
267 // a better solution at some point
268 leader_list.select_row(li++, true);
269 }
270
271 std::stringstream str;
272 str << game.format_time_local() << "\n";
274
275 // The new label value may have more or less lines than the previous value, so invalidate the layout.
276 find_widget<styled_widget>("slblSummary").set_label(str.str());
277 //invalidate_layout();
278
279 toggle_button& replay_toggle = dynamic_cast<toggle_button&>(*show_replay_->get_widget());
280 toggle_button& cancel_orders_toggle = dynamic_cast<toggle_button&>(*cancel_orders_->get_widget());
281 menu_button& difficulty_menu = find_widget<menu_button>("difficulty_menu");
282 menu_button& rng_menu = find_widget<menu_button>("rng_menu");
283
284 const bool is_replay = savegame::is_replay_save(summary_);
285 const bool is_scenario_start = summary_["turn"].empty();
286
287 // Always toggle show_replay on if the save is a replay
288 replay_toggle.set_value(is_replay);
289 replay_toggle.set_active(!is_replay && !is_scenario_start);
290
291 // Cancel orders doesn't make sense on replay saves or start-of-scenario saves
292 cancel_orders_toggle.set_active(!is_replay && !is_scenario_start);
293
294 // If this save is attached to a campaign, load the campaign's difficulty options with the save's current difficulty selected
295 const auto campaign = cache_config_.find_child("campaign", "id", summary_["campaign"].str());
296 const bool has_difficulties = campaign
297 && campaign_selection::set_difficulty_list(difficulty_menu, *campaign, summary_["difficulty"].str());
298
299 // If this save doesn't have difficulty options (multiplayer scenarios, add-on that's since been uninstalled, etc), show a blank option.
300 if(!has_difficulties) {
301 difficulty_menu.set_values({config{"label", ""}});
302 }
303
304 // Changing difficulty doesn't make sense on non-start-of-scenario saves
305 difficulty_menu.set_active(has_difficulties && !is_replay && is_scenario_start);
306
307 // Only allow changing RNG mode on start-of-scenario save
308 campaign_selection::select_rng_option(rng_menu, summary_["random_mode"].str());
309 rng_menu.set_active(!is_replay && is_scenario_start);
310}
311
312// This is a wrapper that prevents a corrupted save file (if it happens to be
313// the first in the list) from making the dialog fail to open.
315{
316 bool successfully_displayed_a_game = false;
317
318 try {
319 const int selected_row = find_widget<listbox>("savegame_list").get_selected_row();
320 if(selected_row < 0) {
321 find_widget<button>("delete").set_active(false);
322 } else {
323 find_widget<button>("delete").set_active(!save_index_manager_->read_only());
325 successfully_displayed_a_game = true;
326 }
327 } catch(const config::error& e) {
328 // Clear the UI widgets, show an error message.
329 const std::string preamble = _("The selected file is corrupt: ");
330 const std::string message = e.message.empty() ? "(no details)" : e.message;
331 ERR_GAMELOADDLG << preamble << message;
332 }
333
334 if(!successfully_displayed_a_game) {
335 find_widget<minimap>("minimap").set_map_data("");
336 find_widget<label>("lblScenario")
337 .set_label("");
338 find_widget<styled_widget>("slblSummary")
339 .set_label("");
340
341 listbox& leader_list = find_widget<listbox>("leader_list");
342 leader_list.clear();
343
344 toggle_button& replay_toggle = dynamic_cast<toggle_button&>(*show_replay_->get_widget());
345 toggle_button& cancel_orders_toggle = dynamic_cast<toggle_button&>(*cancel_orders_->get_widget());
346
347 replay_toggle.set_active(false);
348 cancel_orders_toggle.set_active(false);
349 find_widget<menu_button>("difficulty_menu").set_active(false);
350 find_widget<menu_button>("rng_menu").set_active(false);
351 }
352
353 // Disable Load button if nothing is selected or if the currently selected file can't be loaded
354 find_widget<button>("ok").set_active(successfully_displayed_a_game);
355
356 // Disable 'Enter' loading in the same circumstance
357 set_enter_disabled(!successfully_displayed_a_game);
358}
359
360void game_load::apply_filter_text(const std::string& text)
361{
362 find_widget<listbox>("savegame_list").filter_rows_by(
363 [this, match = translation::make_ci_matcher(text)](std::size_t row) { return match(games_[row].name()); });
364}
365
366void game_load::evaluate_summary_string(std::stringstream& str, const config& cfg_summary)
367{
368 if(cfg_summary["corrupt"].to_bool()) {
369 str << "\n" << markup::span_color("#f00", _("(Invalid)"));
370 // \todo: this skips the catch() statement in display_savegame. Low priority, as the
371 // dialog's state is reasonable; the "load" button is inactive, the "delete" button is
372 // active, and (cosmetic bug) it leaves the "change difficulty" toggle active. Can be
373 // triggered by creating an empty file in the save directory.
374 return;
375 }
376
377 const std::string& campaign_type = cfg_summary["campaign_type"];
378 const std::string campaign_id = cfg_summary["campaign"];
379 auto campaign_type_enum = campaign_type::get_enum(campaign_type);
380
381 if(campaign_type_enum) {
382 switch(*campaign_type_enum) {
383 case campaign_type::type::scenario: {
384 const auto campaign = cache_config_.find_child("campaign", "id", campaign_id);
385 utils::string_map symbols;
386
387 if(campaign) {
388 symbols["campaign_name"] = (*campaign)["name"].t_str();
389 } else {
390 // Fallback to nontranslatable campaign id.
391 symbols["campaign_name"] = "(" + campaign_id + ")";
392 }
393
394 str << VGETTEXT("Campaign: $campaign_name", symbols);
395
396 // Display internal id for debug purposes if we didn't above
397 if(game_config::debug && campaign) {
398 str << '\n' << "(" << campaign_id << ")";
399 }
400 break;
401 }
402 case campaign_type::type::multiplayer:
403 str << _("Multiplayer");
404 break;
405 case campaign_type::type::tutorial:
406 str << _("Tutorial");
407 break;
408 case campaign_type::type::test:
409 str << _("Test scenario");
410 break;
411 }
412 } else {
413 str << campaign_type;
414 }
415
416 str << "\n";
417
418 if(savegame::is_replay_save(cfg_summary)) {
419 str << _("Replay");
420 } else if(!cfg_summary["turn"].empty()) {
421 str << _("Turn") << " " << cfg_summary["turn"];
422 } else {
423 str << _("Scenario start");
424 }
425
426 if(campaign_type_enum) {
427 switch (*campaign_type_enum) {
428 case campaign_type::type::scenario:
429 case campaign_type::type::multiplayer: {
430 // 'SCENARIO' or SP should only ever be campaigns
431 // 'MULTIPLAYER' may be a campaign with difficulty or single scenario without difficulty
432 // For the latter do not show the difficulty - even though it will be listed as
433 // NORMAL -> Medium in the save file it should not be considered valid (GitHub Issue #5321)
434 if(auto campaign = cache_config_.find_child("campaign", "id", campaign_id)) {
435 str << "\n" << _("Difficulty: ");
436 try {
437 const config& difficulty = campaign->find_mandatory_child("difficulty", "define", cfg_summary["difficulty"]);
438 std::ostringstream ss;
439 ss << difficulty["label"] << " (" << difficulty["description"] << ")";
440 str << ss.str();
441 }
442 catch (const config::error&) {
443 // fall back to standard difficulty string in case of exception
444 str << string_table[cfg_summary["difficulty"]];
445 }
446 }
447
448 break;
449 }
450 case campaign_type::type::tutorial:
451 case campaign_type::type::test:
452 break;
453 }
454 } else {
455 }
456
457 if(campaign_type_enum == campaign_type::type::scenario && !savegame::is_replay_save(cfg_summary)) {
458 const std::string random_mode = cfg_summary["random_mode"].str();
459
460 str << "\n" << _("Combat:") << " ";
461 if(random_mode == "deterministic") {
462 str << _("Predictable RNG");
463 } else if(random_mode == "biased") {
464 str << _("Reduced RNG");
465 } else {
466 str << _("Default RNG");
467 }
468 }
469
470 if(!cfg_summary["version"].empty()) {
471 str << "\n" << _("Version: ") << cfg_summary["version"];
472 }
473
474 const std::vector<std::string>& active_mods = utils::split(cfg_summary["active_mods"]);
475 if(!active_mods.empty()) {
476 str << "\n" << _("Modifications: ");
477 for(const auto& mod_id : active_mods) {
478 std::string mod_name;
479 try {
480 mod_name = cache_config_.find_mandatory_child("modification", "id", mod_id)["name"].str();
481 } catch(const config::error&) {
482 // Fallback to nontranslatable mod id.
483 mod_name = "(" + mod_id + ")";
484 }
485
486 str << "\n" << font::unicode_bullet << " " << mod_name;
487 }
488 }
489}
494
496{
497 listbox& list = find_widget<listbox>("savegame_list");
498
499 const std::size_t index = std::size_t(list.get_selected_row());
500 if(index < games_.size()) {
501
502 // See if we should ask the user for deletion confirmation
503 if(prefs::get().ask_delete()) {
504 if(!gui2::dialogs::game_delete::execute()) {
505 return;
506 }
507 }
508
509 // Delete the file
510 save_index_manager_->delete_game(games_[index].name());
511
512 // Remove it from the list of saves
513 games_.erase(games_.begin() + index);
514
515 list.remove_row(index);
516
518 }
519}
520
521void game_load::key_press_callback(const SDL_Keycode key)
522{
523 //
524 // Don't delete games when we're typing in the textbox!
525 //
526 // I'm not sure if this check was necessary when I first added this feature
527 // (I didn't check at the time), but regardless, it's needed now. If it turns
528 // out I screwed something up in my refactoring, I'll remove
529 //
530 // - vultraz, 2017-08-28
531 //
532 if(find_widget<text_box>("txtFilter").get_state() == text_box_base::FOCUSED) {
533 return;
534 }
535
536 if(key == SDLK_DELETE) {
538 }
539}
540
542{
543 menu_button& dir_list = find_widget<menu_button>("dirList");
544
545 const auto& path = dir_list.get_value_config()["path"].str();
546 if(path.empty()) {
548 } else {
549 save_index_manager_ = std::make_shared<savegame::save_index_class>(path);
550 }
551
553 if(auto* filter = find_widget<text_box>("txtFilter", false, true)) {
554 apply_filter_text(filter->get_value());
555 }
557}
558
559} // namespace dialogs
std::string filename_
string_enums::enum_base< campaign_type_defines > campaign_type
A config object defines a single node in a WML file, with access to child nodes.
Definition config.hpp:157
config & find_mandatory_child(std::string_view key, const std::string &name, const std::string &value)
Definition config.cpp:776
child_itors child_range(std::string_view key)
Definition config.cpp:260
bool empty() const
Definition config.cpp:815
std::ostringstream wrapper.
Definition formatter.hpp:40
const config & find_mandatory_child(std::string_view key, const std::string &name, const std::string &value) const
optional_const_config find_child(std::string_view key, const std::string &name, const std::string &value) const
static std::string get_selected_rng_option(const menu_button &rng_menu)
Returns the random_mode for the given RNG menu's selected option.
static void select_rng_option(menu_button &rng_menu, const std::string &random_mode)
Selects the given RNG menu's option for the given random_mode.
static bool set_difficulty_list(menu_button &diff_menu, const config &campaign, const std::string &selected="")
Fills the given difficulty menu with options from the given campaign.
void display_savegame_internal(const savegame::save_info &game)
Part of display_savegame that might throw a config::error if the savegame data is corrupt.
void apply_filter_text(const std::string &text)
Hides saves not matching the given filter.
field_bool * show_replay_
Definition game_load.hpp:67
virtual void pre_show() override
Actions to be taken before showing the window.
Definition game_load.cpp:96
void key_press_callback(const SDL_Keycode key)
std::string & difficulty_
Definition game_load.hpp:70
void evaluate_summary_string(std::stringstream &str, const config &cfg_summary)
void set_save_dir_list(menu_button &dir_list)
field_bool * cancel_orders_
Definition game_load.hpp:68
const game_config_view & cache_config_
Definition game_load.hpp:76
utils::optional< std::string > & random_mode_
Definition game_load.hpp:71
std::shared_ptr< savegame::save_index_class > & save_index_manager_
Definition game_load.hpp:65
std::string & filename_
Definition game_load.hpp:64
std::vector< savegame::save_info > games_
Definition game_load.hpp:75
void populate_game_list()
Update (both internally and visually) the list of games.
game_load(savegame::load_game_metadata &data)
Definition game_load.cpp:82
virtual void post_show() override
Actions to be taken after the window has been shown.
Main class to show messages to the user.
Definition message.hpp:36
message(const std::string &title, const std::string &message, const bool auto_close, const bool message_use_markup, const bool title_use_markup)
Definition message.hpp:40
Abstract base class for all modal dialogs.
bool show(const unsigned auto_close_time=0)
Shows the window.
styled_widget * get_widget()
Definition field.hpp:192
void set_active(const bool active)
Activates all children.
Definition grid.cpp:167
The listbox class.
Definition listbox.hpp:41
grid & add_row(const widget_item &item, const int index=-1)
When an item in the list is selected by the user we need to update the state.
Definition listbox.cpp:92
void set_sorters(Args &&... functors)
Registers sorting controls using magic index IDs.
Definition listbox.hpp:306
bool select_row(const unsigned row, const bool select=true)
Selects a row.
Definition listbox.cpp:267
void remove_row(const unsigned row, unsigned count=1)
Removes a row in the listbox.
Definition listbox.cpp:108
void clear()
Removes all the rows in the listbox, clearing it.
Definition listbox.cpp:147
int get_selected_row() const
Returns the first selected row.
Definition listbox.cpp:290
void set_values(const std::vector<::config > &values, unsigned selected=0)
const ::config & get_value_config() const
Returns the entire config object for the selected row.
virtual void set_active(const bool active) override
See styled_widget::set_active.
virtual bool get_active() const override
See styled_widget::get_active.
virtual unsigned get_state() const override
See styled_widget::get_state.
Definition panel.cpp:61
virtual void set_label(const t_string &text)
virtual void set_use_markup(bool use_markup)
A widget that allows the user to input text in single line.
Definition text_box.hpp:125
virtual void set_value(unsigned selected, bool fire_event=false) override
Inherited from selectable_item.
virtual void set_active(const bool active) override
See styled_widget::set_active.
void set_visible(const visibility visible)
Definition widget.cpp:479
@ invisible
The user set the widget invisible, that means:
void set_enter_disabled(const bool enter_disabled)
Disable the enter key.
Definition window.hpp:313
void keyboard_capture(widget *widget)
Definition window.cpp:1205
void add_to_keyboard_chain(widget *widget)
Adds the widget to the keyboard chain.
Definition window.cpp:1219
int get_retval()
Definition window.hpp:394
static prefs & get()
static std::shared_ptr< save_index_class > default_saves_dir()
Returns an instance for managing saves in filesystem::get_saves_dir()
Filename and modification date for a file list.
Implements some helper classes to ease adding fields to a dialog and hide the synchronization needed.
Declarations for File-IO.
#define VGETTEXT(msgid,...)
Handy wrappers around interpolate_variables_into_string and gettext.
#define ERR_GAMELOADDLG
Definition game_load.cpp:51
static lg::log_domain log_gameloaddlg
Definition game_load.cpp:50
static std::string _(const char *str)
Definition gettext.hpp:100
This file contains the window object, this object is a top level container which has the event manage...
auto string_table
Definition language.hpp:81
#define REGISTER_DIALOG(window_id)
Wrapper for REGISTER_DIALOG2.
bool open_object(const std::string &path_or_url)
Opens the specified object with the default application configured for its type.
Definition open.cpp:50
utils::optional< std::string > get_independent_binary_file_path(const std::string &type, const std::string &filename)
Returns an asset path to filename for binary path-independent use in saved games.
std::vector< other_version_dir > find_other_version_saves_dirs()
Searches for directories containing saves created by other versions of Wesnoth.
const std::string unicode_bullet
Definition constants.cpp:47
Game configuration data as global variables.
const bool & debug
unsigned int tile_size
std::map< std::string, widget_item > widget_data
Definition widget.hpp:36
std::map< std::string, t_string > widget_item
Definition widget.hpp:33
void show_transient_message(const std::string &title, const std::string &message, const std::string &image, const bool message_use_markup, const bool title_use_markup)
Shows a transient message to the user.
@ OK
Dialog was closed with the OK button.
Definition retval.hpp:35
bool exists(const image::locator &i_locator)
Returns true if the given image actually exists, without loading it.
Definition picture.cpp:993
std::string span_color(const color_t &color, Args &&... data)
Applies Pango markup to the input specifying its display color.
Definition markup.hpp:110
bool is_replay_save(const config &summary)
Definition savegame.hpp:103
auto make_ci_matcher(std::string_view filter_text)
Returns a function which performs locale-aware case-insensitive search.
void ellipsis_truncate(std::string &str, const std::size_t size)
Truncates a string to a given utf-8 character count and then appends an ellipsis.
std::map< std::string, t_string > string_map
std::vector< std::string > split(const config_attribute_value &val)
Desktop environment interaction functions.
std::string_view data
Definition picture.cpp:188
std::string filename
Filename.
The base template for associating string values with enum values.
Definition enum_base.hpp:33
static constexpr utils::optional< enum_type > get_enum(const std::string_view value)
Converts a string into its enum equivalent.
Definition enum_base.hpp:57
#define i
#define e