The Battle for Wesnoth 1.21.0-dev
 
Loading...
Searching...
No Matches
mp_staging.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2008 - 2025
3 Part of the Battle for Wesnoth Project https://www.wesnoth.org/
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY.
11
12 See the COPYING file for more details.
13*/
14
15#pragma once
16
20
22
23namespace ai
24{
25 struct description;
26}
27
28namespace gui2
29{
30class menu_button;
31class slider;
32class tree_view_node;
33class player_list_helper;
34
35namespace dialogs
36{
37
39{
40public:
41 mp_staging(ng::connect_engine& connect_engine, wesnothd_connection* connection = nullptr);
42
44
46
47private:
48 virtual const std::string& window_id() const override;
49
50 virtual void pre_show() override;
51
52 virtual void post_show() override;
53
54 template<typename... T>
55 tree_view_node& add_side_to_team_node(const ng::side_engine_ptr& side, T&&... params);
56
57 void add_side_node(const ng::side_engine_ptr& side);
58
59 /**
60 * Find an appropriate position to insert a side node.
61 *
62 * This ensures the side nodes are always arranged by descending index order
63 * in each team group.
64 */
65 int get_side_node_position(const ng::side_engine_ptr& side) const;
66
67 void on_controller_select(const ng::side_engine_ptr& side, grid& row_grid);
68 void on_ai_select(const ng::side_engine_ptr& side, menu_button& ai_menu, const bool saved_game);
69 void on_color_select(const ng::side_engine_ptr& side, grid& row_grid);
70 void on_team_select(const ng::side_engine_ptr& side, menu_button& team_menu);
71
72 template<void(ng::side_engine::*fptr)(int)>
74
75 void select_leader_callback(const ng::side_engine_ptr& side, grid& row_grid);
76
77 void update_leader_display(const ng::side_engine_ptr& side, grid& row_grid);
79
80 void network_handler();
81
83 {
84 state_changed_ = true;
85 }
86
88 {
90 }
91
93
94 std::vector<ai::description*> ai_algorithms_;
95
97
98 std::size_t update_timer_;
99
101
102 std::map<std::string, tree_view_node*> team_tree_map_;
103 std::map<ng::side_engine_ptr, tree_view_node*> side_tree_map_;
104
105 std::unique_ptr<player_list_helper> player_list_;
106};
107
108} // namespace dialogs
109} // namespace gui2
Abstract base class for all modal dialogs.
void update_leader_display(const ng::side_engine_ptr &side, grid &row_grid)
tree_view_node & add_side_to_team_node(const ng::side_engine_ptr &side, T &&... params)
wesnothd_connection * network_connection_
void on_color_select(const ng::side_engine_ptr &side, grid &row_grid)
virtual void post_show() override
Actions to be taken after the window has been shown.
void select_leader_callback(const ng::side_engine_ptr &side, grid &row_grid)
void on_ai_select(const ng::side_engine_ptr &side, menu_button &ai_menu, const bool saved_game)
ng::connect_engine & connect_engine_
int get_side_node_position(const ng::side_engine_ptr &side) const
Find an appropriate position to insert a side node.
void add_side_node(const ng::side_engine_ptr &side)
void on_team_select(const ng::side_engine_ptr &side, menu_button &team_menu)
std::map< ng::side_engine_ptr, tree_view_node * > side_tree_map_
std::unique_ptr< player_list_helper > player_list_
virtual const std::string & window_id() const override
The ID of the window to build.
std::vector< ai::description * > ai_algorithms_
std::map< std::string, tree_view_node * > team_tree_map_
virtual void pre_show() override
Actions to be taken before showing the window.
void on_side_slider_change(const ng::side_engine_ptr &side, slider &slider)
void on_controller_select(const ng::side_engine_ptr &side, grid &row_grid)
Base container class.
Definition grid.hpp:32
void set_retval(const int retval, const bool close_window=true)
Sets there return value of the window.
Definition window.hpp:387
A class that represents a TCP/IP connection to the wesnothd server.
#define DEFINE_SIMPLE_EXECUTE_WRAPPER(dialog)
Adds a bare-bonesstatic execute function to a dialog class that immediately invokes and return the re...
A small explanation about what's going on here: Each action has access to two game_info objects First...
Definition actions.cpp:59
Various uncategorised dialogs.
Generic file dialog.
@ OK
Dialog was closed with the OK button.
Definition retval.hpp:35
std::shared_ptr< side_engine > side_engine_ptr