Public Member Functions | Private Member Functions | Private Attributes | Friends

wb::mapbuilder Class Reference

Visitor that collects and applies unit_map modifications from the actions it visits and reverts all changes on destruction. More...

#include <mapbuilder.hpp>

Inheritance diagram for wb::mapbuilder:
Inheritance graph
[legend]
Collaboration diagram for wb::mapbuilder:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 mapbuilder (unit_map &unit_map)
virtual ~mapbuilder ()
void build_map ()
 builds every team's actions as far into the future as possible, in the correct order

Private Member Functions

bool process (size_t team_index, team &, side_actions &, side_actions::iterator)
bool pre_visit_team (size_t turn, size_t team_index, team &, side_actions &)
 visit():
bool post_visit_team (size_t turn, size_t team_index, team &, side_actions &)
bool process_helper (side_actions::iterator const &, action_ptr const &)
virtual void validate (side_actions::iterator const &)
void pre_build ()
void restore_normal_map ()

Private Attributes

unit_mapunit_map_
action_queue applied_actions_
action_queue applied_actions_this_turn_
boost::ptr_vector
< unit_movement_resetter
resetters_
boost::ptr_vector
< temporary_unit_remover
removers_
std::set< unit const * > acted_this_turn_

Friends

class enable_visit_all< mapbuilder >

Detailed Description

Visitor that collects and applies unit_map modifications from the actions it visits and reverts all changes on destruction.

Definition at line 37 of file mapbuilder.hpp.


Constructor & Destructor Documentation

wb::mapbuilder::mapbuilder ( unit_map unit_map  ) 

Definition at line 36 of file mapbuilder.cpp.

wb::mapbuilder::~mapbuilder (  )  [virtual]

Definition at line 46 of file mapbuilder.cpp.

References restore_normal_map().

Here is the call graph for this function:


Member Function Documentation

void wb::mapbuilder::build_map (  ) 

builds every team's actions as far into the future as possible, in the correct order

Definition at line 86 of file mapbuilder.cpp.

References wb::has_actions(), pre_build(), and wb::enable_visit_all< mapbuilder >::visit_all().

Referenced by wb::validate_visitor::validate_actions().

Here is the call graph for this function:

Here is the caller graph for this function:

bool wb::mapbuilder::post_visit_team ( size_t  ,
size_t  ,
team ,
side_actions  
) [private]
Returns:
Whether or not to visit any more teams after this one.

Reimplemented from wb::enable_visit_all< mapbuilder >.

Definition at line 142 of file mapbuilder.cpp.

References acted_this_turn_, and applied_actions_this_turn_.

void wb::mapbuilder::pre_build (  )  [private]

Definition at line 52 of file mapbuilder.cpp.

References acted_this_turn_, resources::controller, play_controller::current_side(), unit::get_location(), team::get_side_actions(), unit::is_visible_to_team(), removers_, resetters_, unit::side(), resources::teams, resources::units, and wb::viewer_team().

Referenced by build_map().

Here is the call graph for this function:

Here is the caller graph for this function:

bool wb::mapbuilder::pre_visit_team ( size_t  ,
size_t  ,
team ,
side_actions sa 
) [private]

visit():

Returns:
Whether or not to continue any visitation after this action. The fcn is commented out because derived classes are required to implement it.
Whether or not to visit any of the contents of sa.

Reimplemented from wb::enable_visit_all< mapbuilder >.

Definition at line 137 of file mapbuilder.cpp.

References wb::side_actions::hidden().

Here is the call graph for this function:

bool wb::mapbuilder::process ( size_t  team_index,
team ,
side_actions ,
side_actions::iterator  action_it 
) [private]

Definition at line 109 of file mapbuilder.cpp.

References acted_this_turn_, unit::movement_left(), process_helper(), unit::set_movement(), and unit::total_movement().

Here is the call graph for this function:

bool wb::mapbuilder::process_helper ( side_actions::iterator const &  itor,
action_ptr const &  act 
) [private]
Returns:
whether act is valid

Definition at line 95 of file mapbuilder.cpp.

References applied_actions_, applied_actions_this_turn_, unit_map_, and validate().

Referenced by process().

Here is the call graph for this function:

Here is the caller graph for this function:

void wb::mapbuilder::restore_normal_map (  )  [private]

Definition at line 168 of file mapbuilder.cpp.

References applied_actions_, and unit_map_.

Referenced by ~mapbuilder().

Here is the caller graph for this function:

virtual void wb::mapbuilder::validate ( side_actions::iterator const &   )  [inline, private, virtual]

Reimplemented in wb::validate_visitor::helper.

Definition at line 58 of file mapbuilder.hpp.

Referenced by process_helper().

Here is the caller graph for this function:


Friends And Related Function Documentation

friend class enable_visit_all< mapbuilder > [friend]

Definition at line 40 of file mapbuilder.hpp.


Member Data Documentation

std::set<unit const*> wb::mapbuilder::acted_this_turn_ [private]

Definition at line 75 of file mapbuilder.hpp.

Referenced by post_visit_team(), pre_build(), and process().

Definition at line 67 of file mapbuilder.hpp.

Referenced by process_helper(), and restore_normal_map().

Definition at line 68 of file mapbuilder.hpp.

Referenced by post_visit_team(), and process_helper().

boost::ptr_vector<temporary_unit_remover> wb::mapbuilder::removers_ [private]

Definition at line 72 of file mapbuilder.hpp.

Referenced by pre_build().

boost::ptr_vector<unit_movement_resetter> wb::mapbuilder::resetters_ [private]

Definition at line 71 of file mapbuilder.hpp.

Referenced by pre_build().

Definition at line 65 of file mapbuilder.hpp.

Referenced by process_helper(), and restore_normal_map().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated by doxygen 1.7.1 on Thu May 24 2012 01:26:31 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs