The Battle for Wesnoth  1.15.10+dev
team.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2003 - 2018 by David White <dave@whitevine.net>
3  Part of the Battle for Wesnoth Project https://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 
15 #pragma once
16 
17 #include "color_range.hpp"
18 #include "game_config.hpp"
19 #include "game_events/fwd.hpp"
20 #include "utils/make_enum.hpp"
21 #include "map/location.hpp"
22 #include "recall_list_manager.hpp"
23 #include "units/ptr.hpp"
24 #include "config.hpp"
25 
26 #include <set>
27 
28 #include <cstdint>
29 #include <boost/dynamic_bitset.hpp>
30 
31 class game_data;
32 class gamemap;
33 struct color_t;
34 
35 
36 namespace wb {
37  class side_actions;
38 }
39 
40 /**
41  * This class stores all the data for a single 'side' (in game nomenclature).
42  * E.g., there is only one leader unit per team.
43  */
44 class team
45 {
46 public:
47 
48  MAKE_ENUM(CONTROLLER,
49  (HUMAN, "human")
50  (AI, "ai")
51  (EMPTY, "null")
52  )
53 
54  MAKE_ENUM(PROXY_CONTROLLER,
55  (PROXY_HUMAN, "human")
56  (PROXY_AI, "ai")
57  (PROXY_IDLE, "idle")
58  )
59 
60  MAKE_ENUM(DEFEAT_CONDITION,
61  (NO_LEADER, "no_leader_left")
62  (NO_UNITS, "no_units_left")
63  (NEVER, "never")
64  (ALWAYS, "always")
65  )
66 
67  MAKE_ENUM(SHARE_VISION,
68  (ALL, "all")
69  (SHROUD, "shroud")
70  (NONE, "none")
71  )
72 
73 private:
74  class shroud_map {
75  public:
76  shroud_map() : enabled_(false), data_() {}
77 
78  void place(int x, int y);
79  bool clear(int x, int y);
80  void reset();
81 
82  bool value(int x, int y) const;
83  bool shared_value(const std::vector<const shroud_map*>& maps, int x, int y) const;
84 
85  bool copy_from(const std::vector<const shroud_map*>& maps);
86 
87  std::string write() const;
88  void read(const std::string& shroud_data);
89  void merge(const std::string& shroud_data);
90 
91  bool enabled() const { return enabled_; }
92  void set_enabled(bool enabled) { enabled_ = enabled; }
93  private:
94  bool enabled_;
95  std::vector<std::vector<bool>> data_;
96  };
97 
98  struct team_info
99  {
100  team_info();
101  void read(const config &cfg);
102  void write(config& cfg) const;
103  int gold;
105  int income;
110  std::set<std::string> can_recruit;
111  std::string team_name;
114  std::string faction;
116  std::string save_id;
117  // 'id' of the current player (not necessarily unique)
118  std::string current_player;
119  std::string countdown_time;
121 
122  std::string flag;
123  std::string flag_icon;
124 
125  std::string id;
126 
128 
129  t_string objectives; /** < Team's objectives for the current level. */
130 
131  /** Set to true when the objectives for this time changes.
132  * Reset to false when the objectives for this team have been
133  * displayed to the user. */
134  mutable bool objectives_changed;
135 
136  CONTROLLER controller;
137  bool is_local;
138  DEFEAT_CONDITION defeat_condition;
139 
140  PROXY_CONTROLLER proxy_controller; // when controller == HUMAN, the proxy controller determines what input method is actually used.
141  // proxy controller is an interface property, not gamestate. it is not synced, not known to server.
142  // also not saved in save game file
143  SHARE_VISION share_vision;
147  bool no_leader;
148  bool hidden;
149  bool no_turn_confirmation; // Can suppress confirmations when ending a turn.
150 
151  std::string color;
152 
153  int side;
155  bool lost;
156 
159  // TODO: maybe make this integer percentage? I like the float version more but this might cause OOS error because of floating point rounding differences on different hardware.
163  void handle_legacy_share_vision(const config& cfg);
164  };
165 
166  static const int default_team_gold_;
167 
168 public:
169  team();
170  virtual ~team();
171 
172  /**
173  * Stores the attributes recognized by [side]. These should be stripped
174  * from a side's config before using it to create the side's leader.
175  */
176  static const std::set<std::string> attributes;
177 
178  void build(const config &cfg, const gamemap &map, int gold = default_team_gold_);
179 
180  void write(config& cfg) const;
181 
182  void fix_villages(const gamemap &map);
183  /**
184  * Acquires a village from owner_side.
185  * 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.
186  * For no event, pass it nullptr.
187  * Default is the resources::gamedata pointer.
188  */
190  void lose_village(const map_location&);
191  void clear_villages() { villages_.clear(); }
192  const std::set<map_location>& villages() const { return villages_; }
193  bool owns_village(const map_location& loc) const
194  { return villages_.count(loc) > 0; }
195 
196  int side() const { return info_.side; }
197  int gold() const { return gold_; }
198  int start_gold() const { return info_.start_gold; }
199  int base_income() const { return info_.income + game_config::base_income; }
200  int village_gold() const { return info_.income_per_village; }
201  int recall_cost() const { return info_.recall_cost; }
202  void set_village_gold(int income) { info_.income_per_village = income; }
203  void set_recall_cost(int cost) { info_.recall_cost = cost; }
204  int total_income() const { return base_income() + villages_.size() * info_.income_per_village; }
205  /** @return The number of unit levels each village can support,
206  i.e. how much upkeep each village can bear. */
207  int village_support() const { return info_.support_per_village; }
208  /** @param support The number of unit levels each village can support */
209  void set_village_support(int support) { info_.support_per_village = support; }
210  /** Calculate total support capacity, based on support_per_village. */
211  int support() const { return villages_.size()*village_support(); }
212  void new_turn() { gold_ += total_income(); }
213  void get_shared_maps();
214  void set_gold(int amount) { gold_ = amount; }
215  void set_start_gold(const int amount) { info_.start_gold = amount; }
216  void spend_gold(const int amount) { gold_ -= amount; }
217  void set_base_income(int amount) { info_.income = amount - game_config::base_income; }
218  int countdown_time() const { return countdown_time_; }
219  void set_countdown_time (const int amount) const
220  { countdown_time_ = amount; }
221  int action_bonus_count() const { return action_bonus_count_; }
222  void set_action_bonus_count(const int count) { action_bonus_count_ = count; }
223  recall_list_manager& recall_list() {return recall_list_;}
224  const recall_list_manager & recall_list() const {return recall_list_;}
225  void set_current_player(const std::string& player)
226  { info_.current_player = player; }
227 
228  bool get_scroll_to_leader() const {return info_.scroll_to_leader;}
229  void set_scroll_to_leader(bool value) { info_.scroll_to_leader = value; }
230 
231  const std::set<std::string>& recruits() const
232  { return info_.can_recruit; }
233  void add_recruit(const std::string &);
234  void set_recruits(const std::set<std::string>& recruits);
235  int minimum_recruit_price() const;
236  const std::string& last_recruit() const { return last_recruit_; }
237  void last_recruit(const std::string & u_type) { last_recruit_ = u_type; }
238 
239  const std::string& save_id() const { return info_.save_id; }
240  std::string save_id_or_number() const { return info_.save_id.empty() ? std::to_string(info_.side) : info_.save_id; }
241  void set_save_id(const std::string& save_id) { info_.save_id = save_id; }
242  const std::string& current_player() const { return info_.current_player; }
243 
244  void set_objectives(const t_string& new_objectives, bool silently=false);
245  void set_objectives_changed(bool c = true) const { info_.objectives_changed = c; }
246  void reset_objectives_changed() const { info_.objectives_changed = false; }
247 
248  const t_string& objectives() const { return info_.objectives; }
249  bool objectives_changed() const { return info_.objectives_changed; }
250 
251  bool is_enemy(int n) const {
252  const std::size_t index = std::size_t(n-1);
253  if(index >= enemies_.size()) {
254  calculate_enemies(index);
255  }
256  if(index < enemies_.size()) {
257  return enemies_[index];
258  } else {
259  return false;
260  }
261  }
262 
263  CONTROLLER controller() const { return info_.controller; }
264  const std::string& color() const { return info_.color; }
265  /** @note Call display::reinit_flag_for_side() after calling this */
266  void set_color(const std::string& color) { info_.color = color; }
267  bool is_empty() const { return info_.controller == CONTROLLER::EMPTY; }
268 
269  bool is_local() const { return !is_empty() && info_.is_local; }
270  bool is_network() const { return !is_empty() && !info_.is_local; }
271 
272  bool is_human() const { return info_.controller == CONTROLLER::HUMAN; }
273  bool is_ai() const { return info_.controller == CONTROLLER::AI; }
274 
275  bool is_local_human() const { return is_human() && is_local(); }
276  bool is_local_ai() const { return is_ai() && is_local(); }
277  bool is_network_human() const { return is_human() && is_network(); }
278  bool is_network_ai() const { return is_ai() && is_network(); }
279 
280  void set_local(bool local) { info_.is_local = local; }
281  void make_human() { info_.controller = CONTROLLER::HUMAN; }
282  void make_ai() { info_.controller = CONTROLLER::AI; }
283  void change_controller(const std::string& new_controller) {
284  info_.controller = CONTROLLER::AI;
285  info_.controller.parse(new_controller);
286  }
287  void change_controller(CONTROLLER controller) { info_.controller = controller; }
288  void change_controller_by_wml(const std::string& new_controller);
289 
290  PROXY_CONTROLLER proxy_controller() const { return info_.proxy_controller; }
291  bool is_proxy_human() const { return info_.proxy_controller == PROXY_CONTROLLER::PROXY_HUMAN; }
292  bool is_droid() const { return info_.proxy_controller == PROXY_CONTROLLER::PROXY_AI; }
293  bool is_idle() const { return info_.proxy_controller == PROXY_CONTROLLER::PROXY_IDLE; }
294 
295  void make_droid() { info_.proxy_controller = PROXY_CONTROLLER::PROXY_AI; }
296  void make_idle() { info_.proxy_controller = PROXY_CONTROLLER::PROXY_IDLE; }
297  void make_proxy_human() { info_.proxy_controller = PROXY_CONTROLLER::PROXY_HUMAN; }
298  void clear_proxy() { make_proxy_human(); }
299 
300  void change_proxy(PROXY_CONTROLLER proxy) { info_.proxy_controller = proxy; }
301 
302  void toggle_droid() { info_.proxy_controller = (info_.proxy_controller == PROXY_CONTROLLER::PROXY_AI ) ? PROXY_CONTROLLER::PROXY_HUMAN : PROXY_CONTROLLER::PROXY_AI; }
303  void toggle_idle() { info_.proxy_controller = (info_.proxy_controller == PROXY_CONTROLLER::PROXY_IDLE) ? PROXY_CONTROLLER::PROXY_HUMAN : PROXY_CONTROLLER::PROXY_IDLE; }
304 
305  const std::string& team_name() const { return info_.team_name; }
306  const t_string &user_team_name() const { return info_.user_team_name; }
307  void change_team(const std::string &name, const t_string &user_name);
308 
309  const std::string& flag() const { return info_.flag; }
310  const std::string& flag_icon() const { return info_.flag_icon; }
311 
312  /** @note Call display::reinit_flag_for_side() after calling this */
313  void set_flag(const std::string& flag) { info_.flag = flag; }
314  void set_flag_icon(const std::string& flag_icon) { info_.flag_icon = flag_icon; }
315 
316  const std::string& side_name() const { return info_.side_name.empty() ? info_.current_player : info_.side_name.str(); }
317  t_string side_name_tstr() const { return info_.side_name.empty() ? t_string(info_.current_player) : info_.side_name; }
318  void set_side_name(const t_string& new_name) {info_.side_name = new_name;}
319  const std::string& faction() const { return info_.faction; }
320  const t_string& faction_name() const { return info_.faction_name; }
321  //Returns true if the hex is shrouded/fogged for this side, or
322  //any other ally with shared vision.
323  bool shrouded(const map_location& loc) const;
324  bool fogged(const map_location& loc) const;
325 
326  bool uses_shroud() const { return shroud_.enabled(); }
327  bool uses_fog() const { return fog_.enabled(); }
328  bool fog_or_shroud() const { return uses_shroud() || uses_fog(); }
329  bool clear_shroud(const map_location& loc) { return shroud_.clear(loc.wml_x(),loc.wml_y()); }
330  void place_shroud(const map_location& loc) { shroud_.place(loc.wml_x(),loc.wml_y()); }
331  bool clear_fog(const map_location& loc) { return fog_.clear(loc.wml_x(),loc.wml_y()); }
332  void reshroud() { shroud_.reset(); }
333  void refog() { fog_.reset(); }
334  void set_shroud(bool shroud) { shroud_.set_enabled(shroud); }
335  void set_fog(bool fog) { fog_.set_enabled(fog); }
336 
337  /** Merge a WML shroud map with the shroud data of this player. */
338  void merge_shroud_map_data(const std::string& shroud_data) { shroud_.merge(shroud_data); }
339 
340  bool knows_about_team(std::size_t index) const;
341  /** Records hexes that were cleared of fog via WML. */
342  void add_fog_override(const std::set<map_location> &hexes) { fog_clearer_.insert(hexes.begin(), hexes.end()); }
343  /** Removes the record of hexes that were cleared of fog via WML. */
344  void remove_fog_override(const std::set<map_location> &hexes);
345 
346  bool auto_shroud_updates() const { return auto_shroud_updates_; }
347  void set_auto_shroud_updates(bool value) { auto_shroud_updates_ = value; }
348  bool get_disallow_observers() const {return info_.disallow_observers; }
349  bool no_leader() const { return info_.no_leader; }
350  DEFEAT_CONDITION defeat_condition() const { return info_.defeat_condition; }
351  void set_defeat_condition(DEFEAT_CONDITION value) { info_.defeat_condition = value; }
352  /** sets the defeat condition if @param value is a valid defeat condition, otherwise nothing happes. */
353  void set_defeat_condition_string(const std::string& value) { info_.defeat_condition.parse(value); }
354  void have_leader(bool value=true) { info_.no_leader = !value; }
355  bool hidden() const { return info_.hidden; }
356  void set_hidden(bool value) { info_.hidden=value; }
357  bool persistent() const { return info_.persistent; }
358  void set_persistent(bool value) { info_.persistent = value; }
359  void set_lost(bool value=true) { info_.lost = value; }
360  bool lost() const { return info_.lost; }
361 
362  void set_carryover_percentage(int value) { info_.carryover_percentage = value; }
363  int carryover_percentage() const { return info_.carryover_percentage; }
364  void set_carryover_add(bool value) { info_.carryover_add = value; }
365  bool carryover_add() const { return info_.carryover_add; }
366  void set_carryover_bonus(double value) { info_.carryover_bonus = value; }
367  double carryover_bonus() const { return info_.carryover_bonus; }
368  void set_carryover_gold(int value) { info_.carryover_gold = value; }
369  int carryover_gold() const { return info_.carryover_gold; }
370  config& variables() { return info_.variables; }
371  const config& variables() const { return info_.variables; }
372 
373  bool no_turn_confirmation() const { return info_.no_turn_confirmation; }
374  void set_no_turn_confirmation(bool value) { info_.no_turn_confirmation = value; }
375 
376  //function which, when given a 1-based side will return the color used by that side.
377  static const color_range get_side_color_range(int side);
378 
379  static color_t get_side_color(int side);
380  static color_t get_minimap_color(int side);
381 
382  static std::string get_side_color_id(unsigned side);
383  static const t_string get_side_color_name_for_UI(unsigned side);
384  static std::string get_side_color_id_from_config(const config& cfg);
385  static std::string get_side_highlight_pango(int side);
386 
387  void log_recruitable() const;
388 
389  /** clear the shroud, fog, and enemies cache for all teams*/
390  static void clear_caches();
391 
392  /** get the whiteboard planned actions for this team */
393  std::shared_ptr<wb::side_actions> get_side_actions() const { return planned_actions_; }
394 
395  config to_config() const;
396 
397  bool share_maps() const { return info_.share_vision != SHARE_VISION::NONE ; }
398  bool share_view() const { return info_.share_vision == SHARE_VISION::ALL; }
399  SHARE_VISION share_vision() const { return info_.share_vision; }
400 
401  void set_share_vision(const std::string& vision_status) {
402  info_.share_vision = SHARE_VISION::ALL;
403  info_.share_vision.parse(vision_status);
404  clear_caches();
405  }
406 
407  void set_share_vision(SHARE_VISION vision_status) {
408  info_.share_vision = vision_status;
409  clear_caches();
410  }
411 
413  {
414  info_.handle_legacy_share_vision(cfg);
415  }
416  std::string allied_human_teams() const;
417 
418  bool chose_random() const
419  {
420  return info_.chose_random;
421  }
422 
423 private:
424 
425  const std::vector<const shroud_map*>& ally_shroud(const std::vector<team>& teams) const;
426  const std::vector<const shroud_map*>& ally_fog(const std::vector<team>& teams) const;
427 
428  int gold_;
429  std::set<map_location> villages_;
430 
432  /** Stores hexes that have been cleared of fog via WML. */
433  std::set<map_location> fog_clearer_;
434 
436 
438 
439  mutable int countdown_time_;
441 
443  std::string last_recruit_;
444 
445 private:
446  void calculate_enemies(std::size_t index) const;
447  bool calculate_is_enemy(std::size_t index) const;
448  mutable boost::dynamic_bitset<> enemies_;
449 
450  mutable std::vector<const shroud_map*> ally_shroud_, ally_fog_;
451 
452  /**
453  * Whiteboard planned actions for this team.
454  */
455  std::shared_ptr<wb::side_actions> planned_actions_;
456 };
457 
458 //function which will validate a side. Throws game::game_error
459 //if the side is invalid
460 void validate_side(int side); //throw game::game_error
bool is_local_ai() const
Definition: team.hpp:276
void clear_proxy()
Definition: team.hpp:298
bool no_turn_confirmation() const
Definition: team.hpp:373
std::shared_ptr< wb::side_actions > get_side_actions() const
get the whiteboard planned actions for this team
Definition: team.hpp:393
std::string id
Definition: team.hpp:125
void change_controller(CONTROLLER controller)
Definition: team.hpp:287
bool enabled() const
Definition: team.hpp:91
bool allow_player
Definition: team.hpp:145
static const int default_team_gold_
Definition: team.hpp:166
void set_share_vision(SHARE_VISION vision_status)
Definition: team.hpp:407
void set_shroud(bool shroud)
Definition: team.hpp:334
void set_countdown_time(const int amount) const
Definition: team.hpp:219
bool no_turn_confirmation
Definition: team.hpp:149
bool is_empty() const
Definition: team.hpp:267
std::string last_recruit_
Definition: team.hpp:443
int countdown_time() const
Definition: team.hpp:218
void reset_objectives_changed() const
Definition: team.hpp:246
DEFEAT_CONDITION defeat_condition
Definition: team.hpp:138
void set_start_gold(const int amount)
Definition: team.hpp:215
void reshroud()
Definition: team.hpp:332
void toggle_droid()
Definition: team.hpp:302
void set_side_name(const t_string &new_name)
Definition: team.hpp:318
SHARE_VISION share_vision
Definition: team.hpp:143
int village_support
Definition: game_config.cpp:54
void make_droid()
Definition: team.hpp:295
void set_carryover_add(bool value)
Definition: team.hpp:364
bool persistent() const
Definition: team.hpp:357
CONTROLLER controller
Definition: team.hpp:136
int carryover_gold
Definition: team.hpp:161
bool is_network() const
Definition: team.hpp:270
const std::string & side_name() const
Definition: team.hpp:316
t_string side_name_tstr() const
Definition: team.hpp:317
bool clear_fog(const map_location &loc)
Definition: team.hpp:331
#define MAKE_ENUM(NAME, CONTENT)
Definition: make_enum.hpp:156
const std::string & flag() const
Definition: team.hpp:309
void handle_legacy_share_vision(const config &cfg)
Definition: team.hpp:412
int support_per_village
Definition: team.hpp:107
void refog()
Definition: team.hpp:333
bool carryover_add() const
Definition: team.hpp:365
t_string objectives
Definition: team.hpp:129
bool share_view() const
Definition: team.hpp:398
static const std::set< std::string > attributes
Stores the attributes recognized by [side].
Definition: team.hpp:176
bool is_idle() const
Definition: team.hpp:293
bool objectives_changed() const
Definition: team.hpp:249
void new_turn()
Definition: team.hpp:212
void clear(const std::string &key)
Definition: general.cpp:203
int wml_x() const
Definition: location.hpp:152
void set_recall_cost(int cost)
Definition: team.hpp:203
bool is_network_ai() const
Definition: team.hpp:278
void set_save_id(const std::string &save_id)
Definition: team.hpp:241
const std::string & save_id() const
Definition: team.hpp:239
int minimum_recruit_price
Definition: team.hpp:108
This class encapsulates the recall list of a team.
std::string save_id_or_number() const
Definition: team.hpp:240
t_string faction_name
Definition: team.hpp:115
std::shared_ptr< wb::side_actions > planned_actions_
Whiteboard planned actions for this team.
Definition: team.hpp:455
std::string flag_icon
Definition: team.hpp:123
void set_persistent(bool value)
Definition: team.hpp:358
void set_defeat_condition_string(const std::string &value)
sets the defeat condition if
Definition: team.hpp:353
bool objectives_changed
< Team&#39;s objectives for the current level.
Definition: team.hpp:134
void change_controller(const std::string &new_controller)
Definition: team.hpp:283
void set_share_vision(const std::string &vision_status)
Definition: team.hpp:401
void set_hidden(bool value)
Definition: team.hpp:356
void set_current_player(const std::string &player)
Definition: team.hpp:225
Definitions for the interface to Wesnoth Markup Language (WML).
std::string faction
Definition: team.hpp:114
double carryover_bonus() const
Definition: team.hpp:367
void set_carryover_percentage(int value)
Definition: team.hpp:362
int village_support() const
Definition: team.hpp:207
double carryover_bonus
Definition: team.hpp:160
const std::string & faction() const
Definition: team.hpp:319
void set_scroll_to_leader(bool value)
Definition: team.hpp:229
std::string flag_icon
bool uses_fog() const
Definition: team.hpp:327
void make_human()
Definition: team.hpp:281
int gold() const
Definition: team.hpp:197
shroud_map shroud_
Definition: team.hpp:431
int village_gold() const
Definition: team.hpp:200
void set_no_turn_confirmation(bool value)
Definition: team.hpp:374
bool fog()
Definition: game.cpp:533
void set_flag(const std::string &flag)
Definition: team.hpp:313
team_info info_
Definition: team.hpp:437
int action_bonus_count() const
Definition: team.hpp:221
std::string team_name
Definition: team.hpp:111
void write(std::ostream &out, const configr_of &cfg, unsigned int level)
Definition: parser.cpp:763
This class stores all the data for a single &#39;side&#39; (in game nomenclature).
Definition: team.hpp:44
SHARE_VISION share_vision() const
Definition: team.hpp:399
void set_carryover_bonus(double value)
Definition: team.hpp:366
void have_leader(bool value=true)
Definition: team.hpp:354
bool chose_random
Definition: team.hpp:146
PROXY_CONTROLLER proxy_controller
Definition: team.hpp:140
bool is_local
Definition: team.hpp:137
bool uses_shroud() const
Definition: team.hpp:326
bool is_droid() const
Definition: team.hpp:292
config variables
Definition: team.hpp:162
config & variables()
Definition: team.hpp:370
void read(config &cfg, std::istream &in, abstract_validator *validator)
Definition: parser.cpp:626
void set_defeat_condition(DEFEAT_CONDITION value)
Definition: team.hpp:351
int carryover_percentage() const
Definition: team.hpp:363
int wml_y() const
Definition: location.hpp:153
bool enabled_
Definition: team.hpp:94
void clear_villages()
Definition: team.hpp:191
void set_local(bool local)
Definition: team.hpp:280
void set_lost(bool value=true)
Definition: team.hpp:359
bool fog_or_shroud() const
Definition: team.hpp:328
Encapsulates the map of the game.
Definition: map.hpp:33
const t_string & faction_name() const
Definition: team.hpp:320
const std::string & last_recruit() const
Definition: team.hpp:236
void validate_side(int side)
Definition: team.cpp:757
void set_village_support(int support)
Definition: team.hpp:209
bool disallow_observers
Definition: team.hpp:144
bool is_enemy(int n) const
Definition: team.hpp:251
bool chose_random() const
Definition: team.hpp:418
void spend_gold(const int amount)
Definition: team.hpp:216
bool persistent
Definition: team.hpp:154
bool auto_shroud_updates_
Definition: team.hpp:435
void set_fog(bool fog)
Definition: team.hpp:335
void place_shroud(const map_location &loc)
Definition: team.hpp:330
boost::dynamic_bitset enemies_
Definition: team.hpp:448
bool no_leader() const
Definition: team.hpp:349
bool hidden() const
Definition: team.hpp:355
bool is_network_human() const
Definition: team.hpp:277
int recall_cost() const
Definition: team.hpp:201
Encapsulates the map of the game.
Definition: location.hpp:37
bool auto_shroud_updates() const
Definition: team.hpp:346
void set_village_gold(int income)
Definition: team.hpp:202
void make_proxy_human()
Definition: team.hpp:297
void set_carryover_gold(int value)
Definition: team.hpp:368
void make_ai()
Definition: team.hpp:282
bool is_proxy_human() const
Definition: team.hpp:291
int support() const
Calculate total support capacity, based on support_per_village.
Definition: team.hpp:211
bool shroud()
Definition: game.cpp:543
std::string current_player
Definition: team.hpp:118
int start_gold
Definition: team.hpp:104
bool fire_event(const ui_event event, std::vector< std::pair< widget *, ui_event >> &event_chain, widget *dispatcher, widget *w, F &&... params)
Helper function for fire_event.
void set_gold(int amount)
Definition: team.hpp:214
bool clear_shroud(const map_location &loc)
Definition: team.hpp:329
int carryover_percentage
Definition: team.hpp:157
Default, unset return value.
Definition: retval.hpp:31
int countdown_time_
Definition: team.hpp:439
void change_proxy(PROXY_CONTROLLER proxy)
Definition: team.hpp:300
void set_enabled(bool enabled)
Definition: team.hpp:92
std::set< map_location > villages_
Definition: team.hpp:429
const std::string & flag_icon() const
Definition: team.hpp:310
const t_string & objectives() const
Definition: team.hpp:248
std::string name
Definition: sdl_ttf.cpp:70
A color range definition is made of four reference RGB colors, used for calculating conversions from ...
Definition: color_range.hpp:48
const std::string & current_player() const
Definition: team.hpp:242
int recall_cost
Definition: team.hpp:109
DEFEAT_CONDITION defeat_condition() const
Definition: team.hpp:350
void set_flag_icon(const std::string &flag_icon)
Definition: team.hpp:314
void set_objectives_changed(bool c=true) const
Definition: team.hpp:245
std::size_t index(const std::string &str, const std::size_t index)
Codepoint index corresponding to the nth character in a UTF-8 string.
Definition: unicode.cpp:71
std::vector< const shroud_map * > ally_shroud_
Definition: team.hpp:450
recall_list_manager recall_list_
Definition: team.hpp:442
bool is_local() const
Definition: team.hpp:269
void toggle_idle()
Definition: team.hpp:303
int start_gold() const
Definition: team.hpp:198
bool get_disallow_observers() const
Definition: team.hpp:348
bool get_scroll_to_leader() const
Definition: team.hpp:228
const recall_list_manager & recall_list() const
Definition: team.hpp:224
bool is_human() const
Definition: team.hpp:272
bool empty() const
Definition: tstring.hpp:182
game_events::pump_result_t get_village(const map_location &loc, int side, bool *action_timebonus, bool fire_event)
Makes it so the village at the given location is owned by the given side.
Definition: move.cpp:139
bool is_local_human() const
Definition: team.hpp:275
const std::string & color() const
Definition: team.hpp:264
bool share_maps() const
Definition: team.hpp:397
std::set< map_location > fog_clearer_
Stores hexes that have been cleared of fog via WML.
Definition: team.hpp:433
t_string side_name
Definition: team.hpp:113
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:338
std::string color
Definition: team.hpp:151
int income_per_village
Definition: team.hpp:106
int gold_
Definition: team.hpp:428
t_string user_team_name
Definition: team.hpp:112
PROXY_CONTROLLER proxy_controller() const
Definition: team.hpp:290
bool carryover_add
Definition: team.hpp:158
int action_bonus_count_
Definition: team.hpp:440
int action_bonus_count
Definition: team.hpp:120
bool is_ai() const
Definition: team.hpp:273
void set_action_bonus_count(const int count)
Definition: team.hpp:222
std::vector< std::vector< bool > > data_
Definition: team.hpp:95
recall_list_manager & recall_list()
Definition: team.hpp:223
void add_fog_override(const std::set< map_location > &hexes)
Records hexes that were cleared of fog via WML.
Definition: team.hpp:342
std::set< std::string > can_recruit
Definition: team.hpp:110
void set_auto_shroud_updates(bool value)
Definition: team.hpp:347
int carryover_gold() const
Definition: team.hpp:369
std::string save_id
Definition: team.hpp:116
int base_income() const
Definition: team.hpp:199
std::unique_ptr< window > build(const builder_window::window_resolution &definition)
Builds a window.
const config & variables() const
Definition: team.hpp:371
void set_base_income(int amount)
Definition: team.hpp:217
std::tuple< bool, bool > pump_result_t
Definition: fwd.hpp:28
int side() const
Definition: team.hpp:196
bool owns_village(const map_location &loc) const
Definition: team.hpp:193
A config object defines a single node in a WML file, with access to child nodes.
Definition: config.hpp:59
mock_char c
void make_idle()
Definition: team.hpp:296
std::string flag
Definition: team.hpp:122
int total_income() const
Definition: team.hpp:204
static map_location::DIRECTION n
const std::set< map_location > & villages() const
Definition: team.hpp:192
Defines the MAKE_ENUM macro.
void last_recruit(const std::string &u_type)
Definition: team.hpp:237
std::string countdown_time
Definition: team.hpp:119
bool lost() const
Definition: team.hpp:360
Definition: display.hpp:48
const std::string & team_name() const
Definition: team.hpp:305
bool scroll_to_leader
Definition: team.hpp:127
const t_string & user_team_name() const
Definition: team.hpp:306
bool no_leader
Definition: team.hpp:147
const std::set< std::string > & recruits() const
Definition: team.hpp:231
void set_color(const std::string &color)
Definition: team.hpp:266
CONTROLLER controller() const
Definition: team.hpp:263