The Battle for Wesnoth  1.19.5+dev
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | Friends | List of all members
play_controller Class Referenceabstract

#include <play_controller.hpp>

Inheritance diagram for play_controller:

Classes

class  hotkey_handler
 
struct  scoped_savegame_snapshot
 

Public Member Functions

 play_controller (const config &level, saved_game &state_of_game)
 
virtual ~play_controller ()
 
virtual void handle_generic_event (const std::string &) override
 
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 ()
 
replayget_replay ()
 
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 force_end_turn ()=0
 
virtual void check_objectives ()=0
 
virtual void on_not_observer ()=0
 
virtual void process_oos (const std::string &msg) const
 Asks the user whether to continue on an OOS error. More...
 
bool reveal_map_default () const
 
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
 
std::vector< team > & get_teams ()
 
const std::vector< team > & get_teams () const
 
const unit_mapget_units () const
 
unit_mapget_units ()
 
const gamemapget_map () const
 
const tod_managerget_tod_manager () const
 
bool is_observer () const
 
bool do_healing () const
 
void set_do_healing (bool do_healing)
 
game_stategamestate ()
 
const game_stategamestate () const
 
void check_victory ()
 Checks to see if a side has won. More...
 
std::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
 
bool is_skipping_actions () const
 
void toggle_skipping_replay ()
 
void do_autosave ()
 
bool is_skipping_story () const
 
void do_consolesave (const std::string &filename)
 
events::mouse_handlerget_mouse_handler_base () override
 Get a reference to a mouse handler member a derived class uses. More...
 
events::menu_handlerget_menu_handler ()
 
std::shared_ptr< wb::managerget_whiteboard () const
 
const mp_game_settingsget_mp_settings ()
 
game_classificationget_classification ()
 
int get_server_request_number () const
 
void increase_server_request_number ()
 
game_events::wml_event_pumppump ()
 
virtual soundsource::managerget_soundsource_man () override
 Get (optionally) a soundsources manager a derived class uses. More...
 
virtual plugins_contextget_plugins_context () override
 Get (optionally) a plugins context a derived class uses. More...
 
hotkey::command_executorget_hotkey_command_executor () override
 Optionally get a command executor to handle context menu events. More...
 
actions::undo_listget_undo_stack ()
 
bool is_browsing () const override
 
virtual replay_controllerget_replay_controller () const
 
bool is_replay () const
 
replayrecorder () const
 
t_string get_scenario_name () const
 
bool get_disallow_recall () const
 
std::string get_loaded_resources () const
 
std::string theme () const
 
virtual bool should_return_to_play_side () const
 
void maybe_throw_return_to_play_side () const
 
teamcurrent_team ()
 
const teamcurrent_team () const
 
bool can_use_synced_wml_menu () const
 
std::set< std::string > all_players () const
 
const auto & timer () const
 
game_displayget_display () override
 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 void send_actions ()
 Sends replay [command]s to the server. More...
 
virtual void receive_actions ()
 Reads and executes replay [command]s from the server. More...
 
virtual bool is_networked_mp () const
 
virtual void send_to_wesnothd (const config &, const std::string &="unknown") const
 
virtual bool receive_from_wesnothd (config &) const
 
void refresh_objectives () const
 Reevaluate [show_if] conditions and build a new objectives string. More...
 
void show_objectives () const
 
saved_gameget_saved_game ()
 
statistics_tstatistics ()
 
bool is_during_turn () const
 
bool is_linger_mode () const
 
virtual int find_viewing_side () const =0
 returns 0 if no such team was found. More...
 
- Public Member Functions inherited from controller_base
 controller_base ()
 
virtual ~controller_base ()
 
virtual void play_slice ()
 
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 handle_window_event (const SDL_Event &)
 
virtual void process_event ()
 
virtual bool requires_event_focus (const SDL_Event *=nullptr) const
 
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 ()
 
virtual bool has_joined ()
 
virtual bool has_joined_global ()
 
sdl_handleroperator= (sdl_handler &&)=delete
 Moving would require two instances' context membership to be handled, it's simpler to delete these and require the two instances to be separately constructed / destructed. More...
 
 sdl_handler (sdl_handler &&)=delete
 
- Public Member Functions inherited from events::pump_monitor
 pump_monitor ()
 
virtual ~pump_monitor ()
 
- 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 Member Functions

void play_slice_catch ()
 
bool have_keyboard_focus () override
 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) override
 Process keydown (only when the general map display does not have focus). More...
 
void process_keydown_event (const SDL_Event &event) override
 Process keydown (always). More...
 
void process_keyup_event (const SDL_Event &event) override
 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 ()
 
virtual void init_gui ()
 
void finish_side_turn_events ()
 
void finish_turn ()
 
bool enemies_visible () const
 
void enter_textbox ()
 
void textbox_move_vertically (bool up)
 
void tab ()
 
actions::undo_listundo_stack ()
 
const actions::undo_listundo_stack () const
 
const std::string & select_music (bool victory) const
 
void reset_gamestate (const config &level, int replay_pos)
 
virtual void sync_end_turn ()
 
virtual void check_time_over ()
 
virtual void update_viewing_player ()=0
 
- Protected Member Functions inherited from controller_base
virtual std::vector< std::string > additional_actions_pressed ()
 
bool handle_scroll (int mousex, int mousey, int mouse_flags)
 Handle scrolling by keyboard, joystick and moving mouse near map edges. More...
 
void handle_event (const SDL_Event &event) override
 Process mouse- and keypress-events from SDL. More...
 
virtual void process () override
 
virtual void show_menu (const std::vector< config > &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 (const hotkey::ui_command &cmd) const
 
void long_touch_callback (int x, int y)
 
- Protected Member Functions inherited from events::sdl_handler
 sdl_handler (const bool auto_join=true)
 
 sdl_handler (const sdl_handler &)
 
sdl_handleroperator= (const sdl_handler &)
 
virtual ~sdl_handler ()
 
virtual std::vector< sdl_handler * > handler_members ()
 

Protected Attributes

std::unique_ptr< game_stategamestate_
 
config level_
 
saved_gamesaved_game_
 
tooltips::manager tooltips_manager_
 
std::shared_ptr< wb::managerwhiteboard_manager_
 
std::unique_ptr< plugins_contextplugins_context_
 
std::unique_ptr< font::floating_label_contextlabels_manager_
 
help::help_manager help_manager_
 
events::mouse_handler mouse_handler_
 
events::menu_handler menu_handler_
 
std::unique_ptr< hotkey_handlerhotkey_handler_
 
std::unique_ptr< soundsource::managersoundsources_manager_
 
persist_manager persist_
 
std::unique_ptr< game_displaygui_
 
const std::unique_ptr< unit_experience_acceleratorxp_mod_
 
const std::unique_ptr< statistics_tstatistics_context_
 
std::unique_ptr< replayreplay_
 
bool skip_replay_
 
bool skip_story_
 
bool did_autosave_this_turn_
 Whether we did init sides in this session (false = we did init sides before we reloaded the game). More...
 
bool did_tod_sound_this_turn_
 
map_location map_start_
 
bool start_faded_
 
bool ignore_replay_errors_
 
bool player_type_changed_
 true when the controller of the currently playing side has changed. More...
 
- Protected Attributes inherited from controller_base
const game_config_viewgame_config_
 
CKey key_
 
bool scrolling_
 
bool scroll_up_
 
bool scroll_down_
 
bool scroll_left_
 
bool scroll_right_
 
std::chrono::steady_clock::time_point last_scroll_tick_
 
double scroll_carry_x_
 
double scroll_carry_y_
 

Private Member Functions

void init (const config &level)
 
void check_next_scenario_is_known ()
 This shows a warning dialog if either [scenario]next_scenario or any [endlevel]next_scenario would lead to an "Unknown Scenario" dialog. More...
 

Private Attributes

utils::ms_optimer timer_
 
std::vector< std::string > victory_music_
 
std::vector< std::string > defeat_music_
 
const hotkey::scope_changer scope_
 

Friends

struct scoped_savegame_snapshot
 

Additional Inherited Members

- 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 61 of file play_controller.hpp.

Constructor & Destructor Documentation

◆ play_controller()

play_controller::play_controller ( const config level,
saved_game state_of_game 
)

◆ ~play_controller()

play_controller::~play_controller ( )
virtual

Member Function Documentation

◆ all_players()

std::set< std::string > play_controller::all_players ( ) const

Definition at line 1242 of file play_controller.cpp.

References get_teams(), gui_, and t.

Referenced by campaign_controller::playmp_scenario().

◆ can_redo()

bool play_controller::can_redo ( ) const

◆ can_undo()

bool play_controller::can_undo ( ) const

◆ can_use_synced_wml_menu()

bool play_controller::can_use_synced_wml_menu ( ) const

◆ check_next_scenario_is_known()

void play_controller::check_next_scenario_is_known ( )
private

◆ check_objectives()

virtual void play_controller::check_objectives ( )
pure virtual

Implemented in playsingle_controller.

Referenced by fire_start().

◆ check_time_over()

void play_controller::check_time_over ( )
protectedvirtual

◆ check_victory()

void play_controller::check_victory ( )

◆ current_side()

int play_controller::current_side ( ) const
inline

◆ current_team() [1/2]

team & play_controller::current_team ( )

◆ current_team() [2/2]

const team & play_controller::current_team ( ) const

◆ do_autosave()

void play_controller::do_autosave ( )

◆ do_consolesave()

void play_controller::do_consolesave ( const std::string &  filename)

◆ do_healing()

bool play_controller::do_healing ( ) const
inline

Definition at line 170 of file play_controller.hpp.

References game_state::do_healing_, and gamestate().

Referenced by do_init_side(), and set_do_healing().

◆ do_init_side()

void play_controller::do_init_side ( )

◆ enemies_visible()

bool play_controller::enemies_visible ( ) const
protected

Definition at line 602 of file play_controller.cpp.

References current_team(), get_units(), and gui_.

◆ enter_textbox()

void play_controller::enter_textbox ( )
protected

◆ find_viewing_side()

virtual int play_controller::find_viewing_side ( ) const
pure virtual

returns 0 if no such team was found.

Implemented in playsingle_controller.

Referenced by replay_controller::update_viewing_player().

◆ finish_side_turn_events()

void play_controller::finish_side_turn_events ( )
protected

◆ finish_turn()

void play_controller::finish_turn ( )
protected

◆ fire_preload()

void play_controller::fire_preload ( )
protected

◆ fire_prestart()

void play_controller::fire_prestart ( )
protected

◆ fire_start()

void play_controller::fire_start ( )
protected

◆ force_end_turn()

virtual void play_controller::force_end_turn ( )
pure virtual

◆ gamestate() [1/2]

game_state& play_controller::gamestate ( )
inline

Definition at line 180 of file play_controller.hpp.

References gamestate_.

Referenced by playsingle_controller::before_human_turn(), playsingle_controller::hotkey_handler::can_execute_command(), playmp_controller::hotkey_handler::can_execute_command(), check_next_scenario_is_known(), check_time_over(), check_victory(), current_team(), playsingle_controller::do_end_level(), play_controller::hotkey_handler::do_execute_command(), do_healing(), do_init_side(), do_replay_handle(), play_controller::hotkey_handler::expand_wml_commands(), events::mouse_handler::find_unit(), events::mouse_handler::find_unit_nonowning(), playsingle_controller::finish_side_turn(), finish_side_turn_events(), fire_preload(), fire_prestart(), fire_start(), playsingle_controller::force_end_turn(), events::menu_handler::gamestate(), get_end_level_data(), get_map(), events::mouse_handler::get_route(), get_server_request_number(), get_teams(), get_tod_manager(), get_units(), play_controller::hotkey_handler::in_context_menu(), increase_server_request_number(), init(), init_side_begin(), init_side_end(), game_lua_kernel::intf_end_turn(), is_browsing(), is_during_turn(), is_linger_mode(), is_observer(), is_regular_game_end(), playsingle_controller::is_team_visible(), playsingle_controller::linger(), playmp_controller::maybe_linger(), events::mouse_handler::mouse_button_event(), events::mouse_handler::mouse_motion(), playmp_controller::play_human_turn(), playsingle_controller::play_scenario_init(), playsingle_controller::play_scenario_main_loop(), playsingle_controller::play_side_impl(), replay_controller::play_side_impl(), playsingle_controller::play_some(), playmp_controller::process_network_change_controller_impl(), playmp_controller::process_network_data(), playmp_controller::process_network_side_drop_impl(), pump(), refresh_objectives(), replay_controller::replay_next_turn(), reset_end_level_data(), reset_gamestate(), save_game(), events::mouse_handler::select_or_action(), events::mouse_handler::select_teleport(), set_do_healing(), set_end_level_data(), playsingle_controller::should_return_to_play_side(), events::mouse_handler::show_attack_dialog(), playsingle_controller::show_turn_dialog(), playsingle_controller::skip_empty_sides(), start_game(), playsingle_controller::sync_end_turn(), to_config(), events::mouse_handler::touch_motion(), turn(), undo_stack(), and events::mouse_handler::unit_in_cycle().

◆ gamestate() [2/2]

const game_state& play_controller::gamestate ( ) const
inline

Definition at line 185 of file play_controller.hpp.

References gamestate_.

◆ get_classification()

game_classification & play_controller::get_classification ( )

◆ get_disallow_recall()

bool play_controller::get_disallow_recall ( ) const
inline

Definition at line 251 of file play_controller.hpp.

References level_.

◆ get_display()

game_display & play_controller::get_display ( )
overridevirtual

◆ get_end_level_data()

const end_level_data& play_controller::get_end_level_data ( ) const
inline

◆ get_hotkey_command_executor()

hotkey::command_executor * play_controller::get_hotkey_command_executor ( )
overridevirtual

Optionally get a command executor to handle context menu events.

Reimplemented from controller_base.

Definition at line 1078 of file play_controller.cpp.

References hotkey_handler_.

Referenced by playsingle_controller::end_turn_enable(), playsingle_controller::init_gui(), and display::queue_rerender().

◆ get_loaded_resources()

std::string play_controller::get_loaded_resources ( ) const
inline

Definition at line 256 of file play_controller.hpp.

References level_.

◆ get_map()

const gamemap& play_controller::get_map ( ) const
inline

◆ get_menu_handler()

events::menu_handler& play_controller::get_menu_handler ( )
inline

Definition at line 221 of file play_controller.hpp.

References menu_handler_.

Referenced by wb::recruit::execute().

◆ get_mouse_handler_base()

events::mouse_handler & play_controller::get_mouse_handler_base ( )
overridevirtual

◆ get_mp_settings()

const mp_game_settings & play_controller::get_mp_settings ( )

Definition at line 782 of file play_controller.cpp.

References saved_game::mp_settings(), and saved_game_.

◆ get_plugins_context()

plugins_context * play_controller::get_plugins_context ( )
overridevirtual

Get (optionally) a plugins context a derived class uses.

Reimplemented from controller_base.

Definition at line 1073 of file play_controller.cpp.

References plugins_context_.

◆ get_replay()

replay & play_controller::get_replay ( )

Definition at line 856 of file play_controller.cpp.

References replay_.

Referenced by game_lua_kernel::intf_log_replay().

◆ get_replay_controller()

virtual replay_controller* play_controller::get_replay_controller ( ) const
inlinevirtual

Reimplemented in playsingle_controller.

Definition at line 241 of file play_controller.hpp.

Referenced by is_replay().

◆ get_saved_game()

saved_game& play_controller::get_saved_game ( )
inline

Definition at line 306 of file play_controller.hpp.

References saved_game_.

Referenced by playsingle_controller::play_scenario_main_loop().

◆ get_scenario_name()

t_string play_controller::get_scenario_name ( ) const
inline

Definition at line 246 of file play_controller.hpp.

References level_.

Referenced by init(), playsingle_controller::play_scenario(), and show_objectives().

◆ get_server_request_number()

int play_controller::get_server_request_number ( ) const
inline

◆ get_soundsource_man()

soundsource::manager * play_controller::get_soundsource_man ( )
overridevirtual

Get (optionally) a soundsources manager a derived class uses.

Reimplemented from controller_base.

Definition at line 1068 of file play_controller.cpp.

References soundsources_manager_.

◆ get_teams() [1/2]

std::vector<team>& play_controller::get_teams ( )
inline

◆ get_teams() [2/2]

const std::vector<team>& play_controller::get_teams ( ) const
inline

Definition at line 140 of file play_controller.hpp.

References game_state::board_, gamestate(), and game_board::teams().

◆ get_tod_manager()

const tod_manager& play_controller::get_tod_manager ( ) const
inline

Definition at line 160 of file play_controller.hpp.

References gamestate(), and game_state::tod_manager_.

Referenced by events::mouse_handler::attack_enemy_().

◆ get_undo_stack()

actions::undo_list& play_controller::get_undo_stack ( )
inline

Definition at line 235 of file play_controller.hpp.

References undo_stack().

◆ get_units() [1/2]

unit_map& play_controller::get_units ( )
inline

Definition at line 150 of file play_controller.hpp.

References game_state::board_, gamestate(), and game_board::units().

◆ get_units() [2/2]

const unit_map& play_controller::get_units ( ) const
inline

◆ get_whiteboard()

std::shared_ptr< wb::manager > play_controller::get_whiteboard ( ) const

◆ handle_generic_event()

virtual void play_controller::handle_generic_event ( const std::string &  )
inlineoverridevirtual

Implements events::observer.

Reimplemented in playsingle_controller, and playmp_controller.

Definition at line 70 of file play_controller.hpp.

◆ have_keyboard_focus()

bool play_controller::have_keyboard_focus ( )
overrideprotectedvirtual

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.

Returns
true when arrow keys should scroll the map, false otherwise

Reimplemented from controller_base.

Definition at line 797 of file play_controller.cpp.

References gui::floating_textbox::active(), events::menu_handler::get_textbox(), and menu_handler_.

◆ increase_server_request_number()

void play_controller::increase_server_request_number ( )
inline

◆ init()

void play_controller::init ( const config level)
private

◆ init_gui()

void play_controller::init_gui ( )
protectedvirtual

Reimplemented in playsingle_controller.

Definition at line 395 of file play_controller.cpp.

References gui_.

Referenced by playsingle_controller::init_gui(), and start_game().

◆ init_managers()

void play_controller::init_managers ( )
protected

Definition at line 329 of file play_controller.cpp.

References gui_, LOG_NG, resources::soundsources, soundsources_manager_, and timer().

Referenced by init().

◆ init_side_begin()

void play_controller::init_side_begin ( )

◆ init_side_end()

void play_controller::init_side_end ( )

◆ is_browsing()

bool play_controller::is_browsing ( ) const
overridevirtual

◆ is_during_turn()

bool play_controller::is_during_turn ( ) const

◆ is_linger_mode()

bool play_controller::is_linger_mode ( ) const

◆ is_networked_mp()

virtual bool play_controller::is_networked_mp ( ) const
inlinevirtual

◆ is_observer()

bool play_controller::is_observer ( ) const
inline

◆ is_regular_game_end()

bool play_controller::is_regular_game_end ( ) const
inline

◆ is_replay()

bool play_controller::is_replay ( ) const
inline

◆ is_skipping_actions()

bool play_controller::is_skipping_actions ( ) const

◆ is_skipping_replay()

bool play_controller::is_skipping_replay ( ) const
inline

◆ is_skipping_story()

bool play_controller::is_skipping_story ( ) const
inline

◆ load_game()

void play_controller::load_game ( )

◆ maybe_do_init_side()

void play_controller::maybe_do_init_side ( )

Called by turn_info::process_network_data() or init_side() to call do_init_side() if necessary.

Definition at line 411 of file play_controller.cpp.

References current_team(), do_init_side(), replay::init_side(), is_during_turn(), is_replay(), and resources::recorder.

Referenced by playsingle_controller::play_side().

◆ maybe_throw_return_to_play_side()

void play_controller::maybe_throw_return_to_play_side ( ) const

Definition at line 1331 of file play_controller.cpp.

References is_during_turn(), and should_return_to_play_side().

Referenced by synced_context::run_and_throw().

◆ on_not_observer()

virtual void play_controller::on_not_observer ( )
pure virtual

◆ play_slice_catch()

void play_controller::play_slice_catch ( )
protected

◆ process_focus_keydown_event()

void play_controller::process_focus_keydown_event ( const SDL_Event &  )
overrideprotectedvirtual

Process keydown (only when the general map display does not have focus).

Reimplemented from controller_base.

Definition at line 802 of file play_controller.cpp.

References gui::floating_textbox::close(), enter_textbox(), events::menu_handler::get_textbox(), menu_handler_, tab(), and textbox_move_vertically().

◆ process_keydown_event()

void play_controller::process_keydown_event ( const SDL_Event &  )
overrideprotectedvirtual

Process keydown (always).

Overridden in derived classes

Reimplemented from controller_base.

Definition at line 817 of file play_controller.cpp.

References whiteboard_manager_.

◆ process_keyup_event()

void play_controller::process_keyup_event ( const SDL_Event &  )
overrideprotectedvirtual

◆ process_oos()

void play_controller::process_oos ( const std::string &  msg) const
virtual

Asks the user whether to continue on an OOS error.

Exceptions
quit_game_exceptionIf the user wants to abort.

Reimplemented in playmp_controller.

Definition at line 1012 of file play_controller.cpp.

References _(), video::headless(), game_config::ignore_replay_errors, ignore_replay_errors_, wfl::msg(), savegame::savegame::save_game_interactive(), saved_game_, and savegame::savegame::YES_NO.

Referenced by replay::process_error().

◆ pump()

game_events::wml_event_pump & play_controller::pump ( )

◆ receive_actions()

virtual void play_controller::receive_actions ( )
inlinevirtual

Reads and executes replay [command]s from the server.

Reimplemented in playmp_controller.

Definition at line 290 of file play_controller.hpp.

Referenced by synced_context::pull_remote_user_input().

◆ receive_from_wesnothd()

virtual bool play_controller::receive_from_wesnothd ( config ) const
inlinevirtual

Reimplemented in playmp_controller.

Definition at line 294 of file play_controller.hpp.

◆ recorder()

replay& play_controller::recorder ( ) const
inline

◆ redo()

void play_controller::redo ( )

◆ refresh_objectives()

void play_controller::refresh_objectives ( ) const

Reevaluate [show_if] conditions and build a new objectives string.

Definition at line 364 of file play_controller.cpp.

References gamestate(), get_teams(), gui_, and game_state::lua_kernel_.

Referenced by fire_start(), and events::menu_handler::objectives().

◆ reset_end_level_data()

void play_controller::reset_end_level_data ( )
inline

Definition at line 120 of file play_controller.hpp.

References game_state::end_level_data_, and gamestate().

◆ reset_gamestate()

void play_controller::reset_gamestate ( const config level,
int  replay_pos 
)
protected

◆ reveal_map_default()

bool play_controller::reveal_map_default ( ) const

◆ save_game()

void play_controller::save_game ( )

◆ save_game_auto()

void play_controller::save_game_auto ( const std::string &  filename)

Definition at line 873 of file play_controller.cpp.

References filename, prefs::get(), savegame::savegame::save_game_automatic(), and saved_game_.

Referenced by init().

◆ save_map()

void play_controller::save_map ( )

Definition at line 892 of file play_controller.cpp.

References menu_handler_, and events::menu_handler::save_map().

◆ save_replay()

void play_controller::save_replay ( )

◆ save_replay_auto()

void play_controller::save_replay_auto ( const std::string &  filename)

Definition at line 886 of file play_controller.cpp.

References filename, prefs::get(), savegame::savegame::save_game_automatic(), and saved_game_.

Referenced by init().

◆ select_music()

const std::string & play_controller::select_music ( bool  victory) const
protected

◆ send_actions()

virtual void play_controller::send_actions ( )
inlinevirtual

Sends replay [command]s to the server.

Reimplemented in playmp_controller.

Definition at line 288 of file play_controller.hpp.

Referenced by synced_context::block_undo(), and synced_context::send_user_choice().

◆ send_to_wesnothd()

virtual void play_controller::send_to_wesnothd ( const config ,
const std::string &  = "unknown" 
) const
inlinevirtual

◆ set_do_healing()

void play_controller::set_do_healing ( bool  do_healing)
inline

Definition at line 175 of file play_controller.hpp.

References do_healing(), game_state::do_healing_, and gamestate().

Referenced by do_init_side().

◆ set_end_level_data()

void play_controller::set_end_level_data ( const end_level_data data)
inline

◆ should_return_to_play_side()

virtual bool play_controller::should_return_to_play_side ( ) const
inlinevirtual

Reimplemented in playsingle_controller.

Definition at line 266 of file play_controller.hpp.

References is_regular_game_end().

Referenced by maybe_throw_return_to_play_side(), and play_slice_catch().

◆ show_objectives()

void play_controller::show_objectives ( ) const

◆ start_game()

void play_controller::start_game ( )
protected

◆ statistics()

statistics_t& play_controller::statistics ( )
inline

◆ sync_end_turn()

virtual void play_controller::sync_end_turn ( )
inlineprotectedvirtual

Reimplemented in playsingle_controller.

Definition at line 413 of file play_controller.hpp.

◆ tab()

void play_controller::tab ( )
protected

◆ textbox_move_vertically()

void play_controller::textbox_move_vertically ( bool  up)
protected

◆ theme()

std::string play_controller::theme ( ) const
inline

Definition at line 261 of file play_controller.hpp.

References gamestate_.

Referenced by replay_controller::add_replay_theme(), and init().

◆ timer()

const auto& play_controller::timer ( ) const
inline

◆ to_config()

config play_controller::to_config ( ) const

◆ toggle_skipping_replay()

void play_controller::toggle_skipping_replay ( )

◆ turn()

std::size_t play_controller::turn ( ) const
inline

◆ undo()

void play_controller::undo ( )

◆ undo_stack() [1/2]

actions::undo_list& play_controller::undo_stack ( )
inlineprotected

◆ undo_stack() [2/2]

const actions::undo_list& play_controller::undo_stack ( ) const
inlineprotected

Definition at line 370 of file play_controller.hpp.

References gamestate(), and game_state::undo_stack_.

◆ update_gui_to_player()

void play_controller::update_gui_to_player ( const int  team_index,
const bool  observe = false 
)

Changes the UI for this client to the passed side index.

Definition at line 1036 of file play_controller.cpp.

References gui_.

Referenced by playsingle_controller::update_gui_linger(), replay_controller::update_viewing_player(), and playsingle_controller::update_viewing_player().

◆ update_savegame_snapshot()

void play_controller::update_savegame_snapshot ( ) const

◆ update_viewing_player()

virtual void play_controller::update_viewing_player ( )
protectedpure virtual

Implemented in playsingle_controller.

Referenced by init_side_begin().

Friends And Related Function Documentation

◆ scoped_savegame_snapshot

friend struct scoped_savegame_snapshot
friend

Definition at line 313 of file play_controller.hpp.

Member Data Documentation

◆ defeat_music_

std::vector<std::string> play_controller::defeat_music_
private

Definition at line 400 of file play_controller.hpp.

◆ did_autosave_this_turn_

bool play_controller::did_autosave_this_turn_
protected

Whether we did init sides in this session (false = we did init sides before we reloaded the game).

Definition at line 379 of file play_controller.hpp.

Referenced by playsingle_controller::before_human_turn(), playsingle_controller::finish_side_turn(), and start_game().

◆ did_tod_sound_this_turn_

bool play_controller::did_tod_sound_this_turn_
protected

Definition at line 380 of file play_controller.hpp.

Referenced by playsingle_controller::finish_side_turn(), and init_side_end().

◆ gamestate_

std::unique_ptr<game_state> play_controller::gamestate_
protected

◆ gui_

std::unique_ptr<game_display> play_controller::gui_
protected

◆ help_manager_

help::help_manager play_controller::help_manager_
protected

Definition at line 358 of file play_controller.hpp.

◆ hotkey_handler_

std::unique_ptr<hotkey_handler> play_controller::hotkey_handler_
protected

◆ ignore_replay_errors_

bool play_controller::ignore_replay_errors_
mutableprotected

Definition at line 405 of file play_controller.hpp.

Referenced by playmp_controller::process_oos(), and process_oos().

◆ labels_manager_

std::unique_ptr<font::floating_label_context> play_controller::labels_manager_
protected

Definition at line 357 of file play_controller.hpp.

◆ level_

config play_controller::level_
protected

◆ map_start_

map_location play_controller::map_start_
protected

Definition at line 382 of file play_controller.hpp.

Referenced by init(), and playsingle_controller::init_gui().

◆ menu_handler_

events::menu_handler play_controller::menu_handler_
protected

Definition at line 360 of file play_controller.hpp.

Referenced by playsingle_controller::hotkey_handler::ai_formula(), playsingle_controller::hotkey_handler::can_execute_command(), play_controller::hotkey_handler::can_execute_command(), playsingle_controller::hotkey_handler::change_side(), playsingle_controller::hotkey_handler::clear_labels(), playsingle_controller::hotkey_handler::clear_messages(), playsingle_controller::hotkey_handler::continue_move(), playsingle_controller::hotkey_handler::create_unit(), playsingle_controller::hotkey_handler::custom_command(), playsingle_controller::end_turn(), playsingle_controller::hotkey_handler::end_unit_turn(), enter_textbox(), playsingle_controller::execute_gotos(), get_menu_handler(), play_controller::hotkey_handler::goto_leader(), have_keyboard_focus(), init(), playsingle_controller::hotkey_handler::kill_unit(), playsingle_controller::hotkey_handler::label_settings(), playsingle_controller::hotkey_handler::label_terrain(), play_controller::hotkey_handler::objectives(), play_controller::hotkey_handler::preferences(), process_focus_keydown_event(), playsingle_controller::hotkey_handler::recall(), playsingle_controller::hotkey_handler::recruit(), playsingle_controller::hotkey_handler::rename_unit(), playsingle_controller::hotkey_handler::repeat_recruit(), save_map(), play_controller::hotkey_handler::search(), playmp_controller::hotkey_handler::shout(), play_controller::hotkey_handler::show_chat_log(), play_controller::hotkey_handler::show_enemy_moves(), play_controller::hotkey_handler::show_help(), play_controller::hotkey_handler::show_statistics(), play_controller::hotkey_handler::speak(), play_controller::hotkey_handler::status_table(), tab(), play_controller::hotkey_handler::terrain_description(), textbox_move_vertically(), play_controller::hotkey_handler::toggle_ellipses(), play_controller::hotkey_handler::toggle_grid(), playsingle_controller::hotkey_handler::toggle_shroud_updates(), play_controller::hotkey_handler::unit_description(), playsingle_controller::hotkey_handler::unit_hold_position(), play_controller::hotkey_handler::unit_list(), playsingle_controller::hotkey_handler::update_shroud_now(), playsingle_controller::hotkey_handler::user_command(), playmp_controller::hotkey_handler::whisper(), and playsingle_controller::hotkey_handler::whiteboard_suppose_dead().

◆ mouse_handler_

events::mouse_handler play_controller::mouse_handler_
protected

Definition at line 359 of file play_controller.hpp.

Referenced by playsingle_controller::hotkey_handler::can_execute_command(), play_controller::hotkey_handler::can_execute_command(), playsingle_controller::hotkey_handler::change_side(), playsingle_controller::hotkey_handler::continue_move(), playsingle_controller::hotkey_handler::create_unit(), play_controller::hotkey_handler::cycle_back_units(), play_controller::hotkey_handler::cycle_units(), play_controller::hotkey_handler::deselect_hex(), play_controller::hotkey_handler::do_execute_command(), playsingle_controller::hotkey_handler::end_unit_turn(), enter_textbox(), playsingle_controller::execute_gotos(), play_controller::hotkey_handler::expand_wml_commands(), finish_side_turn_events(), get_mouse_handler_base(), play_controller::hotkey_handler::in_context_menu(), init(), init_side_begin(), playsingle_controller::hotkey_handler::kill_unit(), playsingle_controller::hotkey_handler::label_terrain(), play_controller::hotkey_handler::left_mouse_click(), play_controller::hotkey_handler::move_action(), process_keyup_event(), playsingle_controller::hotkey_handler::recall(), playsingle_controller::hotkey_handler::recruit(), redo(), playsingle_controller::hotkey_handler::repeat_recruit(), play_controller::hotkey_handler::right_mouse_click(), play_controller::hotkey_handler::select_and_action(), play_controller::hotkey_handler::select_hex(), playsingle_controller::hotkey_handler::select_teleport(), play_controller::hotkey_handler::terrain_description(), play_controller::hotkey_handler::touch_hex(), undo(), and playsingle_controller::hotkey_handler::unit_hold_position().

◆ persist_

persist_manager play_controller::persist_
protected

Definition at line 363 of file play_controller.hpp.

Referenced by playsingle_controller::do_end_level(), and play_controller().

◆ player_type_changed_

bool play_controller::player_type_changed_
protected

true when the controller of the currently playing side has changed.

this can mean for example:

  • The currently active side was reassigned from/to another player in a mp game
  • The replay controller was disabled ('continue play' button)
  • The currently active side was droided / undroided.
  • A side was set to idle.

Definition at line 412 of file play_controller.hpp.

Referenced by playsingle_controller::get_player_type_changed(), playsingle_controller::linger(), playsingle_controller::play_ai_turn(), playmp_controller::play_human_turn(), playsingle_controller::play_side(), playsingle_controller::play_side_impl(), playmp_controller::process_network_change_controller_impl(), playmp_controller::process_network_data(), playmp_controller::process_network_side_drop_impl(), playsingle_controller::set_player_type_changed(), and playsingle_controller::should_return_to_play_side().

◆ plugins_context_

std::unique_ptr<plugins_context> play_controller::plugins_context_
protected

◆ replay_

std::unique_ptr<replay> play_controller::replay_
protected

Definition at line 371 of file play_controller.hpp.

Referenced by get_replay(), play_controller(), and recorder().

◆ saved_game_

saved_game& play_controller::saved_game_
protected

◆ scope_

const hotkey::scope_changer play_controller::scope_
private

Definition at line 402 of file play_controller.hpp.

◆ skip_replay_

bool play_controller::skip_replay_
protected

◆ skip_story_

bool play_controller::skip_story_
protected

Definition at line 374 of file play_controller.hpp.

Referenced by fire_start(), and is_skipping_story().

◆ soundsources_manager_

std::unique_ptr<soundsource::manager> play_controller::soundsources_manager_
protected

◆ start_faded_

bool play_controller::start_faded_
protected

Definition at line 384 of file play_controller.hpp.

Referenced by init().

◆ statistics_context_

const std::unique_ptr<statistics_t> play_controller::statistics_context_
protected

Definition at line 368 of file play_controller.hpp.

Referenced by statistics().

◆ timer_

utils::ms_optimer play_controller::timer_
private

Definition at line 339 of file play_controller.hpp.

Referenced by timer().

◆ tooltips_manager_

tooltips::manager play_controller::tooltips_manager_
protected

Definition at line 348 of file play_controller.hpp.

◆ victory_music_

std::vector<std::string> play_controller::victory_music_
private

Definition at line 399 of file play_controller.hpp.

◆ whiteboard_manager_

std::shared_ptr<wb::manager> play_controller::whiteboard_manager_
protected

◆ xp_mod_

const std::unique_ptr<unit_experience_accelerator> play_controller::xp_mod_
protected

Definition at line 367 of file play_controller.hpp.


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