The Battle for Wesnoth  1.15.5+dev
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
events::menu_handler Class Reference

#include <menu_events.hpp>

Inheritance diagram for events::menu_handler:
Inheritance graph

Public Member Functions

 menu_handler (game_display *gui, play_controller &pc)
virtual ~menu_handler ()
gui::floating_textboxget_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 ()
void clear_messages ()
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_stategamestate () const
game_datagamedata ()
game_boardboard () const
unit_mapunits ()
std::vector< team > & teams () const
const gamemapmap () 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

const game_config_viewgame_config_
gui::floating_textbox textbox_info_
std::string last_search_
map_location last_search_hit_


class console_handler

Additional Inherited Members

- Private Types inherited from events::chat_handler

Detailed Description

Definition at line 47 of file menu_events.hpp.

Constructor & Destructor Documentation

◆ menu_handler()

events::menu_handler::menu_handler ( game_display gui,
play_controller pc 

Definition at line 93 of file menu_events.cpp.

◆ ~menu_handler()

events::menu_handler::~menu_handler ( )

Definition at line 103 of file menu_events.cpp.

Member Function Documentation

◆ add_chat_message()

void events::menu_handler::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 

◆ ai_formula()

void events::menu_handler::ai_formula ( )

◆ board()

game_board & events::menu_handler::board ( ) const

◆ can_recruit()

t_string events::menu_handler::can_recruit ( const std::string &  name,
int  side_num,
map_location target_hex,
map_location recruited_from 
If the recruit is possible, an empty string and set recruited_from; otherwise, return an error message string.

Definition at line 317 of file menu_events.cpp.

References _(), board(), utils::contains(), unit_type::cost(), unit_type_data::find(), actions::find_recruit_location(), actions::get_recruits(), game_board::get_team(), play_controller::get_whiteboard(), team::gold(), team::last_recruit(), wfl::msg(), pc_, mariadb::value::string, unit_type::type_name(), unit_types, and VGETTEXT.

Referenced by do_recruit(), and recruit().

◆ change_side()

void events::menu_handler::change_side ( mouse_handler mousehandler)

◆ clear_labels()

void events::menu_handler::clear_labels ( )

◆ clear_messages()

void events::menu_handler::clear_messages ( )

◆ continue_move()

void events::menu_handler::continue_move ( mouse_handler mousehandler,
int  side_num 

◆ create_unit()

void events::menu_handler::create_unit ( mouse_handler mousehandler)

Creates a unit (in debug mode via hotkey or context menu).

Definition at line 774 of file menu_events.cpp.

References events::mouse_handler::get_last_hex(), gui_, map(), and units().

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

◆ current_unit() [1/2]

unit_map::iterator events::menu_handler::current_unit ( )

◆ current_unit() [2/2]

unit_map::const_iterator events::menu_handler::current_unit ( ) const

◆ custom_command()

void events::menu_handler::custom_command ( )

◆ do_ai_formula()

void events::menu_handler::do_ai_formula ( const std::string &  str,
int  side_num,
mouse_handler mousehandler 

◆ do_command()

void events::menu_handler::do_command ( const std::string &  str)

◆ do_recruit()

bool events::menu_handler::do_recruit ( const std::string &  name,
int  side_num,
map_location target_hex 

◆ do_search()

void events::menu_handler::do_search ( const std::string &  new_search)

◆ do_speak()

void events::menu_handler::do_speak ( )

◆ end_turn()

bool events::menu_handler::end_turn ( int  side_num)

◆ end_unit_turn()

void events::menu_handler::end_unit_turn ( mouse_handler mousehandler,
int  side_num 

◆ execute_gotos()

void events::menu_handler::execute_gotos ( mouse_handler mousehandler,
int  side_num 

◆ gamedata()

game_data & events::menu_handler::gamedata ( )

Definition at line 112 of file menu_events.cpp.

References game_state::gamedata_, and gamestate().

Referenced by end_turn().

◆ gamestate()

game_state & events::menu_handler::gamestate ( ) const

Definition at line 107 of file menu_events.cpp.

References play_controller::gamestate(), and pc_.

Referenced by board(), gamedata(), map(), objectives(), teams(), and units().

◆ get_commands_list()

std::vector< std::string > events::menu_handler::get_commands_list ( )

◆ get_textbox()

gui::floating_textbox & events::menu_handler::get_textbox ( )

◆ goto_leader()

void events::menu_handler::goto_leader ( int  side_num)

◆ has_friends()

bool events::menu_handler::has_friends ( ) const

Definition at line 240 of file menu_events.cpp.

References board(), gui_, n, game_display::observers(), teams(), and display::viewing_team().

Referenced by send_chat_message(), and speak().

◆ kill_unit()

void events::menu_handler::kill_unit ( mouse_handler mousehandler)

◆ label_settings()

void events::menu_handler::label_settings ( )

◆ label_terrain()

void events::menu_handler::label_terrain ( mouse_handler mousehandler,
bool  team_only 

◆ map()

const gamemap & events::menu_handler::map ( ) const

◆ move_unit_to_loc()

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 

◆ objectives()

void events::menu_handler::objectives ( )

◆ preferences()

void events::menu_handler::preferences ( )

◆ recall()

void events::menu_handler::recall ( int  side_num,
const map_location last_hex 

◆ recruit()

void events::menu_handler::recruit ( int  side_num,
const map_location last_hex 

◆ rename_unit()

void events::menu_handler::rename_unit ( )

◆ repeat_recruit()

void events::menu_handler::repeat_recruit ( int  side_num,
const map_location last_hex 

◆ request_control_change()

void events::menu_handler::request_control_change ( int  side_num,
const std::string &  player 

◆ save_map()

void events::menu_handler::save_map ( )

◆ search()

void events::menu_handler::search ( )

◆ send_chat_message()

void events::menu_handler::send_chat_message ( const std::string &  message,
bool  allies_only = false 

◆ send_to_server()

void events::menu_handler::send_to_server ( const config cfg)

Implements events::chat_handler.

Definition at line 2130 of file menu_events.cpp.

References pc_, and play_controller::send_to_wesnothd().

◆ set_gui()

void events::menu_handler::set_gui ( game_display gui)

◆ shout()

void events::menu_handler::shout ( )

◆ show_chat_log()

void events::menu_handler::show_chat_log ( )

Definition at line 205 of file menu_events.cpp.

References c, and resources::recorder.

Referenced by play_controller::hotkey_handler::show_chat_log().

◆ show_enemy_moves()

void events::menu_handler::show_enemy_moves ( bool  ignore_units,
int  side_num 

◆ show_help()

void events::menu_handler::show_help ( )

Definition at line 214 of file menu_events.cpp.

References help::show_help().

Referenced by play_controller::hotkey_handler::show_help().

◆ show_statistics()

void events::menu_handler::show_statistics ( int  side_num)

Definition at line 152 of file menu_events.cpp.

References board().

Referenced by play_controller::hotkey_handler::show_statistics().

◆ speak()

void events::menu_handler::speak ( )

◆ status_table()

void events::menu_handler::status_table ( )

◆ teams()

std::vector< team > & events::menu_handler::teams ( ) const

◆ terrain_description()

void events::menu_handler::terrain_description ( mouse_handler mousehandler)

◆ toggle_ellipses()

void events::menu_handler::toggle_ellipses ( )

◆ toggle_grid()

void events::menu_handler::toggle_grid ( )

◆ toggle_shroud_updates()

void events::menu_handler::toggle_shroud_updates ( int  side_num)

◆ unit_description()

void events::menu_handler::unit_description ( )

◆ unit_hold_position()

void events::menu_handler::unit_hold_position ( mouse_handler mousehandler,
int  side_num 

◆ unit_list()

void events::menu_handler::unit_list ( )

Definition at line 157 of file menu_events.cpp.

References gui_, and gui2::dialogs::show_unit_list().

Referenced by play_controller::hotkey_handler::unit_list().

◆ units()

unit_map & events::menu_handler::units ( )

◆ update_shroud_now()

void events::menu_handler::update_shroud_now ( int  side_num)

◆ user_command()

void events::menu_handler::user_command ( )

◆ whisper()

void events::menu_handler::whisper ( )

Friends And Related Function Documentation

◆ console_handler

friend class console_handler

Definition at line 141 of file menu_events.hpp.

Member Data Documentation

◆ game_config_

const game_config_view& events::menu_handler::game_config_

Definition at line 150 of file menu_events.hpp.

Referenced by preferences().

◆ gui_

game_display* events::menu_handler::gui_

◆ last_search_

std::string events::menu_handler::last_search_

Definition at line 153 of file menu_events.hpp.

Referenced by do_search(), and search().

◆ last_search_hit_

map_location events::menu_handler::last_search_hit_

Definition at line 154 of file menu_events.hpp.

Referenced by do_search(), and search().

◆ pc_

play_controller& events::menu_handler::pc_

◆ textbox_info_

gui::floating_textbox events::menu_handler::textbox_info_

Definition at line 152 of file menu_events.hpp.

Referenced by ai_formula(), do_speak(), get_textbox(), search(), speak(), and user_command().

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