The Battle for Wesnoth 1.21.0-dev
 
Loading...
Searching...
No Matches
mp_create_game.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2008 - 2025
3 by Mark de Wever <koraq@xs4all.nl>
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#pragma once
17
21
23
24
25namespace gui2
26{
27class toggle_button;
28class listbox;
29class menu_button;
30
31namespace dialogs
32{
33
35{
36 typedef std::pair<level_type::type, std::string> level_type_info;
37
38public:
39 mp_create_game(saved_game& state, bool local_mode);
40
41 /** The execute function. See @ref modal_dialog for more information. */
43
44 /**
45 * @a presets needs to be a copy!
46 * Otherwise you'll get segfaults when clicking the Join button since it results in the configs getting reloaded.
47 */
48 static void quick_mp_setup(saved_game& state, const config presets);
49
50private:
51 virtual const std::string& window_id() const override;
52
53 virtual void pre_show() override;
54
55 virtual void post_show() override;
56
58 std::unique_ptr<mp_options_helper> options_manager_;
59
62
63 std::vector<level_type_info> level_types_;
64
65 void update_games_list();
66 void display_games_of_type(level_type::type type, const std::string& level);
67
70
71 /**
72 * All fields are also in the normal field vector, but they need to be
73 * manually controlled as well so add the pointers here as well.
74 */
75
85
94
97
99
101
102 template<typename widget>
103 void on_filter_change(const std::string& id, bool do_select);
104
105 void on_game_select();
106 void on_tab_select();
107 void on_era_select();
108 void on_mod_toggle(const std::string& id, toggle_button* sender);
110
111 std::vector<std::string> get_active_mods();
112 void set_active_mods(const std::vector<std::string>& val);
113
114 void sync_with_depcheck();
115
116 void show_description(const std::string& new_description);
117
118 void update_details();
119 void update_map_settings();
120
122
123 /**
124 * Dialog exit hook to bring up the difficulty dialog when starting a campaign.
125 * This only fires when the retval is OK (ie, creating a game), meaning it does not fire
126 * when loading a saved game.
127 */
128 bool dialog_exit_hook();
129
130 int convert_to_game_filtered_index(const unsigned int initial_index);
131
132 void load_game_callback();
133
134 void save_preset();
135
136 void backup_settings();
137
139
141};
142
143} // namespace dialogs
144} // namespace gui2
A config object defines a single node in a WML file, with access to child nodes.
Definition config.hpp:157
Abstract base class for all modal dialogs.
std::pair< level_type::type, std::string > level_type_info
void display_games_of_type(level_type::type type, const std::string &level)
virtual void post_show() override
Actions to be taken after the window has been shown.
void set_active_mods(const std::vector< std::string > &val)
void show_description(const std::string &new_description)
virtual void pre_show() override
Actions to be taken before showing the window.
void on_mod_toggle(const std::string &id, toggle_button *sender)
std::unique_ptr< mp_options_helper > options_manager_
virtual const std::string & window_id() const override
The ID of the window to build.
std::vector< level_type_info > level_types_
DEFINE_SIMPLE_EXECUTE_WRAPPER(mp_create_game)
The execute function.
void on_filter_change(const std::string &id, bool do_select)
static void quick_mp_setup(saved_game &state, const config presets)
presets needs to be a copy! Otherwise you'll get segfaults when clicking the Join button since it res...
std::vector< std::string > get_active_mods()
bool dialog_exit_hook()
Dialog exit hook to bring up the difficulty dialog when starting a campaign.
int convert_to_game_filtered_index(const unsigned int initial_index)
field_bool * use_map_settings_
All fields are also in the normal field vector, but they need to be manually controlled as well so ad...
Specialized field class for boolean.
Definition field.hpp:488
Template class to implement the generic field implementation.
Definition field.hpp:245
The listbox class.
Definition listbox.hpp:41
static const std::string & type()
Static type getter that does not rely on the widget being constructed.
Various uncategorised dialogs.
Generic file dialog.