The Battle for Wesnoth  1.15.2+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 
22 #include "mp_game_settings.hpp"
23 
24 class config;
25 
26 namespace ai
27 {
28  struct description;
29 }
30 
31 namespace gui2
32 {
33 
34 class menu_button;
35 class slider;
36 class tree_view_node;
37 
38 namespace dialogs
39 {
40 
41 class mp_staging : public modal_dialog, private plugin_executor
42 {
43 public:
44  mp_staging(ng::connect_engine& connect_engine, mp::lobby_info& lobby_info, wesnothd_connection* connection = nullptr);
45 
46  ~mp_staging();
47 
49 
50 private:
51  /** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */
52  virtual const std::string& window_id() const override;
53 
54  /** Inherited from modal_dialog. */
55  virtual void pre_show(window& window) override;
56 
57  /** Inherited from modal_dialog. */
58  virtual void post_show(window& window) override;
59 
60  void add_side_node(window& window, ng::side_engine_ptr side);
61 
62  /**
63  * Find an appropriate position to insert a side node.
64  *
65  * This ensures the side nodes are always arranged by descending index order
66  * in each team group.
67  */
68  int get_side_node_position(ng::side_engine_ptr side) const;
69 
70  void on_controller_select(ng::side_engine_ptr side, grid& row_grid);
71  void on_ai_select(ng::side_engine_ptr side, menu_button& ai_menu, const bool saved_game);
72  void on_color_select(ng::side_engine_ptr side, grid& row_grid);
73  void on_team_select(window& window, ng::side_engine_ptr side, menu_button& team_menu);
74 
75  template<void(ng::side_engine::*fptr)(int)>
76  void on_side_slider_change(ng::side_engine_ptr side, slider& slider);
77 
78  void select_leader_callback(ng::side_engine_ptr side, grid& row_grid);
79 
80  void update_leader_display(ng::side_engine_ptr side, grid& row_grid);
81  void update_status_label_and_buttons(window& window);
82 
83  void network_handler(window& window);
84 
86  {
87  state_changed_ = true;
88  }
89 
91 
92  std::vector<ai::description*> ai_algorithms_;
93 
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
Simple push button.
Definition: menu_button.hpp:41
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:90
Generic file dialog.
Definition: field-fwd.hpp:22
Base container class.
Definition: grid.hpp:30
A small explanation about what&#39;s going on here: Each action has access to two game_info objects First...
Definition: actions.cpp:58
std::unique_ptr< player_list_helper > player_list_
Definition: mp_staging.hpp:105
A class that represents a TCP/IP connection to the wesnothd server.
mp::lobby_info & lobby_info_
Definition: mp_staging.hpp:94
Various uncategorised dialogs.
std::vector< ai::description * > ai_algorithms_
Definition: mp_staging.hpp:92
wesnothd_connection * network_connection_
Definition: mp_staging.hpp:96
std::shared_ptr< side_engine > side_engine_ptr
-file mapgen.hpp
std::map< std::string, tree_view_node * > team_tree_map_
Definition: mp_staging.hpp:102
A slider.
Definition: slider.hpp:33
Abstract base class for all modal dialogs.
A config object defines a single node in a WML file, with access to child nodes.
Definition: config.hpp:68
base class of top level items, the only item which needs to store the final canvases to draw on ...
Definition: window.hpp:62
std::map< ng::side_engine_ptr, tree_view_node * > side_tree_map_
Definition: mp_staging.hpp:103