The Battle for Wesnoth  1.15.1+dev
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, bool is_local_side)
 Function called on each action. More...
 
void post_visit_team (std::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_resetterresetters_
 
boost::ptr_vector< temporary_unit_removerremovers_
 
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 39 of file mapbuilder.hpp.

Constructor & Destructor Documentation

◆ mapbuilder()

wb::mapbuilder::mapbuilder ( unit_map unit_map)

Definition at line 37 of file mapbuilder.cpp.

◆ ~mapbuilder()

wb::mapbuilder::~mapbuilder ( )
virtual

Definition at line 49 of file mapbuilder.cpp.

References restore_normal_map().

Member Function Documentation

◆ build_map()

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 resources::gameboard, wb::has_actions(), next, wb::side_actions::num_turns(), post_visit_team(), pre_build(), process(), wb::team_has_visible_plan(), wb::side_actions::turn_begin(), and wb::side_actions::turn_end().

◆ post_visit_team()

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

Function called after visiting a team.

Definition at line 177 of file mapbuilder.cpp.

References acted_this_turn_, applied_actions_this_turn_, reverse(), and wb::move::set_turn_number().

Referenced by build_map().

◆ pre_build()

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_, t, game_board::teams(), and wb::viewer_team().

Referenced by build_map().

◆ process()

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

◆ restore_normal_map()

void wb::mapbuilder::restore_normal_map ( )
private

Definition at line 200 of file mapbuilder.cpp.

References applied_actions_, reverse(), and unit_map_.

Referenced by ~mapbuilder().

Member Data Documentation

◆ acted_this_turn_

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

Definition at line 73 of file mapbuilder.hpp.

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

◆ applied_actions_

action_queue wb::mapbuilder::applied_actions_
private

Definition at line 65 of file mapbuilder.hpp.

Referenced by process(), and restore_normal_map().

◆ applied_actions_this_turn_

action_queue wb::mapbuilder::applied_actions_this_turn_
private

Definition at line 66 of file mapbuilder.hpp.

Referenced by post_visit_team(), and process().

◆ has_invalid_actions_

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

Definition at line 74 of file mapbuilder.hpp.

Referenced by process().

◆ invalid_actions_

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

Conserved invalid actions.

Definition at line 75 of file mapbuilder.hpp.

Referenced by process().

◆ removers_

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

Definition at line 70 of file mapbuilder.hpp.

Referenced by pre_build().

◆ resetters_

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

Definition at line 69 of file mapbuilder.hpp.

Referenced by pre_build().

◆ unit_map_

unit_map& wb::mapbuilder::unit_map_
private

Definition at line 63 of file mapbuilder.hpp.

Referenced by process(), and restore_normal_map().


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