33 #include <boost/dynamic_bitset.hpp> 48 void place(
int x,
int y);
49 bool clear(
int x,
int y);
52 bool value(
int x,
int y)
const;
53 bool shared_value(
const std::vector<const shroud_map*>& maps,
int x,
int y)
const;
55 bool copy_from(
const std::vector<const shroud_map*>& maps);
57 std::string
write()
const;
58 void read(
const std::string& shroud_data);
59 void merge(
const std::string& shroud_data);
68 std::vector<std::vector<bool>>
data_;
143 void handle_legacy_share_vision(
const config& cfg);
162 void fix_villages(
const gamemap &map);
172 const std::set<map_location>&
villages()
const {
return villages_; }
174 {
return villages_.count(loc) > 0; }
176 int side()
const {
return info_.side; }
177 int gold()
const {
return gold_; }
193 void get_shared_maps();
200 { countdown_time_ = amount; }
206 { info_.current_player = player; }
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;
217 void last_recruit(
const std::string & u_type) { last_recruit_ = u_type; }
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; }
224 void set_objectives(
const t_string& new_objectives,
bool silently=
false);
232 const std::size_t
index = std::size_t(n-1);
233 if(index >= enemies_.size()) {
234 calculate_enemies(index);
236 if(index < enemies_.size()) {
237 return enemies_[
index];
244 const std::string&
color()
const {
return info_.color; }
246 void set_color(
const std::string& color) { info_.color = color; }
247 bool is_empty()
const {
return info_.controller == side_controller::type::none; }
249 bool is_local()
const {
return !is_empty() && info_.is_local; }
250 bool is_network()
const {
return !is_empty() && !info_.is_local; }
252 bool is_human()
const {
return info_.controller == side_controller::type::human; }
253 bool is_ai()
const {
return info_.controller == side_controller::type::ai; }
261 void make_human() { info_.controller = side_controller::type::human; }
262 void make_ai() { info_.controller = side_controller::type::ai; }
267 void change_controller_by_wml(
const std::string& new_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; }
274 void make_droid() { info_.proxy_controller = side_proxy_controller::type::ai; }
275 void make_idle() { info_.proxy_controller = side_proxy_controller::type::idle; }
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; }
284 const std::string&
team_name()
const {
return info_.team_name; }
286 void change_team(
const std::string &name,
const t_string &user_name);
288 const std::string&
flag()
const {
return info_.flag; }
289 const std::string&
flag_icon()
const {
return info_.flag_icon; }
295 const std::string&
side_name()
const {
return info_.side_name.empty() ? info_.current_player : info_.side_name.str(); }
298 const std::string&
faction()
const {
return info_.faction; }
320 bool knows_about_team(std::size_t
index)
const;
322 void add_fog_override(
const std::set<map_location> &hexes) { fog_clearer_.insert(hexes.begin(), hexes.end()); }
324 void remove_fog_override(
const std::set<map_location> &hexes);
335 bool hidden()
const {
return info_.hidden; }
339 void set_lost(
bool value=
true) { info_.lost = value; }
340 bool lost()
const {
return info_.lost; }
357 static const color_range get_side_color_range(
int side);
359 static color_t get_side_color(
int side);
360 static color_t get_minimap_color(
int side);
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);
367 void log_recruitable()
const;
370 static void clear_caches();
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; }
387 info_.share_vision = vision_status;
393 info_.handle_legacy_share_vision(cfg);
395 std::string allied_human_teams()
const;
399 return info_.chose_random;
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;
425 void calculate_enemies(std::size_t index)
const;
426 bool calculate_is_enemy(std::size_t index)
const;
bool no_turn_confirmation() const
std::shared_ptr< wb::side_actions > get_side_actions() const
get the whiteboard planned actions for this team
static const int default_team_gold_
side_proxy_controller::type proxy_controller
void set_shroud(bool shroud)
void set_countdown_time(const int amount) const
bool no_turn_confirmation
std::string last_recruit_
int countdown_time() const
void reset_objectives_changed() const
void set_start_gold(const int amount)
void set_side_name(const t_string &new_name)
void set_carryover_add(bool value)
std::vector< std::vector< bool > > data_
const std::string & side_name() const
t_string side_name_tstr() const
bool clear_fog(const map_location &loc)
const std::string & flag() const
void handle_legacy_share_vision(const config &cfg)
bool carryover_add() const
static const std::set< std::string > attributes
Stores the attributes recognized by [side].
bool objectives_changed() const
void set_share_vision(team_shared_vision::type vision_status)
void clear(const std::string &key)
void set_recall_cost(int cost)
bool is_network_ai() const
void set_save_id(const std::string &save_id)
const std::string & save_id() const
int minimum_recruit_price
This class encapsulates the recall list of a team.
std::string save_id_or_number() const
std::shared_ptr< wb::side_actions > planned_actions_
Whiteboard planned actions for this team.
void set_persistent(bool value)
void set_defeat_condition_string(const std::string &value)
sets the defeat condition if
bool objectives_changed
< Team's objectives for the current level.
void change_controller(const std::string &new_controller)
void set_share_vision(const std::string &vision_status)
void set_hidden(bool value)
void set_current_player(const std::string &player)
Definitions for the interface to Wesnoth Markup Language (WML).
double carryover_bonus() const
void set_carryover_percentage(int value)
int village_support() const
const std::string & faction() const
void set_scroll_to_leader(bool value)
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
void set_no_turn_confirmation(bool value)
void set_flag(const std::string &flag)
int action_bonus_count() const
void write(std::ostream &out, const configr_of &cfg, unsigned int level)
This class stores all the data for a single 'side' (in game nomenclature).
void change_controller(side_controller::type controller)
void set_carryover_bonus(double value)
void have_leader(bool value=true)
team_shared_vision::type share_vision() const
team_shared_vision::type share_vision
side_controller::type controller() const
void read(config &cfg, std::istream &in, abstract_validator *validator)
int carryover_percentage() const
void set_local(bool local)
void set_lost(bool value=true)
defeat_condition::type defeat_cond() const
bool fog_or_shroud() const
Encapsulates the map of the game.
const t_string & faction_name() const
The basic class for representing 8-bit RGB or RGBA colour values.
const std::string & last_recruit() const
void validate_side(int side)
void set_village_support(int support)
bool is_enemy(int n) const
bool chose_random() const
void spend_gold(const int amount)
bool auto_shroud_updates_
void place_shroud(const map_location &loc)
boost::dynamic_bitset enemies_
bool is_network_human() const
Encapsulates the map of the game.
bool auto_shroud_updates() const
void set_village_gold(int income)
void set_carryover_gold(int value)
bool is_proxy_human() const
int support() const
Calculate total support capacity, based on support_per_village.
void set_defeat_condition(defeat_condition::type value)
std::string current_player
void set_gold(int amount)
bool clear_shroud(const map_location &loc)
static constexpr std::optional< enum_type > get_enum(const std::string_view value)
Converts a string into its enum equivalent.
std::set< map_location > villages_
const std::string & flag_icon() const
void set_enabled(bool enabled)
const t_string & objectives() const
A color range definition is made of four reference RGB colors, used for calculating conversions from ...
const std::string & current_player() const
void set_flag_icon(const std::string &flag_icon)
void set_objectives_changed(bool c=true) const
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.
std::vector< const shroud_map * > ally_shroud_
recall_list_manager recall_list_
bool get_disallow_observers() const
bool get_scroll_to_leader() const
const recall_list_manager & recall_list() const
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.
bool is_local_human() const
const std::string & color() const
std::set< map_location > fog_clearer_
Stores hexes that have been cleared of fog via WML.
void merge_shroud_map_data(const std::string &shroud_data)
Merge a WML shroud map with the shroud data of this player.
void set_action_bonus_count(const int count)
recall_list_manager & recall_list()
void add_fog_override(const std::set< map_location > &hexes)
Records hexes that were cleared of fog via WML.
void change_proxy(side_proxy_controller::type proxy)
std::set< std::string > can_recruit
void set_auto_shroud_updates(bool value)
int carryover_gold() const
std::unique_ptr< window > build(const builder_window::window_resolution &definition)
Builds a window.
const config & variables() const
defeat_condition::type defeat_cond
side_proxy_controller::type proxy_controller() const
void set_base_income(int amount)
std::tuple< bool, bool > pump_result_t
bool owns_village(const map_location &loc) const
A config object defines a single node in a WML file, with access to child nodes.
side_controller::type controller
static map_location::DIRECTION n
const std::set< map_location > & villages() const
void last_recruit(const std::string &u_type)
std::string countdown_time
const std::string & team_name() const
const t_string & user_team_name() const
const std::set< std::string > & recruits() const
void set_color(const std::string &color)