The Battle for Wesnoth  1.15.11+dev
Public Member Functions | Private Member Functions | Private Attributes | List of all members
team_builder Class Reference

#include <teambuilder.hpp>

Public Member Functions

 team_builder (const config &side_cfg, team &to_build, const config &level, game_board &board, int num)
 
 team_builder (const team_builder &)=delete
 Very important! Delete copy constructor and declare a move constructor. More...
 
 team_builder (team_builder &&)=default
 
void build_team_stage_one ()
 Handles the first stage of team initialization (everything except unit placement). More...
 
void build_team_stage_two ()
 Handles the second stage of team initialization (unit placement). More...
 

Private Member Functions

void log_step (const char *s) const
 
void init ()
 
void gold ()
 
void new_team ()
 
void objectives ()
 
void previous_recruits ()
 
void handle_unit (const config &u, const char *origin)
 
void handle_leader (const config &leader)
 
void leader ()
 
void prepare_units ()
 
void place_units ()
 

Private Attributes

int gold_info_ngold_
 
std::deque< configleader_configs_
 
const configlevel_
 
game_boardboard_
 
bool player_exists_
 
std::set< std::string > seen_ids_
 
int side_
 
const configside_cfg_
 
teamteam_
 
std::vector< const config * > unit_configs_
 

Detailed Description

Definition at line 28 of file teambuilder.hpp.

Constructor & Destructor Documentation

◆ team_builder() [1/3]

team_builder::team_builder ( const config side_cfg,
team to_build,
const config level,
game_board board,
int  num 
)

Definition at line 37 of file teambuilder.cpp.

◆ team_builder() [2/3]

team_builder::team_builder ( const team_builder )
delete

Very important! Delete copy constructor and declare a move constructor.

unit_configs_ may hold a pointer to a config object stored in leader_configs_. In that case, if a copy happens (such as when doing in-place construction that requires the vector be resized), these pointers will become invalid and lead to a crash.

◆ team_builder() [3/3]

team_builder::team_builder ( team_builder &&  )
default

Member Function Documentation

◆ build_team_stage_one()

void team_builder::build_team_stage_one ( )

Handles the first stage of team initialization (everything except unit placement).

Definition at line 51 of file teambuilder.cpp.

References gold(), init(), leader(), new_team(), objectives(), prepare_units(), and previous_recruits().

◆ build_team_stage_two()

void team_builder::build_team_stage_two ( )

Handles the second stage of team initialization (unit placement).

Definition at line 75 of file teambuilder.cpp.

References place_units().

◆ gold()

void team_builder::gold ( )
private

Definition at line 108 of file teambuilder.cpp.

References DBG_NG_TC, gold_info_ngold_, log_step(), and side_cfg_.

Referenced by build_team_stage_one().

◆ handle_leader()

void team_builder::handle_leader ( const config leader)
private

◆ handle_unit()

void team_builder::handle_unit ( const config u,
const char *  origin 
)
private

◆ init()

void team_builder::init ( )
private

◆ leader()

void team_builder::leader ( )
private

Definition at line 215 of file teambuilder.cpp.

References config::child_range(), handle_leader(), log_step(), and side_cfg_.

Referenced by build_team_stage_one().

◆ log_step()

void team_builder::log_step ( const char *  s) const
private

Definition at line 82 of file teambuilder.cpp.

References LOG_NG_TC, and side_.

Referenced by gold(), init(), leader(), new_team(), objectives(), place_units(), and previous_recruits().

◆ new_team()

void team_builder::new_team ( )
private

◆ objectives()

void team_builder::objectives ( )
private

◆ place_units()

void team_builder::place_units ( )
private

◆ prepare_units()

void team_builder::prepare_units ( )
private

Definition at line 233 of file teambuilder.cpp.

References config::child_range(), handle_unit(), and side_cfg_.

Referenced by build_team_stage_one().

◆ previous_recruits()

void team_builder::previous_recruits ( )
private

Member Data Documentation

◆ board_

game_board& team_builder::board_
private

Definition at line 54 of file teambuilder.hpp.

Referenced by init(), new_team(), and place_units().

◆ gold_info_ngold_

int team_builder::gold_info_ngold_
private

Definition at line 50 of file teambuilder.hpp.

Referenced by gold(), and new_team().

◆ leader_configs_

std::deque<config> team_builder::leader_configs_
private

Definition at line 51 of file teambuilder.hpp.

Referenced by handle_leader().

◆ level_

const config& team_builder::level_
private

Definition at line 53 of file teambuilder.hpp.

Referenced by objectives().

◆ player_exists_

bool team_builder::player_exists_
private

Definition at line 56 of file teambuilder.hpp.

Referenced by init().

◆ seen_ids_

std::set<std::string> team_builder::seen_ids_
private

Definition at line 57 of file teambuilder.hpp.

Referenced by handle_unit(), and init().

◆ side_

int team_builder::side_
private

Definition at line 58 of file teambuilder.hpp.

Referenced by handle_unit(), init(), log_step(), and place_units().

◆ side_cfg_

const config& team_builder::side_cfg_
private

Definition at line 59 of file teambuilder.hpp.

Referenced by gold(), handle_unit(), init(), leader(), new_team(), prepare_units(), and previous_recruits().

◆ team_

team& team_builder::team_
private

Definition at line 60 of file teambuilder.hpp.

Referenced by handle_unit(), new_team(), objectives(), place_units(), and previous_recruits().

◆ unit_configs_

std::vector<const config*> team_builder::unit_configs_
private

Definition at line 61 of file teambuilder.hpp.

Referenced by handle_unit(), init(), and place_units().


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