The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
playmp_controller.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2006 - 2016 by Joerg Hinrichs <[email protected]>
3  wesnoth playlevel Copyright (C) 2003 by David White <[email protected]>
4  Part of the Battle for Wesnoth Project http://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 #ifndef PLAYMP_CONTROLLER_H_INCLUDED
17 #define PLAYMP_CONTROLLER_H_INCLUDED
18 
20 #include "syncmp_handler.hpp"
21 
22 class turn_info;
23 struct mp_campaign_info;
25 {
26 public:
27  playmp_controller(const config& level, saved_game& state_of_game,
28  const config& game_config,
29  const tdata_cache & tdata, CVideo& video,
30  mp_campaign_info* mp_info);
31  virtual ~playmp_controller();
32 
33  void maybe_linger();
34  void process_oos(const std::string& err_msg) const;
35 
36  void pull_remote_choice();
37  void send_user_choice();
38 
39  class hotkey_handler;
40 
41  bool is_networked_mp() const override;
42  void send_to_wesnothd(const config& cfg, const std::string& packet_type = "unknown") const override;
43  bool recieve_from_wesnothd(config& cfg) const override;
44 protected:
45  virtual void handle_generic_event(const std::string& name);
46 
47  void start_network();
48  void stop_network();
49 
50  virtual void play_side_impl();
51  virtual void play_human_turn();
52  virtual void play_linger_turn();
53  virtual void after_human_turn();
54  virtual void play_network_turn();
55  virtual void do_idle_notification();
56  virtual void play_idle_loop();
57 
58  void linger();
59  /** Wait for the host to upload the next scenario. */
60  void wait_for_upload();
61 
63 
64  virtual void on_not_observer();
65  bool is_host() const;
66  void remove_blindfold();
67 
69 private:
72  void process_network_data();
74 };
75 
76 #endif
GLint level
Definition: glew.h:1220
bool is_networked_mp() const override
Definition: video.hpp:58
void send_to_wesnothd(const config &cfg, const std::string &packet_type="unknown") const override
virtual void play_linger_turn()
TODO: rename this class since it isn't that much related to turns.
Definition: playturn.hpp:28
virtual void play_side_impl()
void wait_for_upload()
Wait for the host to upload the next scenario.
virtual void play_human_turn()
virtual void do_idle_notification()
Will handle sending a networked notification in descendent classes.
mp_campaign_info * mp_info_
virtual void play_idle_loop()
void process_oos(const std::string &err_msg) const
Asks the user whether to continue on an OOS error.
Game configuration data as global variables.
Definition: build_info.cpp:38
GLuint const GLchar * name
Definition: glew.h:1782
virtual void on_not_observer()
virtual void after_human_turn()
playmp_controller(const config &level, saved_game &state_of_game, const config &game_config, const tdata_cache &tdata, CVideo &video, mp_campaign_info *mp_info)
virtual void handle_generic_event(const std::string &name)
A config object defines a single node in a WML file, with access to child nodes.
Definition: config.hpp:83
virtual void play_network_turn()
Will handle networked turns in descendent classes.
GLsizei const GLcharARB ** string
Definition: glew.h:4503
bool recieve_from_wesnothd(config &cfg) const override