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