The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Classes | Typedefs | Functions
wb Namespace Reference

Classes

class  action
 Abstract base class for all the whiteboard planned actions. More...
 
class  attack
 
struct  future_map
 Applies the planned unit map for the duration of the struct's life. More...
 
struct  future_map_if
 
struct  future_map_if_active
 ONLY IF whiteboard is currently active, applies the planned unit map for the duration of the struct's life. More...
 
class  highlighter
 Class that handles highlighting planned actions as you hover over them and determine the right target for contextual execution. More...
 
class  manager
 This class is the frontend of the whiteboard framework for the rest of the Wesnoth code. More...
 
class  mapbuilder
 Class that collects and applies unit_map modifications from the actions it visits and reverts all changes on destruction. More...
 
class  move
 A planned move, represented on the map by an arrow and a ghosted unit in the destination hex. More...
 
struct  real_map
 Ensures that the real unit map is active for the duration of the struct's life. More...
 
class  recall
 
class  recruit
 
class  side_actions
 This internal whiteboard class holds the planned action queues for a team, and offers many utility methods to create and manipulate them. More...
 
class  side_actions_container
 Datastructure holding the actions of a side on multiple turns. More...
 
class  suppose_dead
 A planned action that temporarily removes a unit from the map for planning purposes. More...
 
struct  temporary_unit_hider
 
class  variable_finalizer
 Finalizer class to help with exception safety sets variable to value on destruction. More...
 
class  visitor
 Abstract base class for all the visitors (cf GoF Visitor Design Pattern) the whiteboard uses. More...
 

Typedefs

typedef boost::shared_ptr< bool > whiteboard_lock
 
typedef boost::shared_ptr< arrowarrow_ptr
 
typedef boost::shared_ptr< actionaction_ptr
 
typedef boost::shared_ptr
< action const > 
action_const_ptr
 
typedef boost::weak_ptr< actionweak_action_ptr
 
typedef std::deque< action_ptraction_queue
 
typedef boost::shared_ptr
< side_actions
side_actions_ptr
 
typedef boost::shared_ptr< movemove_ptr
 
typedef boost::shared_ptr
< move const > 
move_const_ptr
 
typedef boost::shared_ptr< attackattack_ptr
 
typedef boost::shared_ptr
< attack const > 
attack_const_ptr
 
typedef boost::shared_ptr
< recruit
recruit_ptr
 
typedef boost::shared_ptr
< recruit const > 
recruit_const_ptr
 
typedef boost::shared_ptr< recallrecall_ptr
 
typedef boost::shared_ptr
< recall const > 
recall_const_ptr
 
typedef boost::shared_ptr
< suppose_dead
suppose_dead_ptr
 
typedef boost::shared_ptr
< suppose_dead const > 
suppose_dead_const_ptr
 
typedef std::function< bool(team &)> team_filter
 Callable object class to filter teams. More...
 

Functions

std::ostream & operator<< (std::ostream &s, action_ptr action)
 
std::ostream & operator<< (std::ostream &s, action_const_ptr action)
 
std::ostream & operator<< (std::ostream &s, attack_ptr attack)
 Dumps an attack on a stream, for debug purposes. More...
 
std::ostream & operator<< (std::ostream &s, attack_const_ptr attack)
 
static void hide_all_plans ()
 
static void draw_numbers (map_location const &hex, side_actions::numbers_t numbers)
 
std::ostream & operator<< (std::ostream &s, move_ptr move)
 Dumps an move on a stream, for debug purposes. More...
 
std::ostream & operator<< (std::ostream &s, move_const_ptr move)
 
std::ostream & operator<< (std::ostream &s, recall_ptr recall)
 
std::ostream & operator<< (std::ostream &s, recall_const_ptr recall)
 
std::ostream & operator<< (std::ostream &s, recruit_ptr recruit)
 
std::ostream & operator<< (std::ostream &s, recruit_const_ptr recruit)
 
std::ostream & operator<< (std::ostream &out, wb::side_actions const &side_actions)
 Dumps side_actions on a stream, for debug purposes. More...
 
std::ostream & operator<< (std::ostream &s, suppose_dead_ptr sup_d)
 Dumps a suppose_dead on a stream, for debug purposes. More...
 
std::ostream & operator<< (std::ostream &s, suppose_dead_const_ptr sup_d)
 
size_t viewer_team ()
 
int viewer_side ()
 
side_actions_ptr viewer_actions ()
 
side_actions_ptr current_side_actions ()
 
unit_const_ptr find_backup_leader (unit const &leader)
 For a given leader on a keep, find another leader on another keep in the same castle. More...
 
unitfind_recruiter (size_t team_index, map_location const &)
 
unitfuture_visible_unit (map_location hex, int viewer_side=wb::viewer_side())
 Applies the future unit map and. More...
 
unitfuture_visible_unit (int on_side, map_location hex, int viewer_side=wb::viewer_side())
 Applies the future unit map and. More...
 
int path_cost (std::vector< map_location > const &path, unit const &u)
 Computes the MP cost for u to travel path. More...
 
void ghost_owner_unit (unit *unit)
 
void unghost_owner_unit (unit *unit)
 
bool has_actions ()
 Return whether the whiteboard has actions. More...
 
bool team_has_visible_plan (team &)
 Returns whether a given team's plan is visible. More...
 
void for_each_action (std::function< void(action *)> function, team_filter team_filter=team_has_visible_plan)
 Apply a function to all the actions of the whiteboard. More...
 
action_ptr find_action_at (map_location hex, team_filter team_filter=team_has_visible_plan)
 Find the first action occuring on a given hex. More...
 
std::deque< action_ptrfind_actions_of (unit const &target)
 Find the actions of an unit. More...
 

Typedef Documentation

Definition at line 71 of file typedefs.hpp.

Definition at line 70 of file typedefs.hpp.

typedef std::deque<action_ptr> wb::action_queue

Definition at line 73 of file typedefs.hpp.

Definition at line 68 of file typedefs.hpp.

Definition at line 79 of file typedefs.hpp.

Definition at line 78 of file typedefs.hpp.

Definition at line 77 of file typedefs.hpp.

Definition at line 76 of file typedefs.hpp.

Definition at line 83 of file typedefs.hpp.

Definition at line 82 of file typedefs.hpp.

Definition at line 81 of file typedefs.hpp.

Definition at line 80 of file typedefs.hpp.

Definition at line 74 of file typedefs.hpp.

Definition at line 85 of file typedefs.hpp.

Definition at line 84 of file typedefs.hpp.

typedef std::function<bool(team&)> wb::team_filter

Callable object class to filter teams.

The argument is the team to consider.

Definition at line 115 of file utility.hpp.

typedef boost::weak_ptr<action> wb::weak_action_ptr

Definition at line 72 of file typedefs.hpp.

Definition at line 64 of file typedefs.hpp.

Function Documentation

side_actions_ptr wb::current_side_actions ( )
Returns
The side_actions instance belonging to the current playing team

Definition at line 56 of file utility.cpp.

References resources::controller, and play_controller::current_side().

Referenced by wb::manager::current_side_has_actions().

static void wb::draw_numbers ( map_location const &  hex,
side_actions::numbers_t  numbers 
)
static
action_ptr wb::find_action_at ( map_location  hex,
team_filter  team_filter = team_has_visible_plan 
)

Find the first action occuring on a given hex.

The actions are processed chronologically. The second parameter is a team_filter, it is called for each team, if it returns false, the actions of this team won't be considered.

Parameters
hexwhere to search for an action.
team_filterselect whether a team is visited (default to team_has_visible_plan).
Return values
action_ptr()when no action verifying the team_filter are present on the given hex.

Definition at line 185 of file utility.cpp.

References wb::side_actions::end(), wb::side_actions::find_first_action_at(), wb::side_actions::get_turn(), and resources::teams.

Referenced by wb::highlighter::find_main_highlight().

std::deque< action_ptr > wb::find_actions_of ( unit const &  target)

Find the actions of an unit.

Parameters
targetthe unit owning the actions.

Definition at line 209 of file utility.cpp.

References unit::side(), and resources::teams.

Referenced by wb::highlighter::find_secondary_highlights().

unit_const_ptr wb::find_backup_leader ( unit const &  leader)

For a given leader on a keep, find another leader on another keep in the same castle.

Return values
nullptrif no such leader has been found

Definition at line 63 of file utility.cpp.

References unit::can_recruit(), unit_map::end(), resources::filter_con, resources::gameboard, unit::get_location(), unit::id(), and resources::units.

Referenced by wb::manager::allow_leader_to_move().

unit * wb::find_recruiter ( size_t  team_index,
map_location const &   
)
Returns
a leader from the specified team who can recruit on the specified hex
Return values
nullptrif no such leader has been found

Definition at line 78 of file utility.cpp.

References resources::filter_con, resources::gameboard, and resources::units.

Referenced by wb::recall::check_validity(), wb::recruit::check_validity(), and wb::manager::save_recruit().

void wb::for_each_action ( std::function< void(action *)>  function,
team_filter  team_filter = team_has_visible_plan 
)

Apply a function to all the actions of the whiteboard.

The actions are processed chronologically. The second parameter is a team_filter, it is called for each team, if it returns false, the actions of this team won't be processed.

Parameters
functionthe function to execute.
team_filterselect whether a team is visited (default to team_has_visible_plan).

Definition at line 168 of file utility.cpp.

References wb::side_actions::num_turns(), resources::teams, wb::side_actions::turn_begin(), and wb::side_actions::turn_end().

Referenced by wb::manager::draw_hex(), and wb::manager::pre_draw().

unit * wb::future_visible_unit ( map_location  hex,
int  viewer_side = wb::viewer_side() 
)

Applies the future unit map and.

Returns
a pointer to the unit at hex
Return values
nullptrif none is visible to the specified viewer side

Definition at line 91 of file utility.cpp.

References schema_validation::at(), ERR_WB, resources::gameboard, game_board::get_visible_unit(), resources::teams, and resources::whiteboard.

Referenced by wb::manager::contextual_delete(), wb::manager::contextual_execute(), wb::manager::create_temp_move(), future_visible_unit(), wb::manager::save_temp_attack(), and wb::manager::save_temp_move().

unit * wb::future_visible_unit ( int  on_side,
map_location  hex,
int  viewer_side = wb::viewer_side() 
)

Applies the future unit map and.

Returns
a pointer to the unit at hex
Return values
nullptrif none is visible to the specified viewer side
Parameters
on_sideOnly search for units of this side.

Definition at line 103 of file utility.cpp.

References future_visible_unit(), and unit::side().

void wb::ghost_owner_unit ( unit unit)
bool wb::has_actions ( )

Return whether the whiteboard has actions.

Definition at line 153 of file utility.cpp.

References resources::teams.

Referenced by wb::mapbuilder::build_map(), and wb::manager::has_actions().

static void wb::hide_all_plans ( )
static

Definition at line 344 of file manager.cpp.

References resources::teams.

Referenced by wb::manager::on_change_controller(), and wb::manager::update_plan_hiding().

std::ostream & wb::operator<< ( std::ostream &  s,
action_ptr  action 
)

Definition at line 33 of file action.cpp.

std::ostream & wb::operator<< ( std::ostream &  s,
attack_ptr  attack 
)

Dumps an attack on a stream, for debug purposes.

Definition at line 36 of file attack.cpp.

std::ostream & wb::operator<< ( std::ostream &  s,
action_const_ptr  action 
)

Definition at line 39 of file action.cpp.

std::ostream & wb::operator<< ( std::ostream &  s,
recruit_ptr  recruit 
)

Definition at line 39 of file recruit.cpp.

std::ostream & wb::operator<< ( std::ostream &  s,
suppose_dead_ptr  sup_d 
)

Dumps a suppose_dead on a stream, for debug purposes.

Definition at line 41 of file suppose_dead.cpp.

std::ostream & wb::operator<< ( std::ostream &  s,
attack_const_ptr  attack 
)

Definition at line 42 of file attack.cpp.

std::ostream & wb::operator<< ( std::ostream &  s,
recall_ptr  recall 
)

Definition at line 42 of file recall.cpp.

std::ostream & wb::operator<< ( std::ostream &  s,
recruit_const_ptr  recruit 
)

Definition at line 44 of file recruit.cpp.

std::ostream & wb::operator<< ( std::ostream &  s,
move_ptr  move 
)

Dumps an move on a stream, for debug purposes.

Definition at line 44 of file move.cpp.

std::ostream & wb::operator<< ( std::ostream &  s,
recall_const_ptr  recall 
)

Definition at line 47 of file recall.cpp.

std::ostream & wb::operator<< ( std::ostream &  s,
suppose_dead_const_ptr  sup_d 
)

Definition at line 47 of file suppose_dead.cpp.

std::ostream & wb::operator<< ( std::ostream &  out,
wb::side_actions const &  side_actions 
)
std::ostream & wb::operator<< ( std::ostream &  s,
move_const_ptr  move 
)

Definition at line 50 of file move.cpp.

int wb::path_cost ( std::vector< map_location > const &  path,
unit const &  u 
)
bool wb::team_has_visible_plan ( team )

Returns whether a given team's plan is visible.

Definition at line 163 of file utility.cpp.

References team::get_side_actions().

Referenced by wb::mapbuilder::build_map().

void wb::unghost_owner_unit ( unit unit)
side_actions_ptr wb::viewer_actions ( )
int wb::viewer_side ( )
size_t wb::viewer_team ( )
Returns
The current viewing team's index

Definition at line 39 of file utility.cpp.

References resources::screen, and display::viewing_team().

Referenced by wb::move::check_validity(), wb::mapbuilder::pre_build(), and wb::manager::update_plan_hiding().