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