The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Classes | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
playsingle_controller Class Reference

#include <playsingle_controller.hpp>

Inheritance diagram for playsingle_controller:
Inheritance graph

Classes

class  hotkey_handler
 

Public Member Functions

 playsingle_controller (const config &level, saved_game &state_of_game, const config &game_config, const tdata_cache &tdata, CVideo &video, bool skip_replay)
 
virtual ~playsingle_controller ()
 
LEVEL_RESULT play_scenario (const config &level)
 
void play_scenario_init ()
 
void play_scenario_main_loop ()
 
virtual void handle_generic_event (const std::string &name)
 
virtual void check_objectives ()
 
virtual void on_not_observer ()
 
virtual void maybe_linger ()
 
void end_turn ()
 
void force_end_turn ()
 
std::string describe_result () const
 
bool get_player_type_changed () const
 
void set_player_type_changed ()
 
virtual bool should_return_to_play_side ()
 
replay_controllerget_replay_controller ()
 
bool is_replay ()
 
void enable_replay (bool is_unit_test=false)
 
void on_replay_end (bool is_unit_test)
 
- Public Member Functions inherited from play_controller
 play_controller (const config &level, saved_game &state_of_game, const config &game_config, const tdata_cache &tdata, CVideo &video, bool skip_replay)
 
virtual ~play_controller ()
 
bool can_undo () const
 
bool can_redo () const
 
void undo ()
 
void redo ()
 
void load_game ()
 
void save_game ()
 
void save_game_auto (const std::string &filename)
 
void save_replay ()
 
void save_replay_auto (const std::string &filename)
 
void save_map ()
 
void init_side_begin ()
 
void maybe_do_init_side ()
 Called by turn_info::process_network_data() or init_side() to call do_init_side() if necessary. More...
 
void do_init_side ()
 Called by replay handler or init_side() to do actual work for turn change. More...
 
void init_side_end ()
 
virtual void process_oos (const std::string &msg) const
 Asks the user whether to continue on an OOS error. More...
 
void set_end_level_data (const end_level_data &data)
 
void reset_end_level_data ()
 
bool is_regular_game_end () const
 
const end_level_dataget_end_level_data_const () const
 
const std::vector< team > & get_teams_const () const
 
const unit_mapget_units_const () const
 
const gamemapget_map_const () const
 
const tod_managerget_tod_manager_const () const
 
bool is_observer () const
 
game_stategamestate ()
 
const game_stategamestate () const
 
void check_victory ()
 Checks to see if a side has won. More...
 
size_t turn () const
 
int current_side () const
 Returns the number of the side whose turn it is. More...
 
config to_config () const
 Builds the snapshot config from members and their respective configs. More...
 
bool is_skipping_replay () const
 
void toggle_skipping_replay ()
 
bool is_linger_mode () const
 
void do_autosave ()
 
void do_consolesave (const std::string &filename)
 
events::mouse_handlerget_mouse_handler_base ()
 Get a reference to a mouse handler member a derived class uses. More...
 
events::menu_handlerget_menu_handler ()
 
boost::shared_ptr< wb::managerget_whiteboard ()
 
const mp_game_settingsget_mp_settings ()
 
const game_classificationget_classification ()
 
int get_server_request_number () const
 
void increase_server_request_number ()
 
game_events::t_pumppump ()
 
int get_ticks ()
 
virtual soundsource::managerget_soundsource_man ()
 Get (optionally) a soundsources manager a derived class uses. More...
 
virtual plugins_contextget_plugins_context ()
 Get (optionally) a plugins context a derived class uses. More...
 
hotkey::command_executorget_hotkey_command_executor ()
 Get (optionally) a command executor to handle context menu events. More...
 
actions::undo_listget_undo_stack ()
 
bool is_browsing () const override
 
bool is_lingering () const
 
t_string get_scenario_name ()
 
bool get_disallow_recall ()
 
std::string theme ()
 
void maybe_throw_return_to_play_side ()
 
void play_side ()
 
teamcurrent_team ()
 
const teamcurrent_team () const
 
bool can_use_synced_wml_menu () const
 
std::set< std::stringall_players () const
 
int ticks () const
 
game_displayget_display ()
 Get a reference to a display member a derived class uses. More...
 
void update_savegame_snapshot () const
 
void update_gui_to_player (const int team_index, const bool observe=false)
 Changes the UI for this client to the passed side index. More...
 
virtual bool is_networked_mp () const
 
virtual void send_to_wesnothd (const config &, const std::string &="unknown") const
 
virtual bool recieve_from_wesnothd (config &) const
 
- Public Member Functions inherited from controller_base
 controller_base (const config &game_config, CVideo &video)
 
virtual ~controller_base ()
 
void play_slice (bool is_delay_enabled=true)
 
void apply_keyboard_scroll (int x, int y)
 
void set_scroll_up (bool on)
 
void set_scroll_down (bool on)
 
void set_scroll_left (bool on)
 
void set_scroll_right (bool on)
 
- Public Member Functions inherited from events::sdl_handler
virtual void process_event ()
 
virtual void draw ()
 
virtual void volatile_draw ()
 
virtual void volatile_undraw ()
 
virtual bool requires_event_focus (const SDL_Event *=nullptr) const
 
virtual void process_help_string (int, int)
 
virtual void process_tooltip_string (int, int)
 
virtual void join ()
 
virtual void join (context &c)
 
virtual void join_same (sdl_handler *parent)
 
virtual void leave ()
 
virtual void join_global ()
 
virtual void leave_global ()
 
- Public Member Functions inherited from events::observer
virtual ~observer ()
 
- Public Member Functions inherited from quit_confirmation
 quit_confirmation (const std::function< bool()> &prompt=&quit_confirmation::default_prompt)
 
 ~quit_confirmation ()
 

Protected Types

enum  END_TURN_STATE { END_TURN_NONE, END_TURN_REQUIRED, END_TURN_SYNCED }
 

Protected Member Functions

virtual void play_side_impl ()
 
void before_human_turn ()
 
void show_turn_dialog ()
 
void execute_gotos ()
 
virtual void play_human_turn ()
 
virtual void after_human_turn ()
 
void end_turn_enable (bool enable)
 
void play_ai_turn ()
 
virtual void play_idle_loop ()
 
virtual void do_idle_notification ()
 Will handle sending a networked notification in descendent classes. More...
 
virtual void play_network_turn ()
 Will handle networked turns in descendent classes. More...
 
virtual void init_gui ()
 
void store_recalls ()
 
void store_gold (bool obs=false)
 
void linger ()
 
void sync_end_turn ()
 
void update_viewing_player ()
 
void reset_replay ()
 
- Protected Member Functions inherited from play_controller
void play_slice_catch ()
 
bool have_keyboard_focus ()
 Derived classes should override this to return false when arrow keys should not scroll the map, hotkeys not processed etc, for example when a textbox is active. More...
 
void process_focus_keydown_event (const SDL_Event &event)
 Process keydown (only when the general map display does not have focus). More...
 
void process_keydown_event (const SDL_Event &event)
 Process keydown (always). More...
 
void process_keyup_event (const SDL_Event &event)
 Process keyup (always). More...
 
void init_managers ()
 
void fire_preload ()
 preload events cannot be synced More...
 
void fire_prestart ()
 
void fire_start ()
 
void start_game ()
 
void finish_side_turn ()
 
void finish_turn ()
 
bool enemies_visible () const
 
void enter_textbox ()
 
void tab ()
 
bool is_team_visible (int team_num, bool observer) const
 
int find_last_visible_team () const
 returns 0 if no such team was found. More...
 
actions::undo_listundo_stack ()
 
const actions::undo_listundo_stack () const
 
const std::stringselect_victory_music () const
 
const std::stringselect_defeat_music () const
 
void set_victory_music_list (const std::string &list)
 
void set_defeat_music_list (const std::string &list)
 
void reset_gamestate (const config &level, int replay_pos)
 
virtual void check_time_over ()
 
void play_turn ()
 
- Protected Member Functions inherited from controller_base
virtual std::vector< std::stringadditional_actions_pressed ()
 
bool handle_scroll (int mousex, int mousey, int mouse_flags, double joystickx, double joysticky)
 Handle scrolling by keyboard, joystick and moving mouse near map edges. More...
 
void handle_event (const SDL_Event &event)
 Process mouse- and keypress-events from SDL. More...
 
void handle_window_event (const SDL_Event &)
 
virtual void show_menu (const std::vector< std::string > &items_arg, int xloc, int yloc, bool context_menu, display &disp)
 
virtual void execute_action (const std::vector< std::string > &items_arg, int xloc, int yloc, bool context_menu)
 
virtual bool in_context_menu (hotkey::HOTKEY_COMMAND command) const
 
- Protected Member Functions inherited from video2::draw_layering
 draw_layering (const bool auto_join=true)
 
virtual ~draw_layering ()
 
- Protected Member Functions inherited from events::sdl_handler
 sdl_handler (const bool auto_join=true)
 
virtual ~sdl_handler ()
 
virtual std::vector
< sdl_handler * > 
handler_members ()
 

Protected Attributes

const cursor::setter cursor_setter
 
gui::floating_textbox textbox_info_
 
replay_network_sender replay_sender_
 
playturn_network_adapter network_reader_
 
turn_info turn_data_
 
END_TURN_STATE end_turn_
 
bool skip_next_turn_
 
boost::scoped_ptr
< replay_controller
replay_
 
- Protected Attributes inherited from play_controller
const tdata_cachetdata_
 
boost::scoped_ptr< game_stategamestate_
 
config level_
 
saved_gamesaved_game_
 
boost::scoped_ptr
< tooltips::manager
tooltips_manager_
 
boost::shared_ptr< wb::managerwhiteboard_manager_
 
boost::scoped_ptr
< plugins_context
plugins_context_
 
font::floating_label_context labels_manager_
 
help::help_manager help_manager_
 
events::mouse_handler mouse_handler_
 
events::menu_handler menu_handler_
 
boost::scoped_ptr< hotkey_handlerhotkey_handler_
 
boost::scoped_ptr
< soundsource::manager
soundsources_manager_
 
persist_manager persist_
 
boost::scoped_ptr< game_displaygui_
 
boost::scoped_ptr
< unit_experience_accelerator
xp_mod_
 
boost::scoped_ptr< const
statistics::scenario_context
statistics_context_
 
boost::scoped_ptr< replayreplay_
 
bool skip_replay_
 
bool linger_
 
bool init_side_done_now_
 Whether we did init sides in this session (false = we did init sides before we reloaded the game). More...
 
bool ignore_replay_errors_
 
bool player_type_changed_
 
- Protected Attributes inherited from controller_base
const configgame_config_
 
CKey key_
 
bool scrolling_
 
bool scroll_up_
 
bool scroll_down_
 
bool scroll_left_
 
bool scroll_right_
 
joystick_manager joystick_manager_
 

Additional Inherited Members

- Static Public Member Functions inherited from controller_base
static const configget_theme (const config &game_config, std::string theme_name)
 
- Static Public Member Functions inherited from quit_confirmation
static bool quit ()
 Shows the quit confirmation if needed. More...
 
static void quit_to_title ()
 
static void quit_to_desktop ()
 
static bool show_prompt (const std::string &message)
 
static bool default_prompt ()
 

Detailed Description

Definition at line 37 of file playsingle_controller.hpp.

Member Enumeration Documentation

Enumerator
END_TURN_NONE 

The turn was not ended yet.

END_TURN_REQUIRED 

And endturn was required eigher by the player, by the ai or by [end_turn].

END_TURN_SYNCED 

An [end_turn] was added to the replay.

Definition at line 89 of file playsingle_controller.hpp.

Constructor & Destructor Documentation

playsingle_controller::playsingle_controller ( const config level,
saved_game state_of_game,
const config game_config,
const tdata_cache tdata,
CVideo video,
bool  skip_replay 
)
playsingle_controller::~playsingle_controller ( )
virtual

Member Function Documentation

void playsingle_controller::after_human_turn ( )
protectedvirtual

Reimplemented in playmp_controller.

Definition at line 513 of file playsingle_controller.cpp.

References play_controller::gui_.

Referenced by playmp_controller::after_human_turn(), and play_side_impl().

void playsingle_controller::before_human_turn ( )
protected
void playsingle_controller::check_objectives ( )
virtual
std::string playsingle_controller::describe_result ( ) const
void playsingle_controller::do_idle_notification ( )
protectedvirtual

Will handle sending a networked notification in descendent classes.

Reimplemented in playmp_controller.

Definition at line 573 of file playsingle_controller.cpp.

References play_controller::gui_, and events::chat_handler::MESSAGE_PUBLIC.

Referenced by play_side_impl().

void playsingle_controller::enable_replay ( bool  is_unit_test = false)
void playsingle_controller::end_turn ( )
void playsingle_controller::end_turn_enable ( bool  enable)
protected
void playsingle_controller::execute_gotos ( )
protected
void playsingle_controller::force_end_turn ( )
virtual

Implements play_controller.

Definition at line 606 of file playsingle_controller.cpp.

References end_turn_, END_TURN_REQUIRED, and skip_next_turn_.

bool playsingle_controller::get_player_type_changed ( ) const
inline

Definition at line 60 of file playsingle_controller.hpp.

References play_controller::player_type_changed_.

replay_controller* playsingle_controller::get_replay_controller ( )
inline
void playsingle_controller::handle_generic_event ( const std::string name)
virtual

Reimplemented from play_controller.

Reimplemented in playmp_controller.

Definition at line 590 of file playsingle_controller.cpp.

References controller_base::play_slice().

Referenced by playmp_controller::handle_generic_event().

void playsingle_controller::init_gui ( )
protectedvirtual
bool playsingle_controller::is_replay ( )
inlinevirtual

Reimplemented from play_controller.

Definition at line 64 of file playsingle_controller.hpp.

References get_replay_controller().

void playsingle_controller::linger ( )
protected
void playsingle_controller::maybe_linger ( )
virtual
virtual void playsingle_controller::on_not_observer ( )
inlinevirtual

Implements play_controller.

Reimplemented in playmp_controller.

Definition at line 51 of file playsingle_controller.hpp.

void playsingle_controller::on_replay_end ( bool  is_unit_test)
void playsingle_controller::play_ai_turn ( )
protected
void playsingle_controller::play_human_turn ( )
protectedvirtual
void playsingle_controller::play_idle_loop ( )
protectedvirtual
void playsingle_controller::play_network_turn ( )
protectedvirtual

Will handle networked turns in descendent classes.

Reimplemented in playmp_controller.

Definition at line 583 of file playsingle_controller.cpp.

References ERR_NG.

Referenced by play_side_impl().

LEVEL_RESULT playsingle_controller::play_scenario ( const config level)

Definition at line 213 of file playsingle_controller.cpp.

References _(), game_state::board_, config::child_range(), sound::commit_music_changes(), transient_end_level::custom_endlevel_music, sdl::draw_solid_tinted_rectangle(), e, persist_manager::end_transaction(), ERR_NG, game_config::exit_at_end, game_events::t_pump::fire(), game::load_game_exception::game, play_controller::gamestate(), play_controller::get_end_level_data_const(), play_controller::get_scenario_name(), play_controller::gui_, game_board::heal_all_survivors(), play_controller::is_observer(), play_controller::is_regular_game_end(), play_controller::is_skipping_replay(), end_level_data::is_victory, play_controller::linger_, ai_testing::log_game_end(), LOG_NG, play_controller::persist_, sound::play_music_config(), sound::play_music_once(), play_scenario_init(), play_scenario_main_loop(), game_data::PRESTART, end_level_data::proceed_to_next_level, play_controller::pump(), storyscreen::QUIT, saved_game::remove_snapshot(), save(), preferences::save_compression_format(), savegame::savegame::save_game_interactive(), play_controller::saved_game_, play_controller::select_defeat_music(), play_controller::select_victory_music(), play_controller::send_to_wesnothd(), play_controller::set_defeat_music_list(), saved_game::set_snapshot(), play_controller::set_victory_music_list(), show_story(), gui2::show_transient_message(), play_controller::soundsources_manager_, play_controller::ticks(), end_level_data::transient, update_rect(), and gui::YES_NO.

Referenced by campaign_controller::playmp_scenario().

void playsingle_controller::play_scenario_init ( )
void playsingle_controller::play_scenario_main_loop ( )
void playsingle_controller::play_side_impl ( )
protectedvirtual
void playsingle_controller::reset_replay ( )
protected

Definition at line 659 of file playsingle_controller.cpp.

References ERR_NG, and replay_.

Referenced by playsingle_controller::hotkey_handler::reset_replay().

void playsingle_controller::set_player_type_changed ( )
inline

Definition at line 61 of file playsingle_controller.hpp.

References play_controller::player_type_changed_.

bool playsingle_controller::should_return_to_play_side ( )
virtual
void playsingle_controller::show_turn_dialog ( )
protected
void playsingle_controller::store_gold ( bool  obs = false)
protected
void playsingle_controller::store_recalls ( )
protected
void playsingle_controller::sync_end_turn ( )
protectedvirtual
void playsingle_controller::update_viewing_player ( )
protectedvirtual

Member Data Documentation

const cursor::setter playsingle_controller::cursor_setter
protected

Definition at line 83 of file playsingle_controller.hpp.

Referenced by play_ai_turn().

END_TURN_STATE playsingle_controller::end_turn_
protected
playturn_network_adapter playsingle_controller::network_reader_
protected
boost::scoped_ptr<replay_controller> playsingle_controller::replay_
protected
replay_network_sender playsingle_controller::replay_sender_
protected

Definition at line 86 of file playsingle_controller.hpp.

bool playsingle_controller::skip_next_turn_
protected

Definition at line 99 of file playsingle_controller.hpp.

Referenced by force_end_turn(), play_side_impl(), and sync_end_turn().

gui::floating_textbox playsingle_controller::textbox_info_
protected

Definition at line 84 of file playsingle_controller.hpp.

turn_info playsingle_controller::turn_data_
protected

The documentation for this class was generated from the following files: