The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
playsingle_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 PLAYSINGLE_CONTROLLER_H_INCLUDED
17 #define PLAYSINGLE_CONTROLLER_H_INCLUDED
18 
19 #include "play_controller.hpp"
20 
21 #include "cursor.hpp"
23 #include "playturn.hpp"
24 #include "replay.hpp"
25 #include "saved_game.hpp"
26 #include "replay_controller.hpp"
27 
28 class team;
29 
31 {
35 };
36 
38 {
39 public:
40  playsingle_controller(const config& level, saved_game& state_of_game,
41  const config& game_config, const tdata_cache & tdata, CVideo& video, bool skip_replay);
42  virtual ~playsingle_controller();
43 
44  LEVEL_RESULT play_scenario(const config& level);
45  void play_scenario_init();
47 
48  virtual void handle_generic_event(const std::string& name);
49 
50  virtual void check_objectives();
51  virtual void on_not_observer() {}
52  virtual void maybe_linger();
53 
54  void end_turn();
55  void force_end_turn();
56 
57  class hotkey_handler;
59 
62  virtual bool should_return_to_play_side();
64  bool is_replay() { return get_replay_controller() != nullptr; }
65  void enable_replay(bool is_unit_test = false);
66  void on_replay_end(bool is_unit_test);
67 protected:
68  virtual void play_side_impl();
69  void before_human_turn();
70  void show_turn_dialog();
71  void execute_gotos();
72  virtual void play_human_turn();
73  virtual void after_human_turn();
74  void end_turn_enable(bool enable);
75  void play_ai_turn();
76  virtual void play_idle_loop();
77  virtual void do_idle_notification();
78  virtual void play_network_turn();
79  virtual void init_gui();
80  void store_recalls();
81  void store_gold(bool obs = false);
82 
85 
90  {
91  /// The turn was not ended yet
93  /// And endturn was required eigher by the player, by the ai or by [end_turn]
95  /// An [end_turn] was added to the replay.
97  };
100  boost::scoped_ptr<replay_controller> replay_;
101  void linger();
102  void sync_end_turn();
103  void update_viewing_player();
104  void reset_replay();
105 };
106 
107 
108 #endif
GLboolean enable
Definition: glew.h:2589
GLint level
Definition: glew.h:1220
virtual void handle_generic_event(const std::string &name)
Definition: video.hpp:58
TODO: rename this class since it isn't that much related to turns.
Definition: playturn.hpp:28
And endturn was required eigher by the player, by the ai or by [end_turn].
void enable_replay(bool is_unit_test=false)
gui::floating_textbox textbox_info_
Replay control code.
virtual void do_idle_notification()
Will handle sending a networked notification in descendent classes.
GLdouble l
Definition: glew.h:6966
boost::shared_ptr< config > level
-file pathfind.hpp
void end_turn_enable(bool enable)
This class stores all the data for a single 'side' (in game nomenclature).
Definition: team.hpp:50
playsingle_controller(const config &level, saved_game &state_of_game, const config &game_config, const tdata_cache &tdata, CVideo &video, bool skip_replay)
virtual void play_network_turn()
Will handle networked turns in descendent classes.
LEVEL_RESULT play_scenario(const config &level)
replay_controller * get_replay_controller()
std::string describe_result() const
void on_replay_end(bool is_unit_test)
void store_gold(bool obs=false)
Game configuration data as global variables.
Definition: build_info.cpp:38
reset_gamestate_exception(boost::shared_ptr< config > l, bool s=true)
GLuint const GLchar * name
Definition: glew.h:1782
boost::scoped_ptr< replay_controller > replay_
playturn_network_adapter network_reader_
const cursor::setter cursor_setter
replay_network_sender replay_sender_
A config object defines a single node in a WML file, with access to child nodes.
Definition: config.hpp:83
virtual bool should_return_to_play_side()
GLdouble s
Definition: glew.h:1358
GLsizei const GLcharARB ** string
Definition: glew.h:4503
An [end_turn] was added to the replay.