The Battle for Wesnoth  1.17.0-dev
mp_host_game_prompt.cpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2012 - 2021
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 #include "gui/widgets/settings.hpp"
21 
22 namespace gui2::dialogs
23 {
24 
25 REGISTER_DIALOG(mp_host_game_prompt)
26 
27 /**
28  * Helper for @ref preferences::ask_delete_saves.
29  */
30 static bool get_do_not_show_again()
31 {
33 }
34 
35 /**
36  * Helper for @ref preferences::set_ask_delete_saves.
37  */
38 static void set_do_not_show_again(const bool do_not_show_again)
39 {
40  preferences::set_mp_server_warning_disabled(do_not_show_again ? 2 : 1);
41 }
42 
44 {
45  set_restore(true);
46 
47  register_bool("do_not_show_again",
48  true,
51 }
52 
53 } // namespace dialogs
void set_mp_server_warning_disabled(int value)
Definition: game.cpp:510
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.
This file contains the settings handling of the widget library.
int mp_server_warning_disabled()
Definition: game.cpp:505
static bool get_do_not_show_again()
Helper for preferences::ask_delete_saves.
static void set_do_not_show_again(const bool do_not_show_again)
Helper for preferences::set_ask_delete_saves.
void set_restore(const bool restore)