39 #include <boost/algorithm/string/predicate.hpp>
41 namespace balg = boost::algorithm;
45 , playsingle_controller_(pc)
46 , whiteboard_manager_(pc.get_whiteboard())
83 playsingle_controller_.end_turn();
154 symbols[
"hotkey"] = hk;
188 const unit* curr_unit;
211 int prefixlen = wml_menu_hotkey_prefix.length();
216 if(cmd.
id.compare(0, prefixlen, wml_menu_hotkey_prefix) == 0) {
221 return !item->is_synced() || play_controller_.can_use_synced_wml_menu();
241 && (
gui()->viewing_team().uses_fog() ||
gui()->viewing_team().uses_shroud())
242 &&
gui()->viewing_team_is_playing()
243 &&
gui()->viewing_team().is_local_human()
247 &&
gui()->viewing_team_is_playing()
248 &&
gui()->viewing_team().is_local_human()
250 &&
gui()->viewing_team().auto_shroud_updates() ==
false;
279 if (!
i.valid())
return false;
280 return i->move_interrupted();
309 return playsingle_controller_.get_replay_controller() && playsingle_controller_.get_replay_controller()->can_execute_command(cmd);
311 return playsingle_controller_.is_replay() && (!playsingle_controller_.is_networked_mp() ||
resources::recorder->
at_end());
332 #ifdef __cpp_designated_initializers
341 if(
savegame.child_or_empty(
"snapshot")[
"replay_pos"].to_int(-1) < 0 ) {
345 if(!playsingle_controller_.get_saved_game().get_replay().is_ancestor(
savegame.child_or_empty(
"replay"))) {
350 auto res = std::make_shared<config>(
savegame.child_or_empty(
"snapshot"));
351 auto stats = std::make_shared<config>(
savegame.child_or_empty(
"statistics"));
357 if(!playsingle_controller_.is_networked_mp()) {
360 playsingle_controller_.set_player_type_changed();
A config object defines a single node in a WML file, with access to child nodes.
void label_terrain(mouse_handler &mousehandler, bool team_only)
void update_shroud_now(int side_num)
virtual void clear_messages() override
void recall(int side_num, const map_location &last_hex)
void create_unit(mouse_handler &mousehandler)
Creates a unit (in debug mode via hotkey or context menu).
void unit_hold_position(mouse_handler &mousehandler, int side_num)
void end_unit_turn(mouse_handler &mousehandler, int side_num)
void change_side(mouse_handler &mousehandler)
void toggle_shroud_updates(int side_num)
void recruit(int side_num, const map_location &last_hex)
void continue_move(mouse_handler &mousehandler, int side_num)
void repeat_recruit(int side_num, const map_location &last_hex)
void kill_unit(mouse_handler &mousehandler)
unit_map::iterator current_unit()
map_location get_selected_hex() const
const map_location & get_last_hex() const
std::shared_ptr< wml_menu_item > item_ptr
wml_menu_item pointers
item_ptr get_item(const std::string &id) const
Gets the menu item with the specified ID.
game_events::wmi_manager & get_wml_menu_items()
virtual hotkey::action_state get_action_state(const hotkey::ui_command &) const override
virtual bool can_execute_command(const hotkey::ui_command &command) const override
Check if a command can be executed.
events::menu_handler menu_handler_
events::mouse_handler mouse_handler_
std::shared_ptr< wb::manager > whiteboard_manager_
virtual void select_teleport() override
virtual void continue_move() override
virtual void toggle_shroud_updates() override
virtual void end_turn() override
virtual void update_shroud_now() override
virtual void clear_labels() override
virtual void whiteboard_suppose_dead() override
virtual void end_unit_turn() override
virtual void clear_messages() override
virtual void custom_command() override
hotkey_handler(playsingle_controller &, saved_game &)
virtual void unit_hold_position() override
virtual hotkey::action_state get_action_state(const hotkey::ui_command &) const override
virtual bool can_execute_command(const hotkey::ui_command &cmd) const override
Check if a command can be executed.
virtual void recall() override
virtual void recruit() override
virtual void whiteboard_delete_action() override
virtual void change_side() override
virtual void whiteboard_execute_action() override
virtual void kill_unit() override
virtual void create_unit() override
virtual void label_terrain(bool) override
virtual void ai_formula() override
virtual void load_autosave(const std::string &filename, bool start_replay=false) override
virtual void replay_exit() override
virtual void label_settings() override
virtual void rename_unit() override
virtual void user_command() override
virtual void whiteboard_bump_up_action() override
virtual void whiteboard_toggle() override
virtual void whiteboard_bump_down_action() override
virtual void whiteboard_execute_all_actions() override
virtual void repeat_recruit() override
void delete_upcoming_commands()
Exception used to signal that the user has decided to abort a game, and to load another game instead.
To store label data Class implements logic for rendering.
This class represents a single unit of a specific type.
Declarations for File-IO.
static std::string _(const char *str)
const map_location & get_location() const
The current map location this unit is at.
std::string label
What to show in the filter's drop-down list.
An extension of play_controller::hotkey_handler, which has support for SP wesnoth features like white...
std::string get_saves_dir()
const color_t NORMAL_COLOR
void show_error_message(const std::string &msg, bool message_use_markup)
Shows an error message to the user.
std::string get_names(const std::string &id)
Returns a comma-separated string of hotkey names.
action_state on_if(bool condition)
Returns action_state::on if condition is true, else action_state::off.
const hotkey_command & get_hotkey_command(std::string_view command)
Returns the hotkey_command with the given id.
@ HOTKEY_WB_EXECUTE_ALL_ACTIONS
@ HOTKEY_LABEL_TEAM_TERRAIN
@ HOTKEY_UNIT_HOLD_POSITION
@ HOTKEY_REPLAY_NEXT_TURN
@ HOTKEY_REPLAY_SHOW_EVERYTHING
@ HOTKEY_REPLAY_SHOW_TEAM1
@ HOTKEY_WB_EXECUTE_ACTION
@ HOTKEY_WB_BUMP_UP_ACTION
@ HOTKEY_REPLAY_NEXT_SIDE
@ HOTKEY_REPLAY_NEXT_MOVE
@ HOTKEY_REPLAY_SKIP_ANIMATION
@ HOTKEY_WB_BUMP_DOWN_ACTION
@ HOTKEY_REPLAY_SHOW_EACH
@ HOTKEY_WB_DELETE_ACTION
config read_save_file(const std::string &dir, const std::string &name)
Read the complete config information out of a savefile.
std::map< std::string, t_string > string_map
std::string filename
Filename.
Error used when game loading fails.
Used as the main parameter for can_execute_command/do_execute_command These functions are used to exe...
hotkey::HOTKEY_COMMAND hotkey_command
The hotkey::HOTKEY_COMMAND associated with this action, HOTKEY_NULL for actions that don't allow hotk...
std::string id
The string command, never empty, describes the action uniquely.
Encapsulates the map of the game.
Applies the planned unit map for the duration of the struct's life.
Declarations for a container for wml_menu_item.