The Battle for Wesnoth  1.19.7+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_
 
std::vector< std::unique_ptr< unit_movement_resetter > > resetters_
 
std::vector< std::unique_ptr< 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 38 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(), post_visit_team(), pre_build(), process(), and wb::team_has_visible_plan().

◆ post_visit_team()

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

◆ 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, display::get_singleton(), removers_, resetters_, t, and display::viewing_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_, utils::reversed_view(), 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 72 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 64 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 65 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 73 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_

std::vector<std::unique_ptr<temporary_unit_remover> > wb::mapbuilder::removers_
private

Definition at line 69 of file mapbuilder.hpp.

Referenced by pre_build().

◆ resetters_

std::vector<std::unique_ptr<unit_movement_resetter> > wb::mapbuilder::resetters_
private

Definition at line 68 of file mapbuilder.hpp.

Referenced by pre_build().

◆ unit_map_

unit_map& wb::mapbuilder::unit_map_
private

Definition at line 62 of file mapbuilder.hpp.

Referenced by process(), and restore_normal_map().


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