The Battle for Wesnoth 1.21.0-dev
 
Loading...
Searching...
No Matches
mp_host_game_prompt.cpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2012 - 2025
3 by Iris Morelle <shadowm2006@gmail.com>
4 Copyright (C) 2008 - 2018 by Jörg Hinrichs <joerg.hinrichs@alice-dsl.de>
5 Part of the Battle for Wesnoth Project https://www.wesnoth.org/
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY.
13
14 See the COPYING file for more details.
15*/
16
18
20
21namespace gui2::dialogs
22{
23
24REGISTER_DIALOG(mp_host_game_prompt)
25
26bool mp_host_game_prompt::get_do_not_show_again()
27{
28 return prefs::get().mp_server_warning_disabled() != 1;
29}
30
31/**
32 * Helper for @ref prefs::get().set_ask_delete_saves.
33 */
34static void set_do_not_show_again(const bool do_not_show_again)
35{
36 prefs::get().set_mp_server_warning_disabled(do_not_show_again ? 2 : 1);
37}
38
40 : modal_dialog(window_id())
41{
42 register_bool("do_not_show_again",
43 true,
46}
47
48} // namespace dialogs
Abstract base class for all modal dialogs.
field_bool * register_bool(const std::string &id, const bool mandatory, const std::function< bool()> &callback_load_value=nullptr, const std::function< void(bool)> &callback_save_value=nullptr, const std::function< void(widget &)> &callback_change=nullptr, const bool initial_fire=false)
Creates a new boolean field.
static bool get_do_not_show_again()
The execute function.
static prefs & get()
#define REGISTER_DIALOG(window_id)
Wrapper for REGISTER_DIALOG2.
static void set_do_not_show_again(const bool do_not_show_again)
Helper for .set_ask_delete_saves.