#include <menu_events.hpp>
Public Member Functions | |
menu_handler (game_display *gui, play_controller &pc) | |
virtual | ~menu_handler () |
gui::floating_textbox & | get_textbox () |
void | set_gui (game_display *gui) |
void | objectives () |
void | show_statistics (int side_num) |
void | unit_list () |
void | status_table () |
void | save_map () |
void | preferences () |
void | show_chat_log () |
void | show_help () |
void | speak () |
void | whisper () |
void | shout () |
void | recruit (int side_num, const map_location &last_hex) |
void | repeat_recruit (int side_num, const map_location &last_hex) |
void | recall (int side_num, const map_location &last_hex) |
void | show_enemy_moves (bool ignore_units, int side_num) |
void | toggle_shroud_updates (int side_num) |
void | update_shroud_now (int side_num) |
bool | end_turn (int side_num) |
void | goto_leader (int side_num) |
void | unit_description () |
void | terrain_description (mouse_handler &mousehandler) |
void | rename_unit () |
void | create_unit (mouse_handler &mousehandler) |
Creates a unit (in debug mode via hotkey or context menu). More... | |
void | change_side (mouse_handler &mousehandler) |
void | kill_unit (mouse_handler &mousehandler) |
void | label_terrain (mouse_handler &mousehandler, bool team_only) |
void | clear_labels () |
void | label_settings () |
void | continue_move (mouse_handler &mousehandler, int side_num) |
void | execute_gotos (mouse_handler &mousehandler, int side_num) |
void | toggle_ellipses () |
void | toggle_grid () |
void | unit_hold_position (mouse_handler &mousehandler, int side_num) |
void | end_unit_turn (mouse_handler &mousehandler, int side_num) |
void | search () |
void | request_control_change (int side_num, const std::string &player) |
void | user_command () |
void | custom_command () |
void | ai_formula () |
virtual void | clear_messages () override |
std::vector< std::string > | get_commands_list () |
unit_map::iterator | current_unit () |
unit_map::const_iterator | current_unit () const |
void | move_unit_to_loc (const unit_map::iterator &ui, const map_location &target, bool continue_move, int side_num, mouse_handler &mousehandler) |
t_string | can_recruit (const std::string &name, int side_num, map_location &target_hex, map_location &recruited_from) |
bool | do_recruit (const std::string &name, int side_num, map_location &target_hex) |
void | do_speak () |
void | do_search (const std::string &new_search) |
void | do_command (const std::string &str) |
void | do_ai_formula (const std::string &str, int side_num, mouse_handler &mousehandler) |
void | send_to_server (const config &cfg) override |
game_state & | gamestate () const |
game_data & | gamedata () |
game_board & | board () const |
Protected Member Functions | |
void | add_chat_message (const std::time_t &time, const std::string &speaker, int side, const std::string &message, events::chat_handler::MESSAGE_TYPE type=events::chat_handler::MESSAGE_PRIVATE) override |
void | send_chat_message (const std::string &message, bool allies_only=false) override |
Private Member Functions | |
bool | has_friends () const |
Private Member Functions inherited from events::chat_handler | |
chat_handler () | |
virtual | ~chat_handler () |
void | send_command (const std::string &cmd, const std::string &args="") |
void | do_speak (const std::string &message, bool allies_only=false) |
virtual void | send_whisper (const std::string &receiver, const std::string &message) |
virtual void | add_whisper_sent (const std::string &receiver, const std::string &message) |
virtual void | add_whisper_received (const std::string &sender, const std::string &message) |
virtual void | send_chat_room_message (const std::string &room, const std::string &message) |
virtual void | add_chat_room_message_sent (const std::string &room, const std::string &message) |
virtual void | add_chat_room_message_received (const std::string &room, const std::string &speaker, const std::string &message) |
virtual void | user_relation_changed (const std::string &name) |
Called when a processed command results in a relation (friend/ignore) change for a user whose name is passed as the 'name' arg. More... | |
void | change_logging (const std::string &data) |
Change the log level of a log domain. More... | |
Private Attributes | |
game_display * | gui_ |
play_controller & | pc_ |
const game_config_view & | game_config_ |
gui::floating_textbox | textbox_info_ |
std::string | last_search_ |
map_location | last_search_hit_ |
Friends | |
class | console_handler |
Additional Inherited Members | |
Private Types inherited from events::chat_handler | |
enum | MESSAGE_TYPE { MESSAGE_PUBLIC , MESSAGE_PRIVATE } |
Definition at line 50 of file menu_events.hpp.
events::menu_handler::menu_handler | ( | game_display * | gui, |
play_controller & | pc | ||
) |
Definition at line 88 of file menu_events.cpp.
|
virtual |
Definition at line 98 of file menu_events.cpp.
|
overrideprotectedvirtual |
Implements events::chat_handler.
Definition at line 1053 of file menu_events.cpp.
References prefs::get(), plugins_manager::get(), prefs::login(), events::chat_handler::MESSAGE_PRIVATE, and plugins_manager::notify_event().
void events::menu_handler::ai_formula | ( | ) |
Definition at line 2139 of file menu_events.cpp.
References translation::sgettext(), and gui::TEXTBOX_AI.
Referenced by playsingle_controller::hotkey_handler::ai_formula().
game_board & events::menu_handler::board | ( | ) | const |
Definition at line 112 of file menu_events.cpp.
References game_state::board_, and gamestate().
Referenced by has_friends(), gui2::dialogs::mp_change_control::highlight_side_nick(), gui2::dialogs::mp_change_control::pre_show(), show_statistics(), speak(), and status_table().
t_string events::menu_handler::can_recruit | ( | const std::string & | name, |
int | side_num, | ||
map_location & | target_hex, | ||
map_location & | recruited_from | ||
) |
Definition at line 297 of file menu_events.cpp.
References _(), utils::contains(), unit_type::cost(), unit_type_data::find(), actions::find_recruit_location(), actions::get_recruits(), team::gold(), team::last_recruit(), loc, wfl::msg(), unit_type::type_name(), unit_types, and VGETTEXT.
Referenced by recruit().
void events::menu_handler::change_side | ( | mouse_handler & | mousehandler | ) |
Definition at line 766 of file menu_events.cpp.
References events::mouse_handler::get_last_hex(), actions::get_village(), i, loc, and display_context::village_owner().
Referenced by playsingle_controller::hotkey_handler::change_side().
void events::menu_handler::clear_labels | ( | ) |
Definition at line 829 of file menu_events.cpp.
References _(), replay::clear_labels(), gui2::OK, resources::recorder, gui2::show_message(), and gui2::dialogs::message::yes_no_buttons.
Referenced by playsingle_controller::hotkey_handler::clear_labels().
|
overridevirtual |
Implements events::chat_handler.
Definition at line 2146 of file menu_events.cpp.
Referenced by playsingle_controller::hotkey_handler::clear_messages().
void events::menu_handler::continue_move | ( | mouse_handler & | mousehandler, |
int | side_num | ||
) |
Definition at line 853 of file menu_events.cpp.
References events::mouse_handler::get_selected_hex(), and i.
Referenced by playsingle_controller::hotkey_handler::continue_move().
void events::menu_handler::create_unit | ( | mouse_handler & | mousehandler | ) |
Creates a unit (in debug mode via hotkey or context menu).
Definition at line 752 of file menu_events.cpp.
References events::mouse_handler::get_last_hex().
Referenced by playsingle_controller::hotkey_handler::create_unit().
unit_map::iterator events::menu_handler::current_unit | ( | ) |
Definition at line 666 of file menu_events.cpp.
References game_board::find_visible_unit(), events::mouse_handler::get_last_hex(), and events::mouse_handler::get_selected_hex().
Referenced by playsingle_controller::hotkey_handler::can_execute_command(), play_controller::hotkey_handler::can_execute_command(), current_unit(), and playsingle_controller::hotkey_handler::whiteboard_suppose_dead().
|
inline |
Definition at line 105 of file menu_events.hpp.
References current_unit().
void events::menu_handler::custom_command | ( | ) |
Definition at line 2132 of file menu_events.cpp.
References prefs::get(), and utils::split().
Referenced by playsingle_controller::hotkey_handler::custom_command().
void events::menu_handler::do_ai_formula | ( | const std::string & | str, |
int | side_num, | ||
mouse_handler & | mousehandler | ||
) |
Definition at line 2104 of file menu_events.cpp.
References ai::manager::get_singleton(), and utils::get_unknown_exception_type().
Referenced by play_controller::enter_textbox().
void events::menu_handler::do_command | ( | const std::string & | str | ) |
Definition at line 1428 of file menu_events.cpp.
References events::map_command_handler< Worker >::dispatch().
Referenced by play_controller::enter_textbox().
bool events::menu_handler::do_recruit | ( | const std::string & | name, |
int | side_num, | ||
map_location & | target_hex | ||
) |
Definition at line 342 of file menu_events.cpp.
References team::action_bonus_count(), replay_helper::get_recruit(), loc, map_location::null_location(), synced_context::run_and_throw(), team::set_action_bonus_count(), and gui2::show_transient_message().
Referenced by wb::recruit::execute().
void events::menu_handler::do_search | ( | const std::string & | new_search | ) |
Definition at line 1352 of file menu_events.cpp.
References gui2::dialogs::message::auto_close, translation::ci_search(), label, loc, wfl::msg(), display::ONSCREEN, gui2::show_message(), utils::split(), editor::start(), unit_name(), map_location::valid(), VGETTEXT, map_location::x, and map_location::y.
Referenced by play_controller::enter_textbox().
void events::menu_handler::do_speak | ( | ) |
Definition at line 1045 of file menu_events.cpp.
Referenced by play_controller::enter_textbox().
bool events::menu_handler::end_turn | ( | int | side_num | ) |
Definition at line 562 of file menu_events.cpp.
References _(), gui2::CANCEL, prefs::confirm_no_moves(), t_string::empty(), gamedata, prefs::get(), gui2::show_message(), gui2::show_transient_message(), and gui2::dialogs::message::yes_no_buttons.
Referenced by playsingle_controller::end_turn().
void events::menu_handler::end_unit_turn | ( | mouse_handler & | mousehandler, |
int | side_num | ||
) |
Definition at line 1013 of file menu_events.cpp.
References events::mouse_handler::cycle_units(), events::mouse_handler::deselect_hex(), events::mouse_handler::get_selected_hex(), and events::mouse_handler::set_current_paths().
Referenced by playsingle_controller::hotkey_handler::end_unit_turn().
void events::menu_handler::execute_gotos | ( | mouse_handler & | mousehandler, |
int | side_num | ||
) |
Definition at line 894 of file menu_events.cpp.
References unit::get_goto(), unit::get_location(), events::mouse_handler::get_route(), LOG_NG, pathfind::marked_route::marks, actions::move_unit_and_record(), unit::movement_left(), unit::set_goto(), unit::side(), pathfind::marked_route::steps, and w.
Referenced by playsingle_controller::execute_gotos().
game_data & events::menu_handler::gamedata | ( | ) |
Definition at line 107 of file menu_events.cpp.
References game_state::gamedata_, and gamestate().
game_state & events::menu_handler::gamestate | ( | ) | const |
Definition at line 102 of file menu_events.cpp.
References play_controller::gamestate(), and pc_.
Referenced by board(), gamedata(), and objectives().
std::vector< std::string > events::menu_handler::get_commands_list | ( | ) |
Definition at line 1434 of file menu_events.cpp.
References events::map_command_handler< Worker >::dispatch(), and events::map_command_handler< Worker >::get_commands_list().
Referenced by play_controller::tab().
gui::floating_textbox & events::menu_handler::get_textbox | ( | ) |
Definition at line 117 of file menu_events.cpp.
References textbox_info_.
Referenced by play_controller::enter_textbox(), play_controller::have_keyboard_focus(), play_controller::process_focus_keydown_event(), play_controller::tab(), and play_controller::textbox_move_vertically().
void events::menu_handler::goto_leader | ( | int | side_num | ) |
Definition at line 616 of file menu_events.cpp.
References i, and display::WARP.
Referenced by play_controller::hotkey_handler::goto_leader().
|
private |
Definition at line 217 of file menu_events.cpp.
References board(), play_controller::get_teams(), gui_, game_display::observers(), pc_, team::side(), t, team::team_name(), and display::viewing_team().
Referenced by speak().
void events::menu_handler::kill_unit | ( | mouse_handler & | mousehandler | ) |
Definition at line 797 of file menu_events.cpp.
References events::mouse_handler::get_last_hex(), loc, synced_context::run_and_throw(), map_location::wml_x(), and map_location::wml_y().
Referenced by playsingle_controller::hotkey_handler::kill_unit().
void events::menu_handler::label_settings | ( | ) |
Definition at line 846 of file menu_events.cpp.
Referenced by playsingle_controller::hotkey_handler::label_settings().
void events::menu_handler::label_terrain | ( | mouse_handler & | mousehandler, |
bool | team_only | ||
) |
Definition at line 803 of file menu_events.cpp.
References replay::add_label(), events::mouse_handler::get_last_hex(), team::get_side_color(), label, font::LABEL_COLOR, loc, resources::recorder, and terrain_label::text().
Referenced by playsingle_controller::hotkey_handler::label_terrain().
void events::menu_handler::move_unit_to_loc | ( | const unit_map::iterator & | ui, |
const map_location & | target, | ||
bool | continue_move, | ||
int | side_num, | ||
mouse_handler & | mousehandler | ||
) |
Definition at line 865 of file menu_events.cpp.
References events::mouse_handler::deselect_hex(), events::mouse_handler::get_route(), LOG_NG, actions::move_unit_and_record(), and pathfind::marked_route::steps.
void events::menu_handler::objectives | ( | ) |
Definition at line 122 of file menu_events.cpp.
References gamestate(), pc_, play_controller::refresh_objectives(), and play_controller::show_objectives().
Referenced by play_controller::hotkey_handler::objectives().
void events::menu_handler::preferences | ( | ) |
Definition at line 177 of file menu_events.cpp.
References gui_, and display::queue_rerender().
Referenced by play_controller::hotkey_handler::preferences().
void events::menu_handler::recall | ( | int | side_num, |
const map_location & | last_hex | ||
) |
Definition at line 365 of file menu_events.cpp.
References _(), DBG_WB, recall_list_manager::empty(), lg::err(), ERR_NG, actions::find_recall_location(), cursor::get(), replay_helper::get_recall(), actions::get_recalls(), gui2::dialogs::unit_recall::get_selected_index(), team::gold(), unit::id(), LOG_NG, wfl::msg(), unit::name(), map_location::null_location(), game_config::recall_cost, team::recall_cost(), team::recall_list(), synced_context::run_and_throw(), gui2::dialogs::modal_dialog::show(), gui2::show_transient_message(), and VNGETTEXT.
Referenced by playsingle_controller::hotkey_handler::recall().
void events::menu_handler::recruit | ( | int | side_num, |
const map_location & | last_hex | ||
) |
Definition at line 236 of file menu_events.cpp.
References can_recruit(), ERR_NG, unit_type_data::find(), utils::format_conjunct_list(), actions::get_recruits(), gui2::show_transient_message(), unit_types, and VNGETTEXT.
Referenced by playsingle_controller::hotkey_handler::recruit().
void events::menu_handler::rename_unit | ( | ) |
Definition at line 644 of file menu_events.cpp.
References _(), replay::add_rename(), label, and resources::recorder.
Referenced by playsingle_controller::hotkey_handler::rename_unit().
void events::menu_handler::repeat_recruit | ( | int | side_num, |
const map_location & | last_hex | ||
) |
Definition at line 285 of file menu_events.cpp.
Referenced by playsingle_controller::hotkey_handler::repeat_recruit().
void events::menu_handler::request_control_change | ( | int | side_num, |
const std::string & | player | ||
) |
Definition at line 2119 of file menu_events.cpp.
References prefs::get().
Referenced by gui2::dialogs::mp_change_control::post_show().
void events::menu_handler::save_map | ( | ) |
Definition at line 151 of file menu_events.cpp.
References _(), e, filesystem::get_legacy_editor_dir(), play_controller::get_map(), filesystem::map_extension, wfl::msg(), gui2::dialogs::file_dialog::path(), pc_, gui2::dialogs::file_dialog::set_extension(), gui2::dialogs::file_dialog::set_path(), gui2::dialogs::file_dialog::set_save_mode(), gui2::dialogs::file_dialog::set_title(), gui2::dialogs::modal_dialog::show(), gui2::show_transient_error_message(), gui2::show_transient_message(), VGETTEXT, gamemap::write(), and filesystem::write_file().
Referenced by play_controller::save_map().
void events::menu_handler::search | ( | ) |
Definition at line 1034 of file menu_events.cpp.
References _(), wfl::msg(), and gui::TEXTBOX_SEARCH.
Referenced by play_controller::hotkey_handler::search().
|
overrideprotectedvirtual |
Implements events::chat_handler.
Definition at line 1322 of file menu_events.cpp.
References prefs::get(), display_context::is_observer(), prefs::login(), events::chat_handler::MESSAGE_PRIVATE, events::chat_handler::MESSAGE_PUBLIC, game_config::observer_team_name, game_config::sounds::private_message, resources::recorder, chrono::serialize_timestamp(), and replay::speak().
|
overridevirtual |
Implements events::chat_handler.
Definition at line 2151 of file menu_events.cpp.
|
inline |
Definition at line 57 of file menu_events.hpp.
References gui_.
Referenced by play_controller::init().
void events::menu_handler::shout | ( | ) |
Definition at line 211 of file menu_events.cpp.
References prefs::get(), prefs::set_message_private(), and speak().
Referenced by playmp_controller::hotkey_handler::shout().
void events::menu_handler::show_chat_log | ( | ) |
Definition at line 184 of file menu_events.cpp.
References c, and resources::recorder.
Referenced by play_controller::hotkey_handler::show_chat_log().
void events::menu_handler::show_enemy_moves | ( | bool | ignore_units, |
int | side_num | ||
) |
Definition at line 457 of file menu_events.cpp.
References events::mouse_handler::disable_units_highlight(), events::mouse_handler::hex_hosts_unit(), events::mouse_handler::hovered_hex(), and game_config::path.
Referenced by play_controller::hotkey_handler::show_enemy_moves().
void events::menu_handler::show_help | ( | ) |
Definition at line 191 of file menu_events.cpp.
References help::show_help().
Referenced by play_controller::hotkey_handler::show_help().
void events::menu_handler::show_statistics | ( | int | side_num | ) |
Definition at line 132 of file menu_events.cpp.
References board(), pc_, and play_controller::statistics().
Referenced by play_controller::hotkey_handler::show_statistics().
void events::menu_handler::speak | ( | ) |
Definition at line 196 of file menu_events.cpp.
References _(), board(), prefs::get(), gui_, has_friends(), gui::floating_textbox::show(), textbox_info_, and gui::TEXTBOX_MESSAGE.
Referenced by shout(), play_controller::hotkey_handler::speak(), and whisper().
void events::menu_handler::status_table | ( | ) |
Definition at line 142 of file menu_events.cpp.
References board(), gui2::dialogs::game_stats::execute(), gui_, game_display::scroll_to_leader(), and display::viewing_team().
Referenced by play_controller::hotkey_handler::status_table().
void events::menu_handler::terrain_description | ( | mouse_handler & | mousehandler | ) |
Definition at line 632 of file menu_events.cpp.
References events::mouse_handler::get_last_hex(), loc, and help::show_terrain_description().
Referenced by play_controller::hotkey_handler::terrain_description().
void events::menu_handler::toggle_ellipses | ( | ) |
Definition at line 986 of file menu_events.cpp.
References prefs::get().
Referenced by play_controller::hotkey_handler::toggle_ellipses().
void events::menu_handler::toggle_grid | ( | ) |
Definition at line 992 of file menu_events.cpp.
References prefs::get().
Referenced by play_controller::hotkey_handler::toggle_grid().
void events::menu_handler::toggle_shroud_updates | ( | int | side_num | ) |
Definition at line 496 of file menu_events.cpp.
References team::auto_shroud_updates(), replay_helper::get_auto_shroud(), and synced_context::run_and_throw().
Referenced by playsingle_controller::hotkey_handler::toggle_shroud_updates().
void events::menu_handler::unit_description | ( | ) |
Definition at line 624 of file menu_events.cpp.
References help::show_unit_description().
Referenced by play_controller::hotkey_handler::unit_description().
void events::menu_handler::unit_hold_position | ( | mouse_handler & | mousehandler, |
int | side_num | ||
) |
Definition at line 998 of file menu_events.cpp.
References events::mouse_handler::cycle_units(), events::mouse_handler::get_selected_hex(), and events::mouse_handler::set_current_paths().
Referenced by playsingle_controller::hotkey_handler::unit_hold_position().
void events::menu_handler::unit_list | ( | ) |
Definition at line 137 of file menu_events.cpp.
References gui_, and gui2::dialogs::show_unit_list().
Referenced by play_controller::hotkey_handler::unit_list().
void events::menu_handler::update_shroud_now | ( | int | side_num | ) |
Definition at line 509 of file menu_events.cpp.
References replay_helper::get_update_shroud(), and synced_context::run_and_throw().
Referenced by playsingle_controller::hotkey_handler::update_shroud_now().
void events::menu_handler::user_command | ( | ) |
Definition at line 2114 of file menu_events.cpp.
References translation::sgettext(), and gui::TEXTBOX_COMMAND.
Referenced by playsingle_controller::hotkey_handler::user_command().
void events::menu_handler::whisper | ( | ) |
Definition at line 205 of file menu_events.cpp.
References prefs::get(), prefs::set_message_private(), and speak().
Referenced by playmp_controller::hotkey_handler::whisper().
|
friend |
Definition at line 141 of file menu_events.hpp.
|
private |
Definition at line 149 of file menu_events.hpp.
|
private |
Definition at line 146 of file menu_events.hpp.
Referenced by has_friends(), preferences(), set_gui(), speak(), status_table(), and unit_list().
|
private |
Definition at line 152 of file menu_events.hpp.
|
private |
Definition at line 153 of file menu_events.hpp.
|
private |
Definition at line 147 of file menu_events.hpp.
Referenced by gamestate(), has_friends(), objectives(), save_map(), and show_statistics().
|
private |
Definition at line 151 of file menu_events.hpp.
Referenced by get_textbox(), and speak().