The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
team.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2003 - 2016 by David White <[email protected]>
3  Part of the Battle for Wesnoth Project http://www.wesnoth.org/
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY.
11 
12  See the COPYING file for more details.
13 */
14 #ifndef TEAM_H_INCLUDED
15 #define TEAM_H_INCLUDED
16 
17 #include "color_range.hpp"
18 #include "game_config.hpp"
19 #include "utils/make_enum.hpp"
20 #include "map/location.hpp"
21 #include "recall_list_manager.hpp"
22 #include "units/ptr.hpp"
23 #include "util.hpp"
24 #include "config.hpp"
25 
26 #include <boost/shared_ptr.hpp>
27 #include <boost/container/flat_set.hpp>
28 
29 class game_data;
30 class gamemap;
31 #if defined(_MSC_VER) && _MSC_VER <= 1600
32 /*
33  This is needed because msvc up to 2010 fails to correcty forward declare this struct as a return value this case.
34  And will create corrupt binaries without giving a warning / error.
35 */
36 #include <SDL_video.h>
37 #else
38 struct SDL_Color;
39 #endif
40 
41 
42 namespace wb {
43  class side_actions;
44 }
45 
46 /**
47  * This class stores all the data for a single 'side' (in game nomenclature).
48  * E.g., there is only one leader unit per team.
49  */
50 class team
51 {
52 public:
53 
54  MAKE_ENUM(CONTROLLER,
55  (HUMAN, "human")
56  (AI, "ai")
57  (EMPTY, "null")
58  )
59 
60  MAKE_ENUM(PROXY_CONTROLLER,
61  (PROXY_HUMAN, "human")
62  (PROXY_AI, "ai")
63  (PROXY_IDLE, "idle")
64  )
65 
66  MAKE_ENUM(DEFEAT_CONDITION,
67  (NO_LEADER, "no_leader_left")
68  (NO_UNITS, "no_units_left")
69  (NEVER, "never")
70  (ALWAYS, "always")
71  )
72 
73  MAKE_ENUM(SHARE_VISION,
74  (ALL, "all")
75  (SHROUD, "shroud")
76  (NONE, "none")
77  )
78 
79 private:
80  class shroud_map {
81  public:
82  shroud_map() : enabled_(false), data_() {}
83 
84  void place(int x, int y);
85  bool clear(int x, int y);
86  void reset();
87 
88  bool value(int x, int y) const;
89  bool shared_value(const std::vector<const shroud_map*>& maps, int x, int y) const;
90 
91  bool copy_from(const std::vector<const shroud_map*>& maps);
92 
93  std::string write() const;
94  void read(const std::string& shroud_data);
95  void merge(const std::string& shroud_data);
96 
97  bool enabled() const { return enabled_; }
98  void set_enabled(bool enabled) { enabled_ = enabled; }
99  private:
100  bool enabled_;
101  std::vector<std::vector<bool> > data_;
102  };
103 
104  struct team_info
105  {
106  team_info();
107  void read(const config &cfg);
108  void write(config& cfg) const;
109  int gold;
111  int income;
116  std::set<std::string> can_recruit;
123  // 'id' of the current player (not necessarily unique)
127 
130 
132 
134 
135  t_string objectives; /** < Team's objectives for the current level. */
136 
137  /** Set to true when the objectives for this time changes.
138  * Reset to false when the objectives for this team have been
139  * displayed to the user. */
140  mutable bool objectives_changed;
141 
142  CONTROLLER controller;
143  bool is_local;
144  DEFEAT_CONDITION defeat_condition;
145 
146  PROXY_CONTROLLER proxy_controller; // when controller == HUMAN, the proxy controller determines what input method is actually used.
147  // proxy controller is an interface property, not gamestate. it is not synced, not known to server.
148  // also not saved in save game file
149  SHARE_VISION share_vision;
153  bool no_leader;
154  bool hidden;
155  bool no_turn_confirmation; // Can suppress confirmations when ending a turn.
156 
158 
159  int side;
161  bool lost;
162 
165  // TODO: maybe make this integer percentage? I like the float version more but this might casue OOS error because of floating point rounding differences on different hardware.
169  void handle_legacy_share_vision(const config& cfg);
170  };
171 
172  static const int default_team_gold_;
173 
174 public:
175  team();
176  virtual ~team();
177 
178  /// Stores the attributes recognized by [side]. These should be stripped
179  /// from a side's config before using it to create the side's leader.
180  static const boost::container::flat_set<std::string> attributes;
181 
182  void build(const config &cfg, const gamemap &map, int gold = default_team_gold_);
183 
184  void write(config& cfg) const;
185 
186  bool get_village(const map_location&, const int owner_side, game_data * fire_event); //!< Acquires a village from owner_side. Pointer fire_event should be the game_data for the game if it is desired to fire an event -- a "capture" event with owner_side variable scoped in will be fired. For no event, pass it nullptr. Default is the resources::gamedata pointer
187  void lose_village(const map_location&);
188  void clear_villages() { villages_.clear(); }
189  const std::set<map_location>& villages() const { return villages_; }
190  bool owns_village(const map_location& loc) const
191  { return villages_.count(loc) > 0; }
192 
193  int side() const { return info_.side; }
194  int gold() const { return gold_; }
195  int start_gold() const { return info_.start_gold; }
197  int village_gold() const { return info_.income_per_village; }
198  int recall_cost() const { return info_.recall_cost; }
199  void set_village_gold(int income) { info_.income_per_village = income; }
200  void set_recall_cost(int cost) { info_.recall_cost = cost; }
201  int total_income() const { return base_income() + villages_.size() * info_.income_per_village; }
202  /** @return The number of unit levels each village can support,
203  i.e. how much upkeep each village can bear. */
204  int village_support() const { return info_.support_per_village; }
205  /** @param support The number of unit levels each village can support */
207  /** Calculate total support capacity, based on support_per_village. */
208  int support() const { return villages_.size()*village_support(); }
209  void new_turn() { gold_ += total_income(); }
210  void get_shared_maps();
211  void set_gold(int amount) { gold_ = amount; }
212  void set_start_gold(const int amount) { info_.start_gold = amount; }
213  void spend_gold(const int amount) { gold_ -= amount; }
215  int countdown_time() const { return countdown_time_; }
216  void set_countdown_time (const int amount) const
217  { countdown_time_ = amount; }
218  int action_bonus_count() const { return action_bonus_count_; }
221  const recall_list_manager & recall_list() const {return recall_list_;}
222  void set_current_player(const std::string& player)
223  { info_.current_player = player; }
224 
227 
228  const std::set<std::string>& recruits() const
229  { return info_.can_recruit; }
230  void add_recruit(const std::string &);
231  void set_recruits(const std::set<std::string>& recruits);
232  int minimum_recruit_price() const;
233  const std::string& last_recruit() const { return last_recruit_; }
234  void last_recruit(const std::string & u_type) { last_recruit_ = u_type; }
235 
236  const std::string& save_id() const { return info_.save_id; }
238  const std::string& current_player() const { return info_.current_player; }
239 
240  void set_objectives(const t_string& new_objectives, bool silently=false);
241  void set_objectives_changed(bool c = true) const { info_.objectives_changed = c; }
243 
244  const t_string& objectives() const { return info_.objectives; }
245  bool objectives_changed() const { return info_.objectives_changed; }
246 
247  bool is_enemy(int n) const {
248  const size_t index = size_t(n-1);
249  if(index < enemies_.size()) {
250  return enemies_[index];
251  } else {
252  return calculate_enemies(index);
253  }
254  }
255 
256  CONTROLLER controller() const { return info_.controller; }
257  const std::string& color() const { return info_.color; }
259  bool is_empty() const { return info_.controller == CONTROLLER::EMPTY; }
260 
261  bool is_local() const { return !is_empty() && info_.is_local; }
262  bool is_network() const { return !is_empty() && !info_.is_local; }
263 
264  bool is_human() const { return info_.controller == CONTROLLER::HUMAN; }
265  bool is_ai() const { return info_.controller == CONTROLLER::AI; }
266 
267  bool is_local_human() const { return is_human() && is_local(); }
268  bool is_local_ai() const { return is_ai() && is_local(); }
269  bool is_network_human() const { return is_human() && is_network(); }
270  bool is_network_ai() const { return is_ai() && is_network(); }
271 
272  void set_local(bool local) { info_.is_local = local; }
273  void make_human() { info_.controller = CONTROLLER::HUMAN; }
274  void make_ai() { info_.controller = CONTROLLER::AI; }
275  void change_controller(const std::string& new_controller) {
276  info_.controller = CONTROLLER::AI;
277  info_.controller.parse(new_controller);
278  }
280  void change_controller_by_wml(const std::string& new_controller);
281 
282  PROXY_CONTROLLER proxy_controller() const { return info_.proxy_controller; }
283  bool is_proxy_human() const { return info_.proxy_controller == PROXY_CONTROLLER::PROXY_HUMAN; }
284  bool is_droid() const { return info_.proxy_controller == PROXY_CONTROLLER::PROXY_AI; }
285  bool is_idle() const { return info_.proxy_controller == PROXY_CONTROLLER::PROXY_IDLE; }
286 
287  void make_droid() { info_.proxy_controller = PROXY_CONTROLLER::PROXY_AI; }
288  void make_idle() { info_.proxy_controller = PROXY_CONTROLLER::PROXY_IDLE; }
289  void make_proxy_human() { info_.proxy_controller = PROXY_CONTROLLER::PROXY_HUMAN; }
291 
292  void change_proxy(PROXY_CONTROLLER proxy) { info_.proxy_controller = proxy; }
293 
294  void toggle_droid() { info_.proxy_controller = (info_.proxy_controller == PROXY_CONTROLLER::PROXY_AI ) ? PROXY_CONTROLLER::PROXY_HUMAN : PROXY_CONTROLLER::PROXY_AI; }
295  void toggle_idle() { info_.proxy_controller = (info_.proxy_controller == PROXY_CONTROLLER::PROXY_IDLE) ? PROXY_CONTROLLER::PROXY_HUMAN : PROXY_CONTROLLER::PROXY_IDLE; }
296 
297  const std::string& team_name() const { return info_.team_name; }
298  const t_string &user_team_name() const { return info_.user_team_name; }
299  void change_team(const std::string &name, const t_string &user_name);
300 
301  const std::string& flag() const { return info_.flag; }
302  const std::string& flag_icon() const { return info_.flag_icon; }
303 
304  void set_flag(const std::string& flag) { info_.flag = flag; }
306 
308  const std::string& faction() const { return info_.faction; }
309  const t_string& faction_name() const { return info_.faction_name; }
310  //Returns true if the hex is shrouded/fogged for this side, or
311  //any other ally with shared vision.
312  bool shrouded(const map_location& loc) const;
313  bool fogged(const map_location& loc) const;
314 
315  bool uses_shroud() const { return shroud_.enabled(); }
316  bool uses_fog() const { return fog_.enabled(); }
317  bool fog_or_shroud() const { return uses_shroud() || uses_fog(); }
318  bool clear_shroud(const map_location& loc) { return shroud_.clear(loc.x+1,loc.y+1); }
319  void place_shroud(const map_location& loc) { shroud_.place(loc.x+1,loc.y+1); }
320  bool clear_fog(const map_location& loc) { return fog_.clear(loc.x+1,loc.y+1); }
321  void reshroud() { shroud_.reset(); }
322  void refog() { fog_.reset(); }
323  void set_shroud(bool shroud) { shroud_.set_enabled(shroud); }
324  void set_fog(bool fog) { fog_.set_enabled(fog); }
325 
326  /** Merge a WML shroud map with the shroud data of this player. */
327  void merge_shroud_map_data(const std::string& shroud_data) { shroud_.merge(shroud_data); }
328 
329  bool knows_about_team(size_t index) const;
330  /// Records hexes that were cleared of fog via WML.
331  void add_fog_override(const std::set<map_location> &hexes) { fog_clearer_.insert(hexes.begin(), hexes.end()); }
332  /// Removes the record of hexes that were cleared of fog via WML.
333  void remove_fog_override(const std::set<map_location> &hexes);
334 
335  bool auto_shroud_updates() const { return auto_shroud_updates_; }
338  bool no_leader() const { return info_.no_leader; }
339  DEFEAT_CONDITION defeat_condition() const { return info_.defeat_condition; }
340  void set_defeat_condition(DEFEAT_CONDITION value) { info_.defeat_condition = value; }
341  ///sets the defeat condition if @param value is a valid defeat condition, otherwise nothing happes.
343  void have_leader(bool value=true) { info_.no_leader = !value; }
344  bool hidden() const { return info_.hidden; }
346  bool persistent() const { return info_.persistent; }
348  void set_lost(bool value=true) { info_.lost = value; }
349  bool lost() const { return info_.lost; }
350 
354  bool carryover_add() const { return info_.carryover_add; }
356  double carryover_bonus() const { return info_.carryover_bonus; }
358  int carryover_gold() const { return info_.carryover_gold; }
360  const config& variables() const { return info_.variables; }
361 
364 
365  //function which, when given a 1-based side will return the color used by that side.
366  static const color_range get_side_color_range(int side);
367  static Uint32 get_side_rgb(int side) { return(get_side_color_range(side).mid()); }
368  static Uint32 get_side_rgb_max(int side) { return(get_side_color_range(side).max()); }
369  static Uint32 get_side_rgb_min(int side) { return(get_side_color_range(side).min()); }
370  static SDL_Color get_side_color(int side);
371  static SDL_Color get_minimap_color(int side);
373  static std::string get_side_highlight(int side);
375 
376  void log_recruitable() const;
377 
378  /** clear the shroud, fog, and enemies cache for all teams*/
379  static void clear_caches();
380 
381  /** get the whiteboard planned actions for this team */
383 
384  config to_config() const;
385 
386  bool share_maps() const { return info_.share_vision != SHARE_VISION::NONE ; }
387  bool share_view() const { return info_.share_vision == SHARE_VISION::ALL; }
388  SHARE_VISION share_vision() const { return info_.share_vision; }
389 
390  void set_share_vision(const std::string& vision_status) {
391  info_.share_vision = SHARE_VISION::ALL;
392  info_.share_vision.parse(vision_status);
393  }
394 
395  void set_share_vision(SHARE_VISION vision_status) { info_.share_vision = vision_status; }
396 
398  {
400  }
402 private:
403 
404  const std::vector<const shroud_map*>& ally_shroud(const std::vector<team>& teams) const;
405  const std::vector<const shroud_map*>& ally_fog(const std::vector<team>& teams) const;
406 
407  int gold_;
408  std::set<map_location> villages_;
409 
411  /// Stores hexes that have been cleared of fog via WML.
412  std::set<map_location> fog_clearer_;
413 
415 
417 
418  mutable int countdown_time_;
420 
423 
424  bool calculate_enemies(size_t index) const;
425  bool calculate_is_enemy(size_t index) const;
426  mutable std::vector<bool> enemies_;
427 
428  mutable std::vector<const shroud_map*> ally_shroud_, ally_fog_;
429 
430  /**
431  * Whiteboard planned actions for this team.
432  */
434 };
435 
436 //function which will validate a side. Throws game::game_error
437 //if the side is invalid
438 void validate_side(int side); //throw game::game_error
439 
440 #endif
441 
const t_string & faction_name() const
Definition: team.hpp:309
void clear_proxy()
Definition: team.hpp:290
bool uses_shroud() const
Definition: team.hpp:315
PROXY_HUMAN
Definition: team.hpp:61
bool is_local_ai() const
Definition: team.hpp:268
bool is_network() const
Definition: team.hpp:262
std::string id
Definition: team.hpp:131
bool is_local() const
Definition: team.hpp:261
void change_controller(CONTROLLER controller)
Definition: team.hpp:279
bool allow_player
Definition: team.hpp:151
static const int default_team_gold_
Definition: team.hpp:172
const std::string & flag() const
Definition: team.hpp:301
void place(int x, int y)
Definition: team.cpp:687
void set_share_vision(SHARE_VISION vision_status)
Definition: team.hpp:395
std::vector< bool > enemies_
Definition: team.hpp:426
boost::shared_ptr< wb::side_actions > get_side_actions() const
get the whiteboard planned actions for this team
Definition: team.hpp:382
void set_shroud(bool shroud)
Definition: team.hpp:323
bool no_turn_confirmation
Definition: team.hpp:155
std::string last_recruit_
Definition: team.hpp:422
const std::string & current_player() const
Definition: team.hpp:238
void write(config &cfg) const
Definition: team.cpp:237
int start_gold() const
Definition: team.hpp:195
DEFEAT_CONDITION defeat_condition
Definition: team.hpp:144
static std::string get_side_highlight(int side)
Definition: team.cpp:853
GLenum GLsizei const GLuint GLboolean enabled
Definition: glew.h:2497
const std::string & color() const
Definition: team.hpp:257
void set_start_gold(const int amount)
Definition: team.hpp:212
void reshroud()
Definition: team.hpp:321
void toggle_droid()
Definition: team.hpp:294
SHARE_VISION share_vision
Definition: team.hpp:149
void make_droid()
Definition: team.hpp:287
void set_carryover_add(bool value)
Definition: team.hpp:353
void handle_legacy_share_vision(const config &cfg)
Definition: team.cpp:221
CONTROLLER controller
Definition: team.hpp:142
void set_objectives(const t_string &new_objectives, bool silently=false)
Definition: team.cpp:560
int carryover_gold
Definition: team.hpp:167
bool shrouded(const map_location &loc) const
Definition: team.cpp:567
bool persistent() const
Definition: team.hpp:346
const GLfloat * c
Definition: glew.h:12741
const std::set< std::string > & recruits() const
Definition: team.hpp:228
bool clear_fog(const map_location &loc)
Definition: team.hpp:320
bool owns_village(const map_location &loc) const
Definition: team.hpp:190
bool hidden() const
Definition: team.hpp:344
bool get_disallow_observers() const
Definition: team.hpp:337
void handle_legacy_share_vision(const config &cfg)
Definition: team.hpp:397
static const color_range get_side_color_range(int side)
Definition: team.cpp:816
int support_per_village
Definition: team.hpp:113
void refog()
Definition: team.hpp:322
t_string objectives
Definition: team.hpp:135
double carryover_bonus() const
Definition: team.hpp:356
bool is_enemy(int n) const
Definition: team.hpp:247
const t_string & objectives() const
Definition: team.hpp:244
void new_turn()
Definition: team.hpp:209
void clear(const std::string &key)
PROXY_CONTROLLER proxy_controller() const
Definition: team.hpp:282
void set_recall_cost(int cost)
Definition: team.hpp:200
bool objectives_changed() const
Definition: team.hpp:245
MAKE_ENUM(CONTROLLER,(HUMAN,"human")(AI,"ai")(EMPTY,"null")) MAKE_ENUM(PROXY_CONTROLLER
void set_save_id(const std::string &save_id)
Definition: team.hpp:237
void build(const config &cfg, const gamemap &map, int gold=default_team_gold_)
Definition: team.cpp:306
config to_config() const
Definition: team.cpp:872
int minimum_recruit_price
Definition: team.hpp:114
void set_countdown_time(const int amount) const
Definition: team.hpp:216
DEFEAT_CONDITION defeat_condition() const
Definition: team.hpp:339
boost::shared_ptr< wb::side_actions > planned_actions_
Whiteboard planned actions for this team.
Definition: team.hpp:433
GLint GLint GLint GLint GLint GLint y
Definition: glew.h:1220
team()
Definition: team.cpp:283
t_string faction_name
Definition: team.hpp:121
std::string flag_icon
Definition: team.hpp:129
void set_persistent(bool value)
Definition: team.hpp:347
void set_defeat_condition_string(const std::string &value)
sets the defeat condition if
Definition: team.hpp:342
bool objectives_changed
< Team's objectives for the current level.
Definition: team.hpp:140
void add_recruit(const std::string &)
Definition: team.cpp:413
void change_controller(const std::string &new_controller)
Definition: team.hpp:275
bool is_proxy_human() const
Definition: team.hpp:283
void set_share_vision(const std::string &vision_status)
Definition: team.hpp:390
void set_hidden(bool value)
Definition: team.hpp:345
void set_current_player(const std::string &player)
Definition: team.hpp:222
int carryover_gold() const
Definition: team.hpp:358
Definitions for the interface to Wesnoth Markup Language (WML).
std::string faction
Definition: team.hpp:120
void set_carryover_percentage(int value)
Definition: team.hpp:351
const std::string & last_recruit() const
Definition: team.hpp:233
double carryover_bonus
Definition: team.hpp:166
void set_scroll_to_leader(bool value)
Definition: team.hpp:226
SHARE_VISION share_vision() const
Definition: team.hpp:388
static std::string get_side_highlight_pango(int side)
Definition: team.cpp:858
static const boost::container::flat_set< std::string > attributes
Stores the attributes recognized by [side].
Definition: team.hpp:180
void make_human()
Definition: team.hpp:273
shroud_map shroud_
Definition: team.hpp:410
void set_no_turn_confirmation(bool value)
Definition: team.hpp:363
void set_flag(const std::string &flag)
Definition: team.hpp:304
team_info info_
Definition: team.hpp:416
static std::vector< team > *& teams
Definition: team.cpp:50
std::string team_name
Definition: team.hpp:117
This class stores all the data for a single 'side' (in game nomenclature).
Definition: team.hpp:50
bool calculate_enemies(size_t index) const
Definition: team.cpp:441
bool is_human() const
Definition: team.hpp:264
bool fog_or_shroud() const
Definition: team.hpp:317
void set_carryover_bonus(double value)
Definition: team.hpp:355
int recall_cost() const
Definition: team.hpp:198
void have_leader(bool value=true)
Definition: team.hpp:343
const std::string & flag_icon() const
Definition: team.hpp:302
bool chose_random
Definition: team.hpp:152
PROXY_CONTROLLER proxy_controller
Definition: team.hpp:146
void get_shared_maps()
bool auto_shroud_updates() const
Definition: team.hpp:335
bool is_local
Definition: team.hpp:143
void read(const config &cfg)
Definition: team.cpp:119
config variables
Definition: team.hpp:168
int village_support() const
Definition: team.hpp:204
config & variables()
Definition: team.hpp:359
void set_defeat_condition(DEFEAT_CONDITION value)
Definition: team.hpp:340
const t_string & user_team_name() const
Definition: team.hpp:298
int carryover_percentage() const
Definition: team.hpp:352
void clear_villages()
Definition: team.hpp:188
GLsizei const GLfloat * value
Definition: glew.h:1817
void set_local(bool local)
Definition: team.hpp:272
void set_lost(bool value=true)
Definition: team.hpp:348
int base_income() const
Definition: team.hpp:196
bool lost() const
Definition: team.hpp:349
void write(config &cfg) const
Definition: team.cpp:355
Encapsulates the map of the game.
Definition: map.hpp:37
bool share_maps() const
Definition: team.hpp:386
const std::string & team_name() const
Definition: team.hpp:297
void validate_side(int side)
Definition: team.cpp:657
void set_village_support(int support)
Definition: team.hpp:206
bool disallow_observers
Definition: team.hpp:150
bool is_local_human() const
Definition: team.hpp:267
bool no_leader() const
Definition: team.hpp:338
void log_recruitable() const
Definition: team.cpp:863
void merge(const std::string &shroud_data)
Definition: team.cpp:778
void spend_gold(const int amount)
Definition: team.hpp:213
const config & variables() const
Definition: team.hpp:360
void reset_objectives_changed() const
Definition: team.hpp:242
bool persistent
Definition: team.hpp:160
const std::set< map_location > & villages() const
Definition: team.hpp:189
bool auto_shroud_updates_
Definition: team.hpp:414
Templates and utility-routines for strings and numbers.
void set_fog(bool fog)
Definition: team.hpp:324
void remove_fog_override(const std::set< map_location > &hexes)
Removes the record of hexes that were cleared of fog via WML.
Definition: team.cpp:644
std::vector< const shroud_map * > ally_fog_
Definition: team.hpp:428
void place_shroud(const map_location &loc)
Definition: team.hpp:319
GLuint GLuint GLsizei count
Definition: glew.h:1221
const recall_list_manager & recall_list() const
Definition: team.hpp:221
GLuint color
Definition: glew.h:5801
const std::string & save_id() const
Definition: team.hpp:236
const std::string &parameters float amount
Definition: filter.cpp:132
GLboolean reset
Definition: glew.h:3799
Encapsulates the map of the game.
Definition: location.hpp:38
void set_village_gold(int income)
Definition: team.hpp:199
void make_proxy_human()
Definition: team.hpp:289
void set_carryover_gold(int value)
Definition: team.hpp:357
void make_ai()
Definition: team.hpp:274
bool calculate_is_enemy(size_t index) const
Definition: team.cpp:454
static void clear_caches()
clear the shroud, fog, and enemies cache for all teams
Definition: team.cpp:549
bool get_scroll_to_leader() const
Definition: team.hpp:225
std::string current_player
Definition: team.hpp:124
int start_gold
Definition: team.hpp:110
const std::vector< const shroud_map * > & ally_shroud(const std::vector< team > &teams) const
Definition: team.cpp:589
virtual ~team()
Definition: team.cpp:302
bool share_view() const
Definition: team.hpp:387
void set_gold(int amount)
Definition: team.hpp:211
bool is_ai() const
Definition: team.hpp:265
bool clear_shroud(const map_location &loc)
Definition: team.hpp:318
const std::vector< const shroud_map * > & ally_fog(const std::vector< team > &teams) const
Definition: team.cpp:602
const std::string & faction() const
Definition: team.hpp:308
int carryover_percentage
Definition: team.hpp:163
int countdown_time_
Definition: team.hpp:418
void change_proxy(PROXY_CONTROLLER proxy)
Definition: team.hpp:292
void set_enabled(bool enabled)
Definition: team.hpp:98
std::set< map_location > villages_
Definition: team.hpp:408
idle all(SHROUD,"shroud")(NONE
static SDL_Color get_minimap_color(int side)
Definition: team.cpp:833
GLuint index
Definition: glew.h:1782
static Uint32 get_side_rgb_min(int side)
Definition: team.hpp:369
A color range definition is made of four reference RGB colors, used for calculating conversions from ...
Definition: color_range.hpp:54
static SDL_Color get_side_color(int side)
Definition: team.cpp:828
GLint GLint GLint GLint GLint x
Definition: glew.h:1220
int recall_cost
Definition: team.hpp:115
bool fogged(const map_location &loc) const
Definition: team.cpp:575
void set_flag_icon(const std::string &flag_icon)
Definition: team.hpp:305
void read(config &cfg, std::istream &in, abstract_validator *validator)
Definition: parser.cpp:400
void set_objectives_changed(bool c=true) const
Definition: team.hpp:241
int support() const
Calculate total support capacity, based on support_per_village.
Definition: team.hpp:208
int side() const
Definition: team.hpp:193
bool no_turn_confirmation() const
Definition: team.hpp:362
bool fire_event(const tevent event, std::vector< std::pair< twidget *, tevent > > &event_chain, twidget *dispatcher, twidget *widget, F functor)
Helper function for fire_event.
std::vector< const shroud_map * > ally_shroud_
Definition: team.hpp:428
recall_list_manager recall_list_
Definition: team.hpp:421
void change_controller_by_wml(const std::string &new_controller)
Definition: team.cpp:512
bool clear(int x, int y)
Definition: team.cpp:668
void toggle_idle()
Definition: team.hpp:295
GLuint const GLchar * name
Definition: glew.h:1782
CONTROLLER controller() const
Definition: team.hpp:256
static Uint32 get_side_rgb_max(int side)
Definition: team.hpp:368
bool knows_about_team(size_t index) const
Definition: team.cpp:615
int gold() const
Definition: team.hpp:194
void reset()
Definition: team.cpp:703
GLclampd n
Definition: glew.h:5903
int countdown_time() const
Definition: team.hpp:215
std::set< map_location > fog_clearer_
Stores hexes that have been cleared of fog via WML.
Definition: team.hpp:412
const std::string & side_name() const
Definition: team.hpp:307
bool is_empty() const
Definition: team.hpp:259
t_string side_name
Definition: team.hpp:119
void lose_village(const map_location &)
Definition: team.cpp:399
shroud_map fog_
Definition: team.hpp:410
bool uses_fog() const
Definition: team.hpp:316
void merge_shroud_map_data(const std::string &shroud_data)
Merge a WML shroud map with the shroud data of this player.
Definition: team.hpp:327
std::string color
Definition: team.hpp:157
int income_per_village
Definition: team.hpp:112
int gold_
Definition: team.hpp:407
t_string user_team_name
Definition: team.hpp:118
bool carryover_add
Definition: team.hpp:164
int action_bonus_count_
Definition: team.hpp:419
int action_bonus_count
Definition: team.hpp:126
idle ALL
Definition: team.hpp:74
bool is_idle() const
Definition: team.hpp:285
void set_action_bonus_count(const int count)
Definition: team.hpp:219
std::vector< std::vector< bool > > data_
Definition: team.hpp:101
bool is_network_ai() const
Definition: team.hpp:270
recall_list_manager & recall_list()
Definition: team.hpp:220
void add_fog_override(const std::set< map_location > &hexes)
Records hexes that were cleared of fog via WML.
Definition: team.hpp:331
#define c
Definition: glew.h:12743
bool enabled() const
Definition: team.hpp:97
static std::string get_side_color_index(int side)
Definition: team.cpp:840
void change_team(const std::string &name, const t_string &user_name)
Definition: team.cpp:534
std::set< std::string > can_recruit
Definition: team.hpp:116
void set_auto_shroud_updates(bool value)
Definition: team.hpp:336
std::string save_id
Definition: team.hpp:122
bool carryover_add() const
Definition: team.hpp:354
int total_income() const
Definition: team.hpp:201
void set_base_income(int amount)
Definition: team.hpp:214
static Uint32 get_side_rgb(int side)
Definition: team.hpp:367
void set_recruits(const std::set< std::string > &recruits)
Definition: team.cpp:406
const std::string & str() const
Definition: tstring.hpp:170
int village_gold() const
Definition: team.hpp:197
std::string allied_human_teams() const
Definition: team.cpp:880
A config object defines a single node in a WML file, with access to child nodes.
Definition: config.hpp:83
bool is_network_human() const
Definition: team.hpp:269
void make_idle()
Definition: team.hpp:288
int action_bonus_count() const
Definition: team.hpp:218
std::string flag
Definition: team.hpp:128
Defines the MAKE_ENUM macro.
GLsizei const GLcharARB ** string
Definition: glew.h:4503
void last_recruit(const std::string &u_type)
Definition: team.hpp:234
bool empty() const
Definition: tstring.hpp:166
std::string countdown_time
Definition: team.hpp:125
Definition: display.hpp:47
bool get_village(const map_location &, const int owner_side, game_data *fire_event)
Acquires a village from owner_side. Pointer fire_event should be the game_data for the game if it is ...
Definition: team.cpp:377
bool scroll_to_leader
Definition: team.hpp:133
bool no_leader
Definition: team.hpp:153
bool is_droid() const
Definition: team.hpp:284
int minimum_recruit_price() const
Definition: team.cpp:420
void set_color(const std::string &color)
Definition: team.hpp:258