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