The Battle for Wesnoth  1.19.0-dev
mp_host_game_prompt.cpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2012 - 2024
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 
19 #include "preferences/game.hpp"
20 
21 namespace gui2::dialogs
22 {
23 
24 REGISTER_DIALOG(mp_host_game_prompt)
25 
26 /**
27  * Helper for @ref preferences::ask_delete_saves.
28  */
29 static bool get_do_not_show_again()
30 {
32 }
33 
34 /**
35  * Helper for @ref preferences::set_ask_delete_saves.
36  */
37 static void set_do_not_show_again(const bool do_not_show_again)
38 {
39  preferences::set_mp_server_warning_disabled(do_not_show_again ? 2 : 1);
40 }
41 
43  : modal_dialog(window_id())
44 {
45  register_bool("do_not_show_again",
46  true,
49 }
50 
51 } // 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()
Helper for preferences::ask_delete_saves.
REGISTER_DIALOG(tod_new_schedule)
static void set_do_not_show_again(const bool do_not_show_again)
Helper for preferences::set_ask_delete_saves.
void set_mp_server_warning_disabled(int value)
Definition: game.cpp:493
int mp_server_warning_disabled()
Definition: game.cpp:488