The Battle for Wesnoth  1.15.1+dev
mp_staging.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2008 - 2018 by the Battle for Wesnoth Project https://www.wesnoth.org/
3 
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or
7  (at your option) any later version.
8  This program is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY.
10 
11  See the COPYING file for more details.
12 */
13 
14 #pragma once
15 
16 #include "ai/configuration.hpp"
23 #include "mp_game_settings.hpp"
24 
25 class config;
26 
27 namespace gui2
28 {
29 
30 class menu_button;
31 class slider;
32 class tree_view_node;
33 
34 namespace dialogs
35 {
36 
37 class mp_staging : public modal_dialog, private plugin_executor
38 {
39 public:
40  mp_staging(ng::connect_engine& connect_engine, mp::lobby_info& lobby_info, wesnothd_connection* connection = nullptr);
41 
42  ~mp_staging();
43 
44 private:
45  /** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */
46  virtual const std::string& window_id() const override;
47 
48  /** Inherited from modal_dialog. */
49  virtual void pre_show(window& window) override;
50 
51  /** Inherited from modal_dialog. */
52  virtual void post_show(window& window) override;
53 
54  void add_side_node(window& window, ng::side_engine_ptr side);
55 
56  /**
57  * Find an appropriate position to insert a side node.
58  *
59  * This ensures the side nodes are always arranged by descending index order
60  * in each team group.
61  */
63 
64  void on_controller_select(ng::side_engine_ptr side, grid& row_grid);
65  void on_ai_select(ng::side_engine_ptr side, menu_button& ai_menu, const bool saved_game);
66  void on_color_select(ng::side_engine_ptr side, grid& row_grid);
67  void on_team_select(window& window, ng::side_engine_ptr side, menu_button& team_menu);
68 
69  template<void(ng::side_engine::*fptr)(int)>
71 
72  void select_leader_callback(ng::side_engine_ptr side, grid& row_grid);
73 
74  void update_leader_display(ng::side_engine_ptr side, grid& row_grid);
75  void update_status_label_and_buttons(window& window);
76 
77  void network_handler(window& window);
78 
80  {
81  state_changed_ = true;
82  }
83 
85 
86  std::vector<ai::description*> ai_algorithms_;
87 
89 
91 
92  std::size_t update_timer_;
93 
95 
96  std::map<std::string, tree_view_node*> team_tree_map_;
97  std::map<ng::side_engine_ptr, tree_view_node*> side_tree_map_;
98 
99  std::unique_ptr<player_list_helper> player_list_;
100 };
101 
102 } // namespace dialogs
103 } // namespace gui2
void update_status_label_and_buttons(window &window)
Definition: mp_staging.cpp:481
virtual const std::string & window_id() const override
Inherited from modal_dialog, implemented by REGISTER_DIALOG.
Simple push button.
Definition: menu_button.hpp:41
int get_side_node_position(ng::side_engine_ptr side) const
Find an appropriate position to insert a side node.
Definition: mp_staging.cpp:150
This class represents the collective information the client has about the players and games on the se...
Definition: lobby_info.hpp:30
ng::connect_engine & connect_engine_
Definition: mp_staging.hpp:84
Generic file dialog.
Definition: field-fwd.hpp:22
Base container class.
Definition: grid.hpp:30
void update_leader_display(ng::side_engine_ptr side, grid &row_grid)
Definition: mp_staging.cpp:438
std::unique_ptr< player_list_helper > player_list_
Definition: mp_staging.hpp:99
void on_controller_select(ng::side_engine_ptr side, grid &row_grid)
Definition: mp_staging.cpp:359
A class that represents a TCP/IP connection to the wesnothd server.
void on_side_slider_change(ng::side_engine_ptr side, slider &slider)
Definition: mp_staging.cpp:431
virtual void pre_show(window &window) override
Inherited from modal_dialog.
Definition: mp_staging.cpp:73
mp::lobby_info & lobby_info_
Definition: mp_staging.hpp:88
Various uncategorised dialogs.
std::vector< ai::description * > ai_algorithms_
Definition: mp_staging.hpp:86
void network_handler(window &window)
Definition: mp_staging.cpp:492
wesnothd_connection * network_connection_
Definition: mp_staging.hpp:90
void select_leader_callback(ng::side_engine_ptr side, grid &row_grid)
Definition: mp_staging.cpp:421
std::shared_ptr< side_engine > side_engine_ptr
-file mapgen.hpp
void on_ai_select(ng::side_engine_ptr side, menu_button &ai_menu, const bool saved_game)
Definition: mp_staging.cpp:371
void add_side_node(window &window, ng::side_engine_ptr side)
Definition: mp_staging.cpp:162
std::map< std::string, tree_view_node * > team_tree_map_
Definition: mp_staging.hpp:96
virtual void post_show(window &window) override
Inherited from modal_dialog.
Definition: mp_staging.cpp:553
A slider.
Definition: slider.hpp:33
Managing the AIs configuration - headers.
Abstract base class for all modal dialogs.
mp_staging(ng::connect_engine &connect_engine, mp::lobby_info &lobby_info, wesnothd_connection *connection=nullptr)
Definition: mp_staging.cpp:49
void on_color_select(ng::side_engine_ptr side, grid &row_grid)
Definition: mp_staging.cpp:389
A config object defines a single node in a WML file, with access to child nodes.
Definition: config.hpp:92
void on_team_select(window &window, ng::side_engine_ptr side, menu_button &team_menu)
Definition: mp_staging.cpp:398
base class of top level items, the only item which needs to store the final canvases to draw on ...
Definition: window.hpp:63
std::map< ng::side_engine_ptr, tree_view_node * > side_tree_map_
Definition: mp_staging.hpp:97