The Battle for Wesnoth  1.15.1+dev
mp_join_game.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 class tree_view_node;
30 
31 namespace dialogs
32 {
33 class faction_select;
34 
35 class mp_join_game : public modal_dialog, private plugin_executor
36 {
37 public:
38  mp_join_game(saved_game& state, mp::lobby_info& lobby_info, wesnothd_connection& connection,
39  const bool first_scenario = true, const bool observe_game = false);
40 
41  ~mp_join_game();
42 
43  bool fetch_game_config();
44  bool started() const { return level_["started"].to_bool(); }
45 private:
46  /** Inherited from modal_dialog, implemented by REGISTER_DIALOG. */
47  virtual const std::string& window_id() const override;
48 
49  /** Inherited from modal_dialog. */
50  virtual void pre_show(window& window) override;
51 
52  /** Inherited from modal_dialog. */
53  virtual void post_show(window& window) override;
54 
55  /** @returns false if an error ocurred. */
56  bool show_flg_select(int side_num, bool first_time = false);
57 
58  void generate_side_list(window& window);
59 
60  /**
61  * Will close the Faction Select dialog if it's open.
62  *
63  * This is used in @ref network_handler to dismiss the dialog if certain actions
64  * occur, such as the game starting.
65  *
66  * @todo maybe move this to a general-purpose close() function in @ref modal_dialog
67  * and @ref modeless_dialog? It could be useful.
68  */
70 
71  void network_handler(window& window);
72 
74 
76 
78 
80 
82 
83  std::size_t update_timer_;
84 
85  const bool first_scenario_;
86 
89 
90  std::map<std::string, tree_view_node*> team_tree_map_;
91 
92  std::unique_ptr<player_list_helper> player_list_;
93 
95 };
96 
97 } // namespace dialogs
98 } // namespace gui2
This class represents the collective information the client has about the players and games on the se...
Definition: lobby_info.hpp:30
faction_select * flg_dialog_
mp_join_game(saved_game &state, mp::lobby_info &lobby_info, wesnothd_connection &connection, const bool first_scenario=true, const bool observe_game=false)
wesnothd_connection & network_connection_
void generate_side_list(window &window)
Generic file dialog.
Definition: field-fwd.hpp:22
virtual const std::string & window_id() const override
Inherited from modal_dialog, implemented by REGISTER_DIALOG.
void network_handler(window &window)
A class that represents a TCP/IP connection to the wesnothd server.
bool show_flg_select(int side_num, bool first_time=false)
mp::lobby_info & lobby_info_
void close_faction_select_dialog_if_open()
Will close the Faction Select dialog if it&#39;s open.
Various uncategorised dialogs.
std::unique_ptr< player_list_helper > player_list_
-file mapgen.hpp
std::map< std::string, tree_view_node * > team_tree_map_
Managing the AIs configuration - headers.
virtual void post_show(window &window) override
Inherited from modal_dialog.
Abstract base class for all modal dialogs.
virtual void pre_show(window &window) override
Inherited from modal_dialog.
A config object defines a single node in a WML file, with access to child nodes.
Definition: config.hpp:92
base class of top level items, the only item which needs to store the final canvases to draw on ...
Definition: window.hpp:63