#include <playsingle_controller.hpp>
Classes | |
class | hotkey_handler |
Public Member Functions | |
playsingle_controller (const config &level, saved_game &state_of_game, bool skip_replay) | |
level_result::type | play_scenario (const config &level) |
void | play_scenario_init () |
void | play_scenario_main_loop () |
virtual void | handle_generic_event (const std::string &name) override |
virtual void | check_objectives () override |
virtual void | on_not_observer () override |
virtual void | maybe_linger () |
void | end_turn () |
void | force_end_turn () override |
std::string | describe_result () const |
bool | get_player_type_changed () const |
void | set_player_type_changed () |
virtual bool | should_return_to_play_side () const override |
replay_controller * | get_replay_controller () const override |
void | enable_replay (bool is_unit_test=false) |
void | on_replay_end (bool is_unit_test) |
![]() | |
play_controller (const config &level, saved_game &state_of_game, bool skip_replay, bool start_faded=false) | |
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 () |
replay & | get_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 | 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_data & | get_end_level_data () const |
std::vector< team > & | get_teams () |
const std::vector< team > & | get_teams () const |
const unit_map & | get_units () const |
unit_map & | get_units () |
const gamemap & | get_map () const |
const tod_manager & | get_tod_manager () const |
bool | is_observer () const |
bool | do_healing () const |
void | set_do_healing (bool do_healing) |
game_state & | gamestate () |
const game_state & | gamestate () 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 |
void | toggle_skipping_replay () |
bool | is_linger_mode () const |
void | do_autosave () |
bool | is_skipping_story () const |
void | do_consolesave (const std::string &filename) |
events::mouse_handler & | get_mouse_handler_base () override |
Get a reference to a mouse handler member a derived class uses. More... | |
events::menu_handler & | get_menu_handler () |
std::shared_ptr< wb::manager > | get_whiteboard () const |
const mp_game_settings & | get_mp_settings () |
game_classification & | get_classification () |
int | get_server_request_number () const |
void | increase_server_request_number () |
game_events::wml_event_pump & | pump () |
int | get_ticks () const |
virtual soundsource::manager * | get_soundsource_man () override |
Get (optionally) a soundsources manager a derived class uses. More... | |
virtual plugins_context * | get_plugins_context () override |
Get (optionally) a plugins context a derived class uses. More... | |
hotkey::command_executor * | get_hotkey_command_executor () override |
Optionally get a command executor to handle context menu events. More... | |
actions::undo_list & | get_undo_stack () |
bool | is_browsing () const override |
bool | is_lingering () const |
bool | is_replay () const |
t_string | get_scenario_name () const |
bool | get_disallow_recall () const |
std::string | get_loaded_resources () const |
std::string | theme () const |
void | maybe_throw_return_to_play_side () const |
void | play_side () |
team & | current_team () |
const team & | current_team () const |
bool | can_use_synced_wml_menu () const |
std::set< std::string > | all_players () const |
int | ticks () const |
game_display & | get_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 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_game & | get_saved_game () |
![]() | |
controller_base () | |
virtual | ~controller_base () |
virtual 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) |
![]() | |
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_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 () |
virtual bool | has_joined () |
virtual bool | has_joined_global () |
sdl_handler & | operator= (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 | |
![]() | |
pump_monitor () | |
virtual | ~pump_monitor () |
![]() | |
virtual | ~observer () |
![]() | |
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 () override |
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 () override |
void | linger () |
void | sync_end_turn () override |
void | update_viewing_player () override |
void | reset_replay () |
![]() | |
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 () |
void | finish_side_turn () |
void | finish_turn () |
bool | enemies_visible () const |
void | enter_textbox () |
void | textbox_move_vertically (bool up) |
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_list & | undo_stack () |
const actions::undo_list & | undo_stack () const |
const std::string & | select_music (bool victory) const |
void | reset_gamestate (const config &level, int replay_pos) |
virtual void | check_time_over () |
void | play_turn () |
![]() | |
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 (events::pump_info &) 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 (hotkey::HOTKEY_COMMAND command) const |
void | long_touch_callback (int x, int y) |
![]() | |
sdl_handler (const bool auto_join=true) | |
sdl_handler (const sdl_handler &) | |
sdl_handler & | operator= (const sdl_handler &) |
virtual | ~sdl_handler () |
virtual std::vector< sdl_handler * > | handler_members () |
Additional Inherited Members | |
![]() | |
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 () |
Definition at line 38 of file playsingle_controller.hpp.
|
protected |
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 85 of file playsingle_controller.hpp.
playsingle_controller::playsingle_controller | ( | const config & | level, |
saved_game & | state_of_game, | ||
bool | skip_replay | ||
) |
Definition at line 70 of file playsingle_controller.cpp.
References ai_fallback_, describe_result(), end_turn_, END_TURN_NONE, play_controller::hotkey_handler_, play_controller::is_regular_game_end(), play_controller::linger_, network_reader_, play_controller::plugins_context_, play_controller::receive_from_wesnothd(), replay_controller_, replay_sender_, play_controller::saved_game_, skip_next_turn_, play_controller::turn(), and turn_data_.
|
protectedvirtual |
Reimplemented in playmp_controller.
Definition at line 562 of file playsingle_controller.cpp.
References play_controller::gui_.
Referenced by playmp_controller::after_human_turn(), and play_side_impl().
|
protected |
Definition at line 456 of file playsingle_controller.cpp.
References savegame::autosave_savegame::autosave(), preferences::autosavemax(), game_config::disable_autosave, end_turn_, END_TURN_NONE, preferences::INFINITE_AUTO_SAVES, play_controller::init_side_done_now_, play_controller::is_regular_game_end(), play_controller::linger_, log_scope, sound::play_bell(), preferences::save_compression_format(), play_controller::saved_game_, game_config::sounds::turn_bell, and preferences::turn_bell().
Referenced by play_side_impl().
|
overridevirtual |
Implements play_controller.
Definition at line 660 of file playsingle_controller.cpp.
References play_controller::get_teams(), play_controller::gui_, play_controller::is_browsing(), play_controller::is_regular_game_end(), team::objectives_changed(), play_controller::show_objectives(), and t.
Referenced by playmp_controller::play_human_turn(), and play_human_turn().
std::string playsingle_controller::describe_result | ( | ) | const |
Definition at line 92 of file playsingle_controller.cpp.
References play_controller::get_end_level_data(), and play_controller::is_regular_game_end().
Referenced by playsingle_controller().
|
protectedvirtual |
Will handle sending a networked notification in descendent classes.
Reimplemented in playmp_controller.
Definition at line 622 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 | ) |
Definition at line 722 of file playsingle_controller.cpp.
References play_controller::gamestate(), saved_game::get_replay_starting_point(), game_state::has_human_sides(), on_replay_end(), replay_controller_, and play_controller::saved_game_.
Referenced by campaign_controller::playsingle_scenario().
void playsingle_controller::end_turn | ( | ) |
Definition at line 645 of file playsingle_controller.cpp.
References play_controller::current_side(), events::menu_handler::end_turn(), end_turn_, END_TURN_REQUIRED, play_controller::is_browsing(), play_controller::linger_, and play_controller::menu_handler_.
Referenced by playsingle_controller::hotkey_handler::end_turn(), and playmp_controller::play_linger_turn().
|
protected |
Definition at line 554 of file playsingle_controller.cpp.
References play_controller::get_hotkey_command_executor(), and hotkey::command_executor::set_button_state().
Referenced by playmp_controller::handle_generic_event(), linger(), play_ai_turn(), playmp_controller::play_human_turn(), play_human_turn(), playmp_controller::play_linger_turn(), playmp_controller::play_network_turn(), and play_side_impl().
|
protected |
Definition at line 488 of file playsingle_controller.cpp.
References play_controller::current_side(), events::menu_handler::execute_gotos(), play_controller::menu_handler_, play_controller::mouse_handler_, and should_return_to_play_side().
Referenced by playmp_controller::play_human_turn(), and play_human_turn().
|
overridevirtual |
Implements play_controller.
Definition at line 654 of file playsingle_controller.cpp.
References end_turn_, END_TURN_REQUIRED, and skip_next_turn_.
|
inline |
Definition at line 59 of file playsingle_controller.hpp.
|
inlineoverridevirtual |
Reimplemented from play_controller.
Definition at line 62 of file playsingle_controller.hpp.
Referenced by playsingle_controller::hotkey_handler::can_execute_command(), and playsingle_controller::hotkey_handler::get_replay_controller().
|
overridevirtual |
Reimplemented from play_controller.
Reimplemented in playmp_controller.
Definition at line 638 of file playsingle_controller.cpp.
References controller_base::play_slice().
Referenced by playmp_controller::handle_generic_event().
|
overrideprotectedvirtual |
Reimplemented from play_controller.
Definition at line 103 of file playsingle_controller.cpp.
References game_state::first_human_team_, play_controller::gamestate(), play_controller::get_hotkey_command_executor(), play_controller::get_map(), play_controller::gui_, video::headless(), play_controller::init_gui(), LOG_NG, play_controller::map_start_, hotkey::command_executor::set_button_state(), video::testing(), play_controller::ticks(), map_location::valid(), display::WARP, map_location::x, and map_location::y.
|
protected |
Definition at line 516 of file playsingle_controller.cpp.
References game_state::board_, saved_game::clear(), end_turn_, end_turn_enable(), END_TURN_NONE, play_controller::gamestate(), play_controller::gui_, game_display::LINGER, play_controller::linger_, LOG_NG, controller_base::play_slice(), game_display::RUNNING, play_controller::saved_game_, and game_board::set_all_units_user_end_turn().
Referenced by maybe_linger().
|
virtual |
Reimplemented in playmp_controller.
Definition at line 671 of file playsingle_controller.cpp.
References play_controller::get_end_level_data(), play_controller::get_teams(), play_controller::is_regular_game_end(), and linger().
Referenced by campaign_controller::playsingle_scenario().
|
inlineoverridevirtual |
Implements play_controller.
Reimplemented in playmp_controller.
Definition at line 50 of file playsingle_controller.hpp.
void playsingle_controller::on_replay_end | ( | bool | is_unit_test | ) |
Definition at line 747 of file playsingle_controller.cpp.
References e, play_controller::is_networked_mp(), play_controller::is_regular_game_end(), end_level_data::is_victory, end_level_data::proceed_to_next_level, replay_controller_, play_controller::set_end_level_data(), and set_player_type_changed().
Referenced by enable_replay(), and play_scenario_main_loop().
|
protected |
Definition at line 569 of file playsingle_controller.cpp.
References ai_fallback_, team::auto_shroud_updates(), actions::undo_list::clear(), play_controller::current_side(), play_controller::current_team(), DBG_NG, end_turn_, end_turn_enable(), END_TURN_REQUIRED, replay_helper::get_auto_shroud(), ai::manager::get_singleton(), utils::get_unknown_exception_type(), play_controller::gui_, LOG_NG, team::make_human(), ai::manager::play_turn(), play_controller::player_type_changed_, synced_context::run_and_store(), turn_info::send_data(), should_return_to_play_side(), turn_info::sync_network(), turn_data_, play_controller::undo_stack(), and cursor::WAIT.
Referenced by play_side_impl().
|
protectedvirtual |
Reimplemented in playmp_controller.
Definition at line 500 of file playsingle_controller.cpp.
References check_objectives(), preferences::disable_auto_moves(), end_turn_enable(), execute_gotos(), play_controller::play_slice_catch(), should_return_to_play_side(), and show_turn_dialog().
Referenced by play_side_impl().
|
protectedvirtual |
Reimplemented in playmp_controller.
Definition at line 393 of file playsingle_controller.cpp.
References play_controller::play_slice_catch(), and should_return_to_play_side().
Referenced by play_side_impl().
|
protectedvirtual |
Will handle networked turns in descendent classes.
Reimplemented in playmp_controller.
Definition at line 632 of file playsingle_controller.cpp.
References ERR_NG.
Referenced by play_side_impl().
level_result::type playsingle_controller::play_scenario | ( | const config & | level | ) |
Definition at line 237 of file playsingle_controller.cpp.
References _(), config::append_children(), game_state::board_, transient_end_level::carryover_report, config::child_range(), saved_game::clear(), sound::commit_music_changes(), gui2::dialogs::story_viewer::display(), e, config::empty(), sound::empty_playlist(), persist_manager::end_transaction(), ERR_NG, game_config::exit_at_end, game_events::wml_event_pump::fire(), play_controller::gamestate(), play_controller::get_end_level_data(), string_enums::enum_base< Definition >::get_enum(), play_controller::get_scenario_name(), play_controller::get_teams(), play_controller::gui_, game_board::heal_all_survivors(), play_controller::is_observer(), play_controller::is_regular_game_end(), play_controller::is_skipping_replay(), play_controller::is_skipping_story(), end_level_data::is_victory, play_controller::linger_, ai_testing::log_game_end(), LOG_NG, game::error::message, play_controller::persist_, sound::play_music_config(), sound::play_music_once(), play_scenario_init(), play_scenario_main_loop(), end_level_data::proceed_to_next_level, play_controller::pump(), saved_game::remove_snapshot(), s, preferences::save_compression_format(), savegame::savegame::save_game_interactive(), play_controller::saved_game_, play_controller::select_music(), play_controller::send_to_wesnothd(), saved_game::set_snapshot(), gui2::show_transient_message(), play_controller::soundsources_manager_, end_level_data::test_result, play_controller::ticks(), end_level_data::transient, and savegame::savegame::YES_NO.
Referenced by campaign_controller::playsingle_scenario().
void playsingle_controller::play_scenario_init | ( | ) |
Definition at line 146 of file playsingle_controller.cpp.
References _(), saved_game::classification(), config::empty(), play_controller::is_networked_mp(), game_classification::random_mode, saved_game::replay_start(), play_controller::saved_game_, gui2::show_transient_message(), play_controller::start_game(), and play_controller::to_config().
Referenced by play_scenario(), and play_scenario_main_loop().
void playsingle_controller::play_scenario_main_loop | ( | ) |
Definition at line 167 of file playsingle_controller.cpp.
References ERR_NG, resources::gameboard, play_controller::get_teams(), i, play_controller::is_regular_game_end(), reset_gamestate_exception::level, ai_testing::log_game_start(), LOG_NG, on_replay_end(), play_scenario_init(), play_controller::play_turn(), statistics::read_stats(), replay_controller_, statistics::reset_current_scenario(), play_controller::reset_gamestate(), turn_info::send_data(), utf8::size(), reset_gamestate_exception::start_replay, reset_gamestate_exception::stats_, game_board::teams(), play_controller::ticks(), and turn_data_.
Referenced by play_scenario().
|
overrideprotectedvirtual |
Reimplemented from play_controller.
Definition at line 401 of file playsingle_controller.cpp.
References after_human_turn(), before_human_turn(), play_controller::current_side(), play_controller::current_team(), do_idle_notification(), unit_map::empty(), end_turn_, end_turn_enable(), END_TURN_NONE, END_TURN_REQUIRED, END_TURN_SYNCED, ERR_NG, play_controller::gamestate(), string_enums::enum_base< Definition >::get_string(), play_controller::get_units(), play_controller::init_side_done_now_, play_controller::is_regular_game_end(), LOG_NG, play_ai_turn(), play_human_turn(), play_idle_loop(), play_network_turn(), play_controller::player_type_changed_, replay_controller_, REPLAY_FOUND_END_TURN, team::side(), and skip_next_turn_.
|
protected |
Definition at line 712 of file playsingle_controller.cpp.
References ERR_NG, and replay_controller_.
Referenced by playsingle_controller::hotkey_handler::reset_replay().
|
inline |
Definition at line 60 of file playsingle_controller.hpp.
Referenced by on_replay_end(), and playsingle_controller::hotkey_handler::replay_exit().
|
overridevirtual |
Reimplemented from play_controller.
Definition at line 736 of file playsingle_controller.cpp.
References play_controller::current_team(), end_turn_, END_TURN_NONE, team::is_network(), play_controller::is_regular_game_end(), play_controller::player_type_changed_, and replay_controller_.
Referenced by execute_gotos(), play_ai_turn(), playmp_controller::play_human_turn(), play_human_turn(), playmp_controller::play_idle_loop(), and play_idle_loop().
|
protected |
Definition at line 475 of file playsingle_controller.cpp.
References _(), b, game_state::board_, play_controller::current_side(), play_controller::gamestate(), game_board::get_team(), play_controller::gui_, utils::interpolate_variables_into_string(), play_controller::is_regular_game_end(), gui2::show_transient_message(), team::side_name(), and preferences::turn_dialog().
Referenced by playmp_controller::play_human_turn(), and play_human_turn().
|
overrideprotectedvirtual |
Reimplemented from play_controller.
Definition at line 680 of file playsingle_controller.cpp.
References ai_fallback_, play_controller::current_team(), replay::end_turn(), end_turn_, END_TURN_REQUIRED, END_TURN_SYNCED, play_controller::gamestate_, team::make_ai(), resources::recorder, skip_next_turn_, and synced_context::UNSYNCED.
|
overrideprotectedvirtual |
Implements play_controller.
Definition at line 700 of file playsingle_controller.cpp.
References play_controller::find_last_visible_team(), play_controller::gui_, replay_controller_, and play_controller::update_gui_to_player().
|
protected |
Definition at line 95 of file playsingle_controller.hpp.
Referenced by play_ai_turn(), playsingle_controller(), and sync_end_turn().
|
protected |
Definition at line 79 of file playsingle_controller.hpp.
|
protected |
Definition at line 94 of file playsingle_controller.hpp.
Referenced by before_human_turn(), end_turn(), force_end_turn(), playmp_controller::linger(), linger(), play_ai_turn(), playmp_controller::play_human_turn(), playmp_controller::play_linger_turn(), playmp_controller::play_network_turn(), play_side_impl(), playsingle_controller(), playmp_controller::process_network_data(), should_return_to_play_side(), and sync_end_turn().
|
protected |
Definition at line 83 of file playsingle_controller.hpp.
Referenced by playmp_controller::play_linger_turn(), playsingle_controller(), playmp_controller::process_network_data(), and playmp_controller::wait_for_upload().
|
protected |
Definition at line 96 of file playsingle_controller.hpp.
Referenced by enable_replay(), on_replay_end(), play_scenario_main_loop(), play_side_impl(), playsingle_controller(), reset_replay(), should_return_to_play_side(), and update_viewing_player().
|
protected |
Definition at line 82 of file playsingle_controller.hpp.
Referenced by playmp_controller::play_slice(), and playsingle_controller().
|
protected |
Definition at line 95 of file playsingle_controller.hpp.
Referenced by force_end_turn(), play_side_impl(), playsingle_controller(), and sync_end_turn().
|
protected |
Definition at line 80 of file playsingle_controller.hpp.
|
protected |
Definition at line 84 of file playsingle_controller.hpp.
Referenced by playmp_controller::after_human_turn(), playmp_controller::handle_generic_event(), playmp_controller::linger(), play_ai_turn(), playmp_controller::play_human_turn(), playmp_controller::play_idle_loop(), playmp_controller::play_linger_turn(), playmp_controller::play_network_turn(), play_scenario_main_loop(), playmp_controller::playmp_controller(), playsingle_controller(), playmp_controller::process_network_data(), playmp_controller::pull_remote_choice(), playmp_controller::send_user_choice(), playmp_controller::surrender(), playmp_controller::wait_for_upload(), and playmp_controller::~playmp_controller().