19 #ifndef WB_MANAGER_HPP_
20 #define WB_MANAGER_HPP_
26 #include <boost/noncopyable.hpp>
43 class manager :
private boost::noncopyable
205 bool print_help_once_;
227 boost::scoped_ptr<pathfind::marked_route>
route_;
263 : future_map_(cond ? new
future_map() : nullptr)
whiteboard_lock unit_map_lock_
bool initial_planned_unit_map_
bool can_activate() const
Determine whether the whiteboard can be activated safely.
void update_plan_hiding()
bool can_enable_modifier_hotkeys() const
Used to ask the whiteboard if hotkeys affecting the action queue should be available to the user...
void on_viewer_change(size_t team_index)
void process_network_data(config const &)
Called by turn_info::process_network_data() when network data needs to be processed.
bool can_enable_reorder_hotkeys() const
Used to ask the whiteboard if its action reordering hotkeys should be available to the user...
bool initial_planned_unit_map_
std::vector< arrow_ptr > move_arrows_
void set_invert_behavior(bool invert)
Called by the key that temporarily toggles the activated state when held.
void contextual_delete()
Deletes last action in the queue for current side.
whiteboard_lock activation_state_lock_
Reference counted "lock" to allow preventing whiteboard activation state changes. ...
void validate_actions_if_needed()
void post_delete_action(action_ptr action)
Handles various cleanup right after removing an action from the queue.
boost::scoped_ptr< mapbuilder > mapbuilder_
boost::scoped_ptr< future_map > future_map_
void save_suppose_dead(unit &curr_unit, map_location const &loc)
Creates a suppose-dead action for the current side.
boost::shared_ptr< highlighter > highlighter_
bool is_active() const
Determine whether the whiteboard is activated.
size_t temp_move_unit_underlying_id_
bool executing_all_actions_
Track whether we're in the process of executing all actions.
void pre_draw()
Called from the display before drawing.
void contextual_bump_down_action()
Moves the action determined by the UI toward the beginning of the queue.
void save_temp_move()
Creates a move action for the current side, and erases the temp move.
void set_active(bool active)
Activates/Deactivates the whiteboard.
std::vector< fake_unit_ptr > fake_units_
std::vector< map_location > hidden_unit_hexes_
bool can_enable_execution_hotkeys() const
Used to ask the whiteboard if its action execution hotkeys should be available to the user...
void save_temp_attack(const map_location &attacker_loc, const map_location &defender_loc, int weapon_choice)
Creates an attack or attack-move action for the current side.
bool planned_unit_map_active_
void on_gamestate_change()
void draw_hex(const map_location &hex)
Called from the display when drawing hexes, to allow the whiteboard to add visual elements...
This class stores all the data for a single 'side' (in game nomenclature).
boost::scoped_ptr< pathfind::marked_route > route_
whiteboard_lock unit_map_lock_
Reference counted "lock" to prevent the building of the unit map at certain times.
void queue_net_cmd(size_t team_index, side_actions::net_cmd const &)
Adds a side_actions::net_cmd to net_buffer_[team_index], whereupon it will (later) be sent to all all...
void set_real_unit_map()
Restore the regular unit map.
bool has_actions() const
Checks whether the whiteboard has any planned action on any team.
void options_dlg()
Displays the whiteboard options dialog.
unit_map::iterator get_temp_move_unit() const
Applies the planned unit map for the duration of the struct's life.
void contextual_execute()
Executes first action in the queue for current side.
This class is the frontend of the whiteboard framework for the rest of the Wesnoth code...
boost::scoped_ptr< CKey > key_poller_
bool gamestate_mutated_
Track whether the gamestate changed and we need to validate actions.
bool allow_end_turn()
@ return true if the whiteboard is ready to end turn.
bool initial_planned_unit_map_
static bool current_side_has_actions()
Whether the current side has actions in the first turn of its planned actions queue.
std::set< size_t > units_owning_moves_
used to keep track of units owning planned moves for visual ghosting/unghosting
bool preparing_to_end_turn_
true if we're in the process of executing all action and should end turn once finished.
bool active_
Tracks whether the whiteboard is active.
void on_change_controller(int side, const team &t)
void on_finish_side_turn(int side)
std::vector< bool > team_plans_hidden_
team_plans_hidden_[i] = whether or not to hide actions from teams[i].
Encapsulates the map of the game.
bool save_recruit(const std::string &name, int side_num, const map_location &recruit_hex)
Creates a recruit action for the current side.
void post_draw()
Called from the display after drawing.
int get_spent_gold_for(int side)
Used to track gold spending per-side when building the planned unit map Is referenced by the top bar ...
void erase_temp_move()
Erase the temporary arrow.
bool can_modify_game_state() const
Determine whether the game is initialized and the current side has control of the game i...
std::vector< config > net_buffer_
net_buffer_[i] = whiteboard network data to be sent "from" teams[i].
ONLY IF whiteboard is currently active, applies the planned unit map for the duration of the struct's...
void create_temp_move()
Creates a temporary visual arrow, that follows the cursor, for move creation purposes.
bool allow_leader_to_move(unit const &leader) const
Used to ask permission to the wb to move a leader, to avoid invalidating planned recruits.
void contextual_bump_up_action()
Moves the action determined by the UI toward the beginning of the queue.
GLuint const GLchar * name
void on_init_side()
The on_* methods below inform the whiteboard of specific events.
bool save_recall(const unit &unit, int side_num, const map_location &recall_hex)
Creates a recall action for the current side.
whiteboard_lock get_activation_state_lock()
Prevents the whiteboard from changing its activation state, as long as the returned reference is held...
bool is_executing_actions() const
Is the whiteboard in the process of executing an action?
void send_network_data()
Called by replay_network_sender to add whiteboard data to the outgoing network packets.
static int cond(LexState *ls)
boost::weak_ptr< highlighter > get_highlighter()
Get the highlight visitor instance in use by the manager.
bool should_clear_undo() const
Determines whether or not the undo_stack should be cleared.
bool has_temp_move() const
Informs whether an arrow is being displayed for move creation purposes.
Ensures that the real unit map is active for the duration of the struct's life.
Abstract base class for all the whiteboard planned actions.
A config object defines a single node in a WML file, with access to child nodes.
bool executing_actions_
Track whenever we're modifying actions, to avoid dual execution etc.
Class that keeps track of all the keys on the keyboard.
bool execute_all_actions()
Executes all actions for the current turn in sequence.
void on_mouseover_change(const map_location &hex)
void validate_viewer_actions()
Validates all actions of the current viewing side.
GLsizei const GLcharARB ** string
bool unit_has_actions(unit const *unit) const
Checks whether the specified unit has at least one planned action.
bool has_planned_unit_map() const
Whether the planned unit map is currently applied.
void set_planned_unit_map()
Transforms the unit map so that it now reflects the future state of things, i.e.
void pre_delete_action(action_ptr action)
Handles various cleanup right before removing an action from the queue.