The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
wb::mapbuilder Class Reference

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

#include <mapbuilder.hpp>

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. More...
 

Private Member Functions

void process (side_actions &sa, side_actions::iterator action_it)
 Function called on each action. More...
 
void post_visit_team (size_t turn)
 Function called after visiting a team. More...
 
void pre_build ()
 Does various preliminary actions on the unit map such as resetting moves for some units. More...
 
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_
 
std::set< unit const * > has_invalid_actions_
 
std::list< side_actions::iteratorinvalid_actions_
 Conserved invalid actions. More...
 

Detailed Description

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

Definition at line 40 of file mapbuilder.hpp.

Constructor & Destructor Documentation

wb::mapbuilder::mapbuilder ( unit_map unit_map)

Definition at line 37 of file mapbuilder.cpp.

wb::mapbuilder::~mapbuilder ( )
virtual

Definition at line 49 of file mapbuilder.cpp.

References restore_normal_map().

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 89 of file mapbuilder.cpp.

References wb::has_actions(), next, wb::side_actions::num_turns(), post_visit_team(), pre_build(), process(), wb::team_has_visible_plan(), resources::teams, wb::side_actions::turn_begin(), and wb::side_actions::turn_end().

void wb::mapbuilder::post_visit_team ( size_t  turn)
private

Function called after visiting a team.

Definition at line 174 of file mapbuilder.cpp.

References acted_this_turn_, and applied_actions_this_turn_.

Referenced by build_map().

void wb::mapbuilder::pre_build ( )
private

Does various preliminary actions on the unit map such as resetting moves for some units.

Definition at line 57 of file mapbuilder.cpp.

References acted_this_turn_, resources::controller, play_controller::current_side(), resources::gameboard, removers_, resetters_, resources::teams, resources::units, and wb::viewer_team().

Referenced by build_map().

void wb::mapbuilder::process ( side_actions sa,
side_actions::iterator  action_it 
)
private
void wb::mapbuilder::restore_normal_map ( )
private

Definition at line 197 of file mapbuilder.cpp.

References applied_actions_, and unit_map_.

Referenced by ~mapbuilder().

Member Data Documentation

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

Definition at line 74 of file mapbuilder.hpp.

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

action_queue wb::mapbuilder::applied_actions_
private

Definition at line 66 of file mapbuilder.hpp.

Referenced by process(), and restore_normal_map().

action_queue wb::mapbuilder::applied_actions_this_turn_
private

Definition at line 67 of file mapbuilder.hpp.

Referenced by post_visit_team(), and process().

std::set<unit const*> wb::mapbuilder::has_invalid_actions_
private

Definition at line 75 of file mapbuilder.hpp.

Referenced by process().

std::list<side_actions::iterator> wb::mapbuilder::invalid_actions_
private

Conserved invalid actions.

Definition at line 76 of file mapbuilder.hpp.

Referenced by process().

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

Definition at line 71 of file mapbuilder.hpp.

Referenced by pre_build().

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

Definition at line 70 of file mapbuilder.hpp.

Referenced by pre_build().

unit_map& wb::mapbuilder::unit_map_
private

Definition at line 64 of file mapbuilder.hpp.

Referenced by process(), and restore_normal_map().


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