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