team Class Reference

#include <team.hpp>

Inheritance diagram for team:

Inheritance graph
[legend]
Collaboration diagram for team:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 team (const config &cfg, int gold=default_team_gold)
 ~team ()
void write (config &cfg) const
bool get_village (const gamemap::location &)
void lose_village (const gamemap::location &)
void clear_villages ()
const std::set
< gamemap::location > & 
villages () const
bool owns_village (const gamemap::location &loc) const
int gold () const
std::string start_gold () const
int base_income () const
int village_gold () const
void set_village_gold (int income)
int income () const
void new_turn ()
void set_time_of_day (int turn, const struct time_of_day &tod)
void get_shared_maps ()
void spend_gold (const int amount)
void set_income (const int amount)
int countdown_time () const
void set_countdown_time (const int amount)
int action_bonus_count () const
void set_action_bonus_count (const int count)
void set_current_player (const std::string player)
const std::set< std::string > & recruits () const
std::set< std::string > & recruits ()
const std::vector< std::string > & recruitment_pattern () const
const std::string & name () const
const std::string & save_id () const
const std::string & current_player () const
void set_objectives (const t_string &new_objectives, bool silently=false)
void reset_objectives_changed ()
const t_stringobjectives () const
bool objectives_changed () const
bool is_enemy (int n) const
bool has_seen (unsigned int index) const
void see (unsigned int index)
double aggression () const
double caution () const
team_info::CONTROLLER controller () const
bool is_human () const
bool is_network () const
bool is_ai () const
bool is_empty () const
bool is_persistent () const
void make_human ()
void make_network ()
void make_ai ()
void change_controller (team_info::CONTROLLER controller)
void change_controller (const std::string &controller)
const std::string & team_name () const
const std::string & user_team_name () const
void change_team (const std::string &name, const std::string &user_name)
const std::string & flag () const
const std::string & flag_icon () const
const std::string & ai_algorithm () const
const configai_parameters () const
const configai_memory () const
void set_ai_memory (const config &ai_mem)
void set_ai_parameters (const config::child_list &ai_parameters)
double leader_value () const
void set_leader_value (double value)
double village_value () const
void set_village_value (double value)
int villages_per_scout () const
std::vector< target > & targets ()
bool shrouded (const gamemap::location &loc) const
bool fogged (const gamemap::location &loc) const
bool uses_shroud () const
bool uses_fog () const
bool fog_or_shroud () const
bool clear_shroud (const gamemap::location &loc)
void place_shroud (const gamemap::location &loc)
bool clear_fog (const gamemap::location &loc)
void refog ()
void set_shroud (bool shroud)
void set_fog (bool fog)
void merge_shroud_map_data (const std::string &shroud_data)
 Merge a WML shroud map with the shroud data of this player.
bool knows_about_team (size_t index) const
bool copy_ally_shroud ()
bool auto_shroud_updates () const
void set_auto_shroud_updates (bool value)
bool get_disallow_observers ()
std::string map_colour_to () const
bool & no_leader ()
void log_recruitable ()

Static Public Member Functions

static int nteams ()
static const color_range get_side_color_range (int side)
static Uint32 get_side_rgb (int side)
static Uint32 get_side_rgb_max (int side)
static Uint32 get_side_rgb_min (int side)
static const SDL_Color get_minimap_colour (int side)
static std::string get_side_colour_index (int side)
static std::string get_side_highlight (int side)

Static Public Attributes

static std::map< int, color_rangeteam_color_range_
static const int default_team_gold = 100

Private Member Functions

bool share_maps () const
bool share_view () const
const std::vector< const
shroud_map * > & 
ally_shroud (const std::vector< team > &teams) const
const std::vector< const
shroud_map * > & 
ally_fog (const std::vector< team > &teams) const
bool calculate_enemies (size_t index) const
bool calculate_is_enemy (size_t index) const

Private Attributes

int gold_
std::set< gamemap::locationvillages_
shroud_map shroud_
shroud_map fog_
bool auto_shroud_updates_
team_info info_
int countdown_time_
int action_bonus_count_
config aiparams_
double aggression_
double caution_
std::vector< bool > enemies_
std::vector< bool > seen_
std::vector< const shroud_map * > ally_shroud_
std::vector< const shroud_map * > ally_fog_

Classes

class  shroud_map
struct  target
struct  team_info


Detailed Description

Definition at line 32 of file team.hpp.


Constructor & Destructor Documentation

team::team ( const config cfg,
int  gold = default_team_gold 
)

team::~team (  )  [inline]

Definition at line 126 of file team.hpp.


Member Function Documentation

void team::write ( config cfg  )  const

bool team::get_village ( const gamemap::location loc  ) 

Definition at line 421 of file team.cpp.

References game_events::fire(), and villages_.

void team::lose_village ( const gamemap::location loc  ) 

Definition at line 427 of file team.cpp.

References owns_village(), and villages_.

void team::clear_villages (  )  [inline]

Definition at line 132 of file team.hpp.

References villages_.

const std::set<gamemap::location>& team::villages (  )  const [inline]

bool team::owns_village ( const gamemap::location loc  )  const [inline]

int team::gold (  )  const [inline]

std::string team::start_gold (  )  const [inline]

Definition at line 138 of file team.hpp.

References info_, and team::team_info::start_gold.

int team::base_income (  )  const [inline]

Definition at line 139 of file team.hpp.

References game_config::base_income, team::team_info::income, and info_.

int team::village_gold (  )  const [inline]

Definition at line 141 of file team.hpp.

References team::team_info::income_per_village, and info_.

void team::set_village_gold ( int  income  )  [inline]

Definition at line 142 of file team.hpp.

References team::team_info::income_per_village, and info_.

int team::income (  )  const [inline]

void team::new_turn (  )  [inline]

Definition at line 145 of file team.hpp.

References gold_, and income().

Referenced by play_controller::init_side().

void team::set_time_of_day ( int  turn,
const struct time_of_day tod 
)

void team::get_shared_maps (  ) 

void team::spend_gold ( const int  amount  )  [inline]

void team::set_income ( const int  amount  )  [inline]

Definition at line 149 of file team.hpp.

References team::team_info::income, info_, and lexical_cast().

int team::countdown_time (  )  const [inline]

void team::set_countdown_time ( const int  amount  )  [inline]

Definition at line 152 of file team.hpp.

References countdown_time_.

Referenced by playmp_controller::after_human_turn(), and playmp_controller::play_human_turn().

int team::action_bonus_count (  )  const [inline]

void team::set_action_bonus_count ( const int  count  )  [inline]

void team::set_current_player ( const std::string  player  )  [inline]

Definition at line 156 of file team.hpp.

References team::team_info::current_player, and info_.

const std::set<std::string>& team::recruits (  )  const [inline]

std::set<std::string>& team::recruits (  )  [inline]

Definition at line 161 of file team.hpp.

References team::team_info::can_recruit, and info_.

const std::vector<std::string>& team::recruitment_pattern (  )  const [inline]

Definition at line 162 of file team.hpp.

References info_, and team::team_info::recruitment_pattern.

Referenced by ai::do_recruitment().

const std::string& team::name (  )  const [inline]

Definition at line 164 of file team.hpp.

References info_, and team::team_info::name.

const std::string& team::save_id (  )  const [inline]

Definition at line 166 of file team.hpp.

References info_, and team::team_info::save_id.

Referenced by do_replay_handle().

const std::string& team::current_player (  )  const [inline]

Definition at line 167 of file team.hpp.

References team::team_info::current_player, and info_.

void team::set_objectives ( const t_string new_objectives,
bool  silently = false 
)

Definition at line 544 of file team.cpp.

References info_, team::team_info::objectives, and team::team_info::objectives_changed.

void team::reset_objectives_changed (  )  [inline]

Definition at line 170 of file team.hpp.

References info_, and team::team_info::objectives_changed.

Referenced by play_controller::play_slice().

const t_string& team::objectives (  )  const [inline]

Definition at line 172 of file team.hpp.

References info_, and team::team_info::objectives.

bool team::objectives_changed (  )  const [inline]

Definition at line 173 of file team.hpp.

References info_, and team::team_info::objectives_changed.

bool team::is_enemy ( int  n  )  const [inline]

bool team::has_seen ( unsigned int  index  )  const [inline]

Definition at line 184 of file team.hpp.

References seen_, uses_fog(), and uses_shroud().

void team::see ( unsigned int  index  )  [inline]

Definition at line 192 of file team.hpp.

References seen_.

Referenced by move_unit().

double team::aggression (  )  const [inline]

Definition at line 199 of file team.hpp.

References aggression_.

Referenced by ai::do_combat().

double team::caution (  )  const [inline]

Definition at line 200 of file team.hpp.

References caution_.

Referenced by ai::attack_analysis::rating().

team_info::CONTROLLER team::controller (  )  const [inline]

Definition at line 202 of file team.hpp.

References team::team_info::controller, and info_.

bool team::is_human (  )  const [inline]

Definition at line 203 of file team.hpp.

References team::team_info::controller, team::team_info::HUMAN, and info_.

bool team::is_network (  )  const [inline]

Definition at line 204 of file team.hpp.

References team::team_info::controller, info_, and team::team_info::NETWORK.

bool team::is_ai (  )  const [inline]

Definition at line 205 of file team.hpp.

References team::team_info::AI, team::team_info::controller, and info_.

bool team::is_empty (  )  const [inline]

Definition at line 206 of file team.hpp.

References team::team_info::controller, team::team_info::EMPTY, and info_.

Referenced by playsingle_controller::play_turn().

bool team::is_persistent (  )  const [inline]

Definition at line 208 of file team.hpp.

References info_, and team::team_info::persistent.

void team::make_human (  )  [inline]

Definition at line 210 of file team.hpp.

References team::team_info::controller, team::team_info::HUMAN, and info_.

void team::make_network (  )  [inline]

Definition at line 211 of file team.hpp.

References team::team_info::controller, info_, and team::team_info::NETWORK.

void team::make_ai (  )  [inline]

Definition at line 212 of file team.hpp.

References team::team_info::AI, team::team_info::controller, and info_.

void team::change_controller ( team_info::CONTROLLER  controller  )  [inline]

Definition at line 215 of file team.hpp.

References team::team_info::controller, and info_.

void team::change_controller ( const std::string &  controller  ) 

const std::string& team::team_name (  )  const [inline]

Definition at line 218 of file team.hpp.

References info_, and team::team_info::team_name.

Referenced by map_labels::team_name().

const std::string& team::user_team_name (  )  const [inline]

Definition at line 219 of file team.hpp.

References info_, and team::team_info::user_team_name.

Referenced by calculate_team_data().

void team::change_team ( const std::string &  name,
const std::string &  user_name 
)

Definition at line 524 of file team.cpp.

References info_, team::team_info::team_name, teams, and team::team_info::user_team_name.

const std::string& team::flag (  )  const [inline]

Definition at line 223 of file team.hpp.

References team::team_info::flag, and info_.

const std::string& team::flag_icon (  )  const [inline]

Definition at line 224 of file team.hpp.

References team::team_info::flag_icon, and info_.

const std::string& team::ai_algorithm (  )  const [inline]

Definition at line 226 of file team.hpp.

References team::team_info::ai_algorithm, and info_.

const config& team::ai_parameters (  )  const [inline]

const config& team::ai_memory (  )  const [inline]

Definition at line 228 of file team.hpp.

References team::team_info::ai_memory_, and info_.

Referenced by dfool::dfool_ai::play_turn().

void team::set_ai_memory ( const config ai_mem  ) 

Definition at line 551 of file team.cpp.

References team::team_info::ai_memory_, and info_.

Referenced by dfool::dfool_ai::play_turn().

void team::set_ai_parameters ( const config::child_list ai_parameters  ) 

Definition at line 558 of file team.cpp.

References team::team_info::ai_params, and info_.

double team::leader_value (  )  const [inline]

Definition at line 232 of file team.hpp.

References info_, and team::team_info::leader_value.

void team::set_leader_value ( double  value  )  [inline]

Definition at line 233 of file team.hpp.

References info_, and team::team_info::leader_value.

double team::village_value (  )  const [inline]

Definition at line 234 of file team.hpp.

References info_, and team::team_info::village_value.

void team::set_village_value ( double  value  )  [inline]

Definition at line 235 of file team.hpp.

References info_, and team::team_info::village_value.

int team::villages_per_scout (  )  const [inline]

Definition at line 237 of file team.hpp.

References info_, and team::team_info::villages_per_scout.

Referenced by ai::do_recruitment().

std::vector<target>& team::targets (  )  [inline]

Definition at line 239 of file team.hpp.

References info_, and team::team_info::targets.

Referenced by ai::find_targets().

bool team::shrouded ( const gamemap::location loc  )  const [virtual]

bool team::fogged ( const gamemap::location loc  )  const [virtual]

bool team::uses_shroud (  )  const [inline]

bool team::uses_fog (  )  const [inline]

bool team::fog_or_shroud (  )  const [inline]

Definition at line 248 of file team.hpp.

References uses_fog(), and uses_shroud().

bool team::clear_shroud ( const gamemap::location loc  )  [inline]

Definition at line 249 of file team.hpp.

References team::shroud_map::clear(), shroud_, gamemap::location::x, and gamemap::location::y.

Referenced by clear_shroud_loc().

void team::place_shroud ( const gamemap::location loc  )  [inline]

bool team::clear_fog ( const gamemap::location loc  )  [inline]

Definition at line 251 of file team.hpp.

References team::shroud_map::clear(), fog_, gamemap::location::x, and gamemap::location::y.

Referenced by clear_shroud_loc().

void team::refog (  )  [inline]

Definition at line 252 of file team.hpp.

References fog_, and team::shroud_map::reset().

void team::set_shroud ( bool  shroud  )  [inline]

Definition at line 253 of file team.hpp.

References team::shroud_map::set_enabled(), and shroud_.

void team::set_fog ( bool  fog  )  [inline]

Definition at line 254 of file team.hpp.

References fog_, and team::shroud_map::set_enabled().

void team::merge_shroud_map_data ( const std::string &  shroud_data  ) 

Merge a WML shroud map with the shroud data of this player.

Definition at line 355 of file team.cpp.

References team::shroud_map::merge(), and shroud_.

bool team::knows_about_team ( size_t  index  )  const

bool team::copy_ally_shroud (  ) 

Definition at line 636 of file team.cpp.

References ally_shroud(), team::shroud_map::copy_from(), share_maps(), shroud_, and teams.

bool team::auto_shroud_updates (  )  const [inline]

void team::set_auto_shroud_updates ( bool  value  )  [inline]

Definition at line 263 of file team.hpp.

References auto_shroud_updates_.

bool team::get_disallow_observers (  )  [inline]

Definition at line 264 of file team.hpp.

References team::team_info::disallow_observers, and info_.

Referenced by play_controller::init_side().

std::string team::map_colour_to (  )  const [inline]

Definition at line 265 of file team.hpp.

References team::team_info::colour, and info_.

bool& team::no_leader (  )  [inline]

Definition at line 266 of file team.hpp.

References info_, and team::team_info::no_leader.

int team::nteams (  )  [static]

Definition at line 644 of file team.cpp.

References teams.

Referenced by events::menu_handler::change_unit_side(), and dfool::dfool_ai::play_turn().

const color_range team::get_side_color_range ( int  side  )  [static]

static Uint32 team::get_side_rgb ( int  side  )  [inline, static]

Definition at line 272 of file team.hpp.

References get_side_color_range().

Referenced by events::menu_handler::label_terrain(), and unit::team_rgb().

static Uint32 team::get_side_rgb_max ( int  side  )  [inline, static]

Definition at line 273 of file team.hpp.

References get_side_color_range().

static Uint32 team::get_side_rgb_min ( int  side  )  [inline, static]

Definition at line 274 of file team.hpp.

References get_side_color_range().

const SDL_Color team::get_minimap_colour ( int  side  )  [static]

Definition at line 830 of file team.cpp.

References get_side_color_range(), and int_to_color().

Referenced by game_display::draw_minimap_units().

std::string team::get_side_colour_index ( int  side  )  [static]

std::string team::get_side_highlight ( int  side  )  [static]

void team::log_recruitable (  ) 

Definition at line 857 of file team.cpp.

References team::team_info::can_recruit, info_, and LOG_NG.

bool team::share_maps (  )  const [inline, private]

Definition at line 283 of file team.hpp.

References info_, and team::team_info::share_maps.

Referenced by copy_ally_shroud(), and knows_about_team().

bool team::share_view (  )  const [inline, private]

Definition at line 284 of file team.hpp.

References info_, and team::team_info::share_view.

Referenced by ally_fog(), ally_shroud(), and knows_about_team().

const std::vector< const team::shroud_map * > & team::ally_shroud ( const std::vector< team > &  teams  )  const [private]

Definition at line 585 of file team.cpp.

References ally_shroud_, is_enemy(), share_view(), and shroud_.

Referenced by copy_ally_shroud(), and shrouded().

const std::vector< const team::shroud_map * > & team::ally_fog ( const std::vector< team > &  teams  )  const [private]

Definition at line 598 of file team.cpp.

References ally_fog_, fog_, is_enemy(), and share_view().

Referenced by fogged().

bool team::calculate_enemies ( size_t  index  )  const [private]

Definition at line 476 of file team.cpp.

References calculate_is_enemy(), enemies_, and teams.

Referenced by is_enemy().

bool team::calculate_is_enemy ( size_t  index  )  const [private]

Definition at line 489 of file team.cpp.

References team::team_info::enemies, info_, team::team_info::team_name, and teams.

Referenced by calculate_enemies().


Member Data Documentation

Definition at line 122 of file team.hpp.

Referenced by team::team_info::team_info().

const int team::default_team_gold = 100 [static]

Definition at line 123 of file team.hpp.

Referenced by team::team_info::team_info().

int team::gold_ [private]

Definition at line 289 of file team.hpp.

Referenced by gold(), new_turn(), spend_gold(), team(), and write().

std::set<gamemap::location> team::villages_ [private]

Definition at line 292 of file team.hpp.

Referenced by ally_fog(), clear_fog(), fogged(), refog(), set_fog(), team(), and uses_fog().

Definition at line 294 of file team.hpp.

Referenced by auto_shroud_updates(), and set_auto_shroud_updates().

int team::countdown_time_ [private]

Definition at line 298 of file team.hpp.

Referenced by countdown_time(), set_countdown_time(), team(), and write().

Definition at line 299 of file team.hpp.

Referenced by action_bonus_count(), set_action_bonus_count(), team(), and write().

Definition at line 301 of file team.hpp.

Referenced by ai_parameters().

double team::aggression_ [private]

Definition at line 304 of file team.hpp.

Referenced by aggression().

double team::caution_ [private]

Definition at line 304 of file team.hpp.

Referenced by caution().

std::vector<bool> team::enemies_ [mutable, private]

Definition at line 308 of file team.hpp.

Referenced by calculate_enemies(), and is_enemy().

std::vector<bool> team::seen_ [mutable, private]

Definition at line 310 of file team.hpp.

Referenced by has_seen(), and see().

std::vector<const shroud_map*> team::ally_shroud_ [mutable, private]

Definition at line 312 of file team.hpp.

Referenced by ally_shroud().

std::vector<const shroud_map*> team::ally_fog_ [mutable, private]

Definition at line 312 of file team.hpp.

Referenced by ally_fog().


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

Generated by doxygen 1.5.5 on 23 May 2008 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs