104 struct conn_list *dest);
106 struct conn_list *dest);
108 struct conn_list *dest);
111 bool nationset_change);
128 struct player *barbarians = NULL;
147 bool someone_alive =
FALSE;
150 if (pteam_member->is_alive) {
151 someone_alive =
TRUE;
156 if (!someone_alive) {
165 _(
"The %s are no more!"),
174 if (pcity->original != pplayer && pcity->original != NULL
182 pcity->original,
"death-back_to_original");
191 log_verbose(
"Civil war strikes the remaining empire of %s",
198 log_verbose(
"The empire of %s is too small for civil war.",
225 barbarians,
"death-barbarians_get");
254 ptile->extras_owner = NULL;
278 return CLIP(34, maxrate, 100);
286 int tax,
int luxury,
int science)
291 log_error(
"received player_rates packet from %s before start",
294 _(
"Cannot change rates before game start."));
298 if (tax + luxury + science != 100) {
301 if (tax < 0 || tax > 100 || luxury < 0 || luxury > 100 || science < 0
306 if (tax > maxrate || luxury > maxrate || science > maxrate) {
311 }
else if (luxury > maxrate) {
314 rtype =
_(
"Science");
318 _(
"%s rate exceeds the max rate for %s."),
337 bool revolution_finished)
341 if (revolution_finished) {
353 if (revolution_finished) {
354 log_debug(
"Revolution finished for %s. Government is %s. "
361 _(
"%s now governs the %s as a %s."),
384 _(
"The tax rates for the %s are changed from "
385 "%3d%%/%3d%%/%3d%% (tax/luxury/science) to "
386 "%3d%%/%3d%%/%3d%%."),
388 save_tax, save_luxury, save_science,
423 max_turns =
MAX(1, max_turns);
444 _(
"You can't revolt without selecting target government."));
465 log_debug(
"Government changed for %s. Target government is %s; "
466 "old %s. Revofin %d, Turn %d.",
player_name(pplayer),
493 if (anarchy && turns <= 0
499 _(
"You can't revolt the same turn you finished previous revolution."));
508 log_debug(
"Revolution started for %s. Target government is %s. "
518 }
else if (turns > 0) {
522 PL_(
"The %s have incited a revolt! "
523 "%d turn of anarchy will ensue! "
524 "Target government is %s.",
525 "The %s have incited a revolt! "
526 "%d turns of anarchy will ensue! "
527 "Target government is %s.",
535 _(
"Revolution: returning to anarchy."));
542 log_debug(
"Government change complete for %s. Target government is %s; "
543 "now %s. Turn %d; revofin %d.",
player_name(pplayer),
576 log_debug(
"Update revolution for %s. Current government %s, "
577 "target %s, revofin %d, turn %d.",
player_name(pplayer),
596 _(
"You should choose a new government from the "
597 "government menu."));
615 struct city *primary_capital = NULL;
616 int same_value_count = 0;
621 if (value > max_value) {
623 primary_capital = pcity;
624 same_value_count = 1;
627 pcity->
capital = CAPITAL_SECONDARY;
628 }
else if (value > 0) {
630 pcity->capital = CAPITAL_SECONDARY;
631 if (value == max_value) {
634 if (
fc_rand(same_value_count) == 1) {
635 primary_capital = pcity;
644 if (primary_capital != NULL) {
645 primary_capital->
capital = CAPITAL_PRIMARY;
664 _(
"Tax rate exceeded the max rate; adjusted."));
668 _(
"Science rate exceeded the max rate; adjusted."));
672 _(
"Luxury rate exceeded the max rate; adjusted."));
687 const struct unit_list
689 const struct unit_list
690 *pplayer2_seen_units)
735 if (old_owner == pplayer2) {
737 }
else if (old_owner == pplayer) {
763 enum clause_type clause)
765 enum diplstate_type old_type;
766 enum diplstate_type new_type;
771 struct unit_list *pplayer_seen_units, *pplayer2_seen_units;
779 if (clause == CLAUSE_VISION) {
785 _(
"%s no longer gives us shared vision!"),
796 _(
"The senate will not allow you to break treaty "
797 "with the %s. You must either dissolve the senate "
798 "or wait until a more timely moment."),
817 if (old_type == DS_ALLIANCE) {
821 pplayer_seen_units = NULL;
822 pplayer2_seen_units = NULL;
826 ds_plrplr2->
type = ds_plr2plr->
type = new_type;
829 if (new_type == DS_WAR) {
836 if (old_type == DS_ALLIANCE) {
843 pplayer2_seen_units);
844 unit_list_destroy(pplayer_seen_units);
845 unit_list_destroy(pplayer2_seen_units);
855 _(
"The senate passes your bill because of the "
856 "constant provocations of the %s."),
858 }
else if (new_type == DS_WAR) {
860 _(
"The senate refuses to break treaty with the %s, "
861 "but you have no trouble finding a new senate."),
865 if (new_type == DS_WAR) {
884 _(
"The diplomatic state between the %s "
885 "and the %s is now %s."),
888 diplstate_type_translated_name(new_type));
890 _(
" %s canceled the diplomatic agreement! "
891 "The diplomatic state between the %s and the %s "
896 diplstate_type_translated_name(new_type));
900 if (other != pplayer && other != pplayer2
908 _(
"%s has attacked your ally %s! "
909 "You cancel your alliance to the aggressor."),
921 _(
"Your team mate %s declared war on %s. "
922 "You are obligated to cancel alliance with %s."),
936 struct conn_list *dest)
1021 struct conn_list *dest)
1035 if (NULL == pconn->playing && pconn->observer) {
1038 }
else if (NULL != pconn->playing) {
1076 struct conn_list *dest)
1088 if (NULL == pconn->playing && pconn->observer) {
1092 }
else if (NULL != pconn->playing) {
1134 if (music != NULL) {
1183 info_level =
MAX(min_info_level, info_level);
1185 info_level = min_info_level;
1211 highest_team_level = info_level;
1214 highest_team_level =
MAX(highest_team_level,
1219 if (plr->
rgb != NULL) {
1229 if (preferred != NULL) {
1318 packet->
mood = MOOD_COUNT;
1329 for (imp = 0; imp <
B_LAST; imp++) {
1371 info_level =
MAX(min_info_level, info_level);
1373 info_level = min_info_level;
1387 || (receiver && receiver == plr2)) {
1393 packet_ds->
type = DS_WAR;
1409 if (plr == receiver) {
1506 return pplayer->
rgb;
1526 log_error(
"Invalid value for 'game.server.plrcolormode' (%d)!",
1550 *reason =
_(
"Can only set player color prior to game start if "
1551 "'plrcolormode' is PLR_SET.");
1565 struct rgbcolor_list *spare_colors =
1582 rgbcolor_list_remove(spare_colors, prgbcolor);
1590 rgbcolor_list_destroy(spare_colors);
1603 rgbcolor_list_remove(spare_colors, ncol);
1614 if (needed > rgbcolor_list_size(spare_colors)) {
1615 log_verbose(
"Not enough unique colors for all players; there will be "
1619 rgbcolor_list_destroy(spare_colors);
1624 if (needed > rgbcolor_list_size(spare_colors)) {
1625 int i, origsize = rgbcolor_list_size(spare_colors);
1627 rgbcolor_list_shuffle(spare_colors);
1629 for (i = origsize; i < needed; i++) {
1630 rgbcolor_list_append(spare_colors,
1631 rgbcolor_list_get(spare_colors, i - origsize));
1635 rgbcolor_list_shuffle(spare_colors);
1639 if (!pplayer->rgb) {
1641 rgbcolor_list_pop_front(spare_colors);
1645 rgbcolor_list_destroy(spare_colors);
1655 if (prgbcolor != NULL) {
1661 pplayer->
rgb = NULL;
1674 static char buf[64];
1682 if (prgbcolor != NULL
1704 for (i = 0; i < sucount; i++) {
1709 if (utype != NULL) {
1725 bool allow_ai_type_fallbacking)
1734 if (NULL == pplayer) {
1738 if (allow_ai_type_fallbacking) {
1745 if (pplayer->
ai == NULL) {
1779 pslot = pplayer->
slot;
1784 _(
"You've been removed from the game!"));
1787 _(
"%s has been removed from the game."),
1796 while (conn_list_size(pplayer->
connections) > 0) {
1821 if (nationality != 0) {
1835 if (
is_ai(pplayer)) {
1888 int maxrate, surplus;
1901 if (economic->
luxury > maxrate) {
1902 surplus += economic->
luxury - maxrate;
1903 economic->
luxury = maxrate;
1905 if (economic->
tax > maxrate) {
1906 surplus += economic->
tax - maxrate;
1907 economic->
tax = maxrate;
1909 if (economic->
science > maxrate) {
1910 surplus += economic->
science - maxrate;
1916 while (surplus > 0) {
1917 if (economic->
science < maxrate) {
1919 }
else if (economic->
tax < maxrate) {
1920 economic->
tax += 10;
1921 }
else if (economic->
luxury < maxrate) {
1925 "maxrate = %d.", maxrate);
1936 const struct player *pplayer,
1938 const char *
name,
char *error_buf,
1939 size_t error_buf_len)
1942 if (0 == strlen(
name)) {
1943 fc_strlcpy(error_buf,
_(
"Please choose a non-blank name."),
1950 if (other_player == pplayer) {
1953 }
else if (NULL != pnation && other_player->nation == pnation) {
1956 fc_strlcpy(error_buf,
_(
"That nation is already in use."),
1961 _(
"Another player already has the name '%s'. Please "
1962 "choose another name."),
name);
1967 if (NULL == pnation) {
1970 pnation = pplayer->
nation;
1985 _(
"Please choose a name containing only ASCII characters."),
2001 char *error_buf,
size_t error_buf_len)
2008 if (NULL == error_buf) {
2010 error_buf_len =
sizeof(buf);
2012 error_buf[0] =
'\0';
2021 error_buf, error_buf_len)) {
2022 log_debug(
"Name of player nb %d set to \"%s\".",
2027 log_verbose(
"Failed to set the name of the player nb %d to \"%s\": %s",
2033 if (NULL != caller) {
2044 fc_snprintf(test,
sizeof(test),
"%s%d", real_name, i);
2046 test, error_buf, error_buf_len)) {
2047 log_verbose(
"Name of player nb %d set to \"%s\" instead.",
2052 log_debug(
"Failed to set the name of the player nb %d to \"%s\": %s",
2062 real_name, error_buf, error_buf_len)) {
2063 log_verbose(
"Name of player nb %d set to \"%s\".",
2068 log_debug(
"Failed to set the name of the player nb %d to \"%s\": %s",
2074 fc_snprintf(real_name,
sizeof(real_name),
_(
"Player no. %d"), i);
2076 real_name, error_buf, error_buf_len)) {
2082 log_debug(
"Failed to set the name of the player nb %d to \"%s\": %s",
2090 sizeof(pplayer->
name));
2099#ifndef FREECIV_NDEBUG
2113static enum diplstate_type
2115 const struct player *pplayer2)
2118 if (pplayer3 != pplayer1
2119 && pplayer3 != pplayer2
2137 if (pplayer1 == pplayer2
2151 if (ds_plr1plr2->
type == DS_NO_CONTACT) {
2159 _(
"You have made contact with the %s, ruled by %s."),
2163 _(
"You have made contact with the %s, ruled by %s."),
2170 if (
is_ai(pplayer1)) {
2173 if (
is_ai(pplayer2)) {
2213 log_debug(
"shuffle_players: creating shuffled order");
2215 for (i = 0; i <
n; i++) {
2223 for (i = 0; i <
n; i++) {
2236 log_debug(
"set_shuffled_players: loading shuffled array %p",
2255 log_debug(
"shuffled_player(%d) = %d (%s)",
2283 bool ignore_conflicts,
2284 bool needs_startpos,
2288 UNAVAILABLE, AVAILABLE, PREFERRED, UNWANTED
2291 int num_avail_nations = 0, num_pref_nations = 0;
2304 && pnation->server.no_startpos)
2311 nations_used[idx] = UNAVAILABLE;
2316 nations_used[idx] = AVAILABLE;
2326 log_debug(
"Nations '%s' (nb %d) and '%s' (nb %d) are in conflict.",
2330 nations_used[idx] = UNWANTED;
2331 match[idx] -= x * 100;
2334 match[idx] += x * 100;
2339 if (AVAILABLE == nations_used[idx]) {
2340 num_avail_nations += match[idx];
2346 if (NULL != choices) {
2349 if (nations_used[idx] == AVAILABLE) {
2350 num_pref_nations += match[idx];
2351 nations_used[idx] = PREFERRED;
2356 if (0 < num_pref_nations || 0 < num_avail_nations) {
2357 if (0 < num_pref_nations) {
2359 pick =
fc_rand(num_pref_nations);
2360 looking_for = PREFERRED;
2361 log_debug(
"Picking a preferred nation.");
2365 pick =
fc_rand(num_avail_nations);
2366 looking_for = AVAILABLE;
2367 log_debug(
"Picking an available nation.");
2372 if (nations_used[idx] == looking_for) {
2385 log_debug(
"Picking an unwanted nation.");
2388 if (UNWANTED == nations_used[idx]) {
2390 if (pick > less_worst_score) {
2391 less_worst_nation = pnation;
2392 less_worst_score = pick;
2398 return less_worst_nation;
2430 server.playable_nations = 0;
2433 server.playable_nations++;
2456 bool nationset_change)
2493 memset(misfits, 0,
sizeof(misfits));
2512 int i, least_misfits;
2518 least_misfits = misfits[0];
2519 for (i = 1; i < ncount && least_misfits != 0; i++) {
2520 if (best == NULL || misfits[i] < least_misfits) {
2522 least_misfits = misfits[i];
2526 log_verbose(
"Current nationset \"%s\" doesn't fit all existing players.",
2542 log_verbose(
"Nation %s of player %s not in nationset \"%s\", unsetting.",
2559 if (pplayer->is_ready) {
2565 case PERSISTENTR_DISABLED:
2568 case PERSISTENTR_CONNECTED:
2575 pplayer->is_ready =
FALSE;
2590 struct research *new_research, *old_research;
2649 if (other_player != pplayer) {
2699 if (pplayer->
team) {
2701 if (pplayer->
team == pdest->team
2702 && pplayer != pdest) {
2739 bool honour_server_option)
2747 n = city_list_size(pplayer->
cities);
2752 if (honour_server_option) {
2801 log_verbose(
"Civil war chance for %s: prob %d, dice %d",
2804 return (dice < prob);
2840 struct city_list *defector_candidates;
2852 log_normal(
_(
"Could not throw %s into civil war - too many players"),
2859 log_normal(
_(
"Could not throw %s into civil war - maxplayers (%d) reached"),
2864 if (plr_count >=
server.playable_nations) {
2866 log_normal(
_(
"Could not throw %s into civil war - no available nations"),
2875 defector_candidates = city_list_new();
2877 bool gameloss_present =
FALSE;
2888 gameloss_present =
TRUE;
2893 if (gameloss_present) {
2897 city_list_append(defector_candidates, pcity);
2900 if (city_list_size(defector_candidates) == 0) {
2901 log_verbose(
_(
"Could not throw %s into civil war - no available cities"),
2903 city_list_destroy(defector_candidates);
2923 _(
"Your nation is thrust into civil war."));
2927 _(
"%s is the rebellious leader of the %s."),
2931 j = city_list_size(defector_candidates);
2937 if (i >= j || (i > 0 &&
fc_rand(2) == 1)) {
2949 _(
"%s declares allegiance to the %s."),
2953 cplayer,
"civil_war");
2960 city_list_destroy(defector_candidates);
2964 i = city_list_size(cplayer->
cities);
2974 PL_(
"Civil war partitions the %s;"
2975 " the %s now hold %d city.",
2976 "Civil war partitions the %s;"
2977 " the %s now hold %d cities.",
3028 return server.nbarbarians;
3084 if (username == NULL || strlen(username) == 0) {
3115 _(
"User '%s' is currently allowed to take control of your "
3116 "player while you are away. Use '/delegate cancel' to "
3117 "revoke this access."),
3122 bool any_delegations =
FALSE;
3127 _(
"Control of player '%s' is delegated to you."),
3129 any_delegations =
TRUE;
3132 if (any_delegations) {
3136 _(
"Use '/delegate take <player>' to take control of a "
3137 "delegated player."));
3227 log_error(
"Bad number of multipliers %d from client for %s",
3232 for (i = 0; i < count; i++) {
3237 log_error(
"Multiplier value %d for %s out of range for %s",
3243 log_error(
"Multiplier value %d between valid values for %s for %s",
void adv_data_close(struct player *pplayer)
void adv_data_init(struct player *pplayer)
bool adv_data_phase_init(struct player *pplayer, bool is_new_phase)
void adv_data_default(struct player *pplayer)
const char * ai_name(const struct ai_type *ai)
const char * ai_type_name_or_fallback(const char *orig_name)
struct ai_type * ai_type_by_name(const char *search)
#define CALL_FUNC_EACH_AI(_func,...)
#define CALL_PLR_AI_FUNC(_func, _player,...)
void call_incident(enum incident_type type, enum casus_belli_range scope, const struct action *paction, struct player *violator, struct player *victim)
void ai_traits_close(struct player *pplayer)
struct player * create_barbarian_player(enum barbarian_type type)
#define BV_ISSET(bv, bit)
void citizens_nation_move(struct city *pcity, const struct player_slot *pslot_from, const struct player_slot *pslot_to, int move)
citizens citizens_nation_get(const struct city *pcity, const struct player_slot *pslot)
bool is_capital(const struct city *pcity)
const char * city_name_get(const struct city *pcity)
bool city_unhappy(const struct city *pcity)
bool city_celebrating(const struct city *pcity)
#define cities_iterate_end
#define city_list_iterate_safe(citylist, _city)
#define city_list_iterate(citylist, pcity)
#define city_tile(_pcity_)
#define cities_iterate(pcity)
#define city_owner(_pcity_)
#define city_list_iterate_end
#define city_list_iterate_safe_end
void city_refresh_queue_add(struct city *pcity)
void city_refresh_for_player(struct player *pplayer)
void city_refresh_queue_processing(void)
void connection_detach(struct connection *pconn, bool remove_unused_player)
#define conn_list_iterate(connlist, pconn)
#define conn_list_iterate_end
int player_culture(const struct player *plr)
struct unit struct city struct unit struct tile struct extra_type const struct act_prob *act_probs int actor_unit_id struct unit struct unit * punit
void set_ai_level_directer(struct player *pplayer, enum ai_level level)
void establish_embassy(struct player *pplayer, struct player *aplayer)
void reject_all_treaties(struct player *pplayer)
void set_diplstate_type(struct player_diplstate *state1, struct player_diplstate *state2, enum diplstate_type type)
void cancel_all_meetings(struct player *pplayer)
bool could_intel_with_player(const struct player *pplayer, const struct player *aplayer)
int get_city_bonus(const struct city *pcity, enum effect_type effect_type)
int get_player_bonus(const struct player *pplayer, enum effect_type effect_type)
#define MAX_NUM_PLAYER_SLOTS
#define PL_(String1, String2, n)
size_t featured_text_apply_tag(const char *text_source, char *featured_text, size_t featured_text_len, enum text_tag_type tag_type, ft_offset_t start_offset, ft_offset_t stop_offset,...)
const struct ft_color ftc_server
const char * city_link(const struct city *pcity)
const struct ft_color ftc_any
bool is_player_phase(const struct player *pplayer, int phase)
#define GAME_DEFAULT_REVOLUTION_LENGTH
#define GAME_MIN_CIVILWARSIZE
#define GAME_MAX_CIVILWARSIZE
struct unit_type * crole_to_unit_type(char crole, struct player *pplayer)
const char * government_name_translation(const struct government *pgovern)
bool untargeted_revolution_allowed(void)
Government_type_id government_count(void)
struct government * government_by_number(const Government_type_id gov)
struct government * government_of_player(const struct player *pplayer)
const char * government_name_for_player(const struct player *pplayer)
bool can_change_to_government(struct player *pplayer, const struct government *gov)
Government_type_id government_number(const struct government *pgovern)
const char * government_rule_name(const struct government *pgovern)
static GtkWidget * persistent
bool has_handicap(const struct player *pplayer, enum handicap_type htype)
void handicaps_init(struct player *pplayer)
void handicaps_close(struct player *pplayer)
struct impr_type * improvement_by_number(const Impr_type_id id)
bool wonder_visible_to_player(const struct impr_type *wonder, const struct player *pplayer, const struct player *owner)
#define fc_assert_msg(condition, message,...)
#define fc_assert_ret(condition)
#define log_verbose(message,...)
#define fc_assert(condition)
#define fc_assert_ret_val(condition, val)
#define fc_assert_action(condition, action)
#define log_debug(message,...)
#define log_normal(message,...)
#define log_error(message,...)
#define square_iterate(nmap, center_tile, radius, tile_itr)
#define square_iterate_end
#define whole_map_iterate(_map, _tile)
#define whole_map_iterate_end
void player_map_init(struct player *pplayer)
void map_claim_base(struct tile *ptile, struct extra_type *pextra, struct player *powner, struct player *ploser)
void map_claim_ownership(struct tile *ptile, struct player *powner, struct tile *psource, bool claim_bases)
void map_know_and_see_all(struct player *pplayer)
void give_map_from_player_to_player(struct player *pfrom, struct player *pdest)
void remove_shared_vision(struct player *pfrom, struct player *pto)
void player_map_free(struct player *pplayer)
void map_calculate_borders(void)
void remove_player_from_maps(struct player *pplayer)
enum mood_type player_mood(struct player *pplayer)
const char * multiplier_rule_name(const struct multiplier *pmul)
Multiplier_type_id multiplier_count(void)
bool multiplier_can_be_changed(struct multiplier *pmul, struct player *pplayer)
static struct multiplier multipliers[MAX_NUM_MULTIPLIERS]
struct multiplier * multiplier_by_number(Multiplier_type_id id)
Multiplier_type_id multiplier_index(const struct multiplier *pmul)
#define multipliers_iterate(_mul_)
#define multipliers_iterate_end
const char * nation_rule_name(const struct nation_type *pnation)
Nation_type_id nation_count(void)
Nation_type_id nation_number(const struct nation_type *pnation)
struct nation_leader * nation_leader_by_name(const struct nation_type *pnation, const char *name)
int nations_match(const struct nation_type *pnation1, const struct nation_type *pnation2, bool ignore_conflicts)
int nation_set_index(const struct nation_set *pset)
struct nation_type * nation_of_player(const struct player *pplayer)
bool is_nation_playable(const struct nation_type *nation)
const struct rgbcolor * nation_color(const struct nation_type *pnation)
bool nation_is_in_set(const struct nation_type *pnation, const struct nation_set *pset)
int nation_set_count(void)
struct nation_set * nation_set_by_number(int id)
struct nation_set * nation_set_by_setting_value(const char *setting)
Nation_type_id nation_index(const struct nation_type *pnation)
const char * nation_set_rule_name(const struct nation_set *pset)
enum barbarian_type nation_barbarian_type(const struct nation_type *nation)
const char * nation_plural_for_player(const struct player *pplayer)
struct government * init_government_of_nation(const struct nation_type *pnation)
#define nation_list_iterate(nationlist, pnation)
#define nation_sets_iterate_end
#define nation_sets_iterate(NAME_pset)
#define nations_iterate_end
#define nation_list_iterate_end
#define nations_iterate(NAME_pnation)
#define NO_NATION_SELECTED
void notify_player(const struct player *pplayer, const struct tile *ptile, enum event_type event, const struct ft_color color, const char *format,...)
void notify_conn(struct conn_list *dest, const struct tile *ptile, enum event_type event, const struct ft_color color, const char *format,...)
void generic_handle_player_attribute_chunk(struct player *pplayer, const struct packet_player_attribute_chunk *chunk)
void send_attribute_block(const struct player *pplayer, struct connection *pconn)
#define web_send_packet(packetname,...)
int dsend_packet_player_remove(struct connection *pc, int playerno)
int send_packet_player_diplstate(struct connection *pc, const struct packet_player_diplstate *packet)
int send_packet_player_info(struct connection *pc, const struct packet_player_info *packet)
void lsend_packet_nation_availability(struct conn_list *dest, const struct packet_nation_availability *packet)
bool player_slot_is_used(const struct player_slot *pslot)
struct player * player_new(struct player_slot *pslot)
struct player * player_by_number(const int player_id)
bool players_on_same_team(const struct player *pplayer1, const struct player *pplayer2)
enum diplstate_type cancel_pact_result(enum diplstate_type oldstate)
int player_slot_count(void)
struct player_slot * player_slot_by_number(int player_id)
int player_get_expected_income(const struct player *pplayer)
int player_number(const struct player *pplayer)
const char * player_name(const struct player *pplayer)
void player_clear(struct player *pplayer, bool full)
int player_slot_index(const struct player_slot *pslot)
bool player_has_real_embassy(const struct player *pplayer, const struct player *pplayer2)
bool team_has_embassy(const struct team *pteam, const struct player *tgt_player)
void player_set_color(struct player *pplayer, const struct rgbcolor *prgbcolor)
int player_index(const struct player *pplayer)
bool player_set_nation(struct player *pplayer, struct nation_type *pnation)
enum dipl_reason pplayer_can_cancel_treaty(const struct player *p1, const struct player *p2)
struct player_diplstate * player_diplstate_get(const struct player *plr1, const struct player *plr2)
bool pplayers_allied(const struct player *pplayer, const struct player *pplayer2)
bool gives_shared_vision(const struct player *me, const struct player *them)
void player_destroy(struct player *pplayer)
#define players_iterate_end
#define players_iterate(_pplayer)
#define player_list_iterate(playerlist, pplayer)
static bool is_barbarian(const struct player *pplayer)
#define player_list_iterate_end
#define set_as_human(plr)
#define players_iterate_alive_end
#define players_iterate_alive(_pplayer)
void handle_player_phase_done(struct player *pplayer, int turn)
void send_nation_availability(struct conn_list *dest, bool nationset_change)
void handle_player_multiplier(struct player *pplayer, int count, const int *multipliers)
void server_player_set_name(struct player *pplayer, const char *name)
int barbarian_count(void)
void send_player_all_c(struct player *src, struct conn_list *dest)
static void send_player_remove_info_c(const struct player_slot *pslot, struct conn_list *dest)
struct player * server_create_player(int player_id, const char *ai_tname, struct rgbcolor *prgbcolor, bool allow_ai_type_fallbacking)
const struct rgbcolor * player_preferred_color(struct player *pplayer)
void player_update_last_war_action(struct player *pplayer)
void handle_player_attribute_chunk(struct player *pplayer, const struct packet_player_attribute_chunk *chunk)
void player_status_add(struct player *plr, enum player_status pstatus)
int normal_player_count(void)
static void send_player_info_c_real(struct player *src, struct conn_list *dest)
static enum plr_info_level player_info_level(struct player *plr, struct player *receiver)
static void package_player_diplstate(struct player *plr1, struct player *plr2, struct packet_player_diplstate *packet_ds, struct player *receiver, enum plr_info_level min_info_level)
void player_set_under_human_control(struct player *pplayer)
static void maybe_claim_base(struct tile *ptile, struct player *new_owner, struct player *old_owner)
void playercolor_free(void)
static struct nation_set * current_nationset(void)
void give_midgame_initial_units(struct player *pplayer, struct tile *ptile)
static int get_player_maxrate(struct player *pplayer)
static void call_first_contact(struct player *pplayer, struct player *aplayer)
void player_limit_to_max_rates(struct player *pplayer)
bool civil_war_triggered(struct player *pplayer)
void server_player_set_color(struct player *pplayer, const struct rgbcolor *prgbcolor)
void player_set_to_ai_mode(struct player *pplayer, enum ai_level skill_level)
bool server_player_set_name_full(const struct connection *caller, struct player *pplayer, const struct nation_type *pnation, const char *name, char *error_buf, size_t error_buf_len)
bool player_delegation_active(const struct player *pplayer)
void player_info_thaw(void)
void player_info_freeze(void)
struct player * player_by_user_delegated(const char *name)
void maybe_make_contact(struct tile *ptile, struct player *pplayer)
void handle_player_attribute_block(struct player *pplayer)
static void send_nation_availability_real(struct conn_list *dest, bool nationset_change)
struct nation_type * pick_a_nation(const struct nation_list *choices, bool ignore_conflicts, bool needs_startpos, enum barbarian_type barb_type)
static enum diplstate_type get_default_diplstate(const struct player *pplayer1, const struct player *pplayer2)
void playercolor_init(void)
void check_player_max_rates(struct player *pplayer)
void kill_player(struct player *pplayer)
const char * player_color_ftstr(struct player *pplayer)
void send_player_info_c(struct player *src, struct conn_list *dest)
void set_shuffled_players(int *shuffled_players)
struct player * civil_war(struct player *pplayer)
static int shuffled_order[MAX_NUM_PLAYER_SLOTS]
void player_status_reset(struct player *plr)
void send_delegation_info(const struct connection *pconn)
void handle_player_change_government(struct player *pplayer, Government_type_id government)
struct conn_list * player_reply_dest(struct player *pplayer)
void update_players_after_alliance_breakup(struct player *pplayer, struct player *pplayer2, const struct unit_list *pplayer_seen_units, const struct unit_list *pplayer2_seen_units)
static int revolentype_length(enum revolen_type rltype, struct government *gov)
bool player_status_check(struct player *plr, enum player_status pstatus)
bool civil_war_possible(struct player *pplayer, bool conquering_city, bool honour_server_option)
struct rgbcolor * playercolor_get(int id)
void player_delegation_set(struct player *pplayer, const char *username)
static bool server_player_name_is_allowed(const struct connection *caller, const struct player *pplayer, const struct nation_type *pnation, const char *name, char *error_buf, size_t error_buf_len)
int playercolor_count(void)
void shuffle_players(void)
static void package_player_info(struct player *plr, struct packet_player_info *packet, struct packet_web_player_info_addition *web_packet, struct player *receiver, enum plr_info_level min_info_level)
void server_remove_player(struct player *pplayer)
void government_change(struct player *pplayer, struct government *gov, bool revolution_finished)
void server_player_init(struct player *pplayer, bool initmap, bool needs_team)
static void send_player_diplstate_c_real(struct player *src, struct conn_list *dest)
void handle_diplomacy_cancel_pact(struct player *pplayer, int other_player_id, enum clause_type clause)
void make_contact(struct player *pplayer1, struct player *pplayer2, struct tile *ptile)
void playercolor_add(struct rgbcolor *prgbcolor)
void update_capital(struct player *pplayer)
void count_playable_nations(void)
void handle_player_rates(struct player *pplayer, int tax, int luxury, int science)
bool player_color_changeable(const struct player *pplayer, const char **reason)
void assign_player_colors(void)
static void package_player_common(struct player *plr, struct packet_player_info *packet, struct packet_web_player_info_addition *web_packet)
bool client_can_pick_nation(const struct nation_type *pnation)
void send_player_diplstate_c(struct player *src, struct conn_list *dest)
static struct player * split_player(struct player *pplayer)
struct player * shuffled_player(int i)
const char * player_delegation_get(const struct player *pplayer)
bool nation_is_in_current_set(const struct nation_type *pnation)
void enter_war(struct player *pplayer, struct player *pplayer2)
static int player_info_frozen_level
int revolution_length(struct government *gov, struct player *plr)
void fit_nationset_to_players(void)
void reset_all_start_commands(bool plrchange)
void update_revolution(struct player *pplayer)
#define allowed_nations_iterate(pnation)
#define allowed_nations_iterate_end
enum tech_state research_invention_set(struct research *presearch, Tech_type_id tech, enum tech_state value)
int player_tech_upkeep(const struct player *pplayer)
struct research * research_get(const struct player *pplayer)
enum tech_state research_invention_state(const struct research *presearch, Tech_type_id tech)
void research_update(struct research *presearch)
void rgbcolor_destroy(struct rgbcolor *prgbcolor)
bool rgbcolors_are_equal(const struct rgbcolor *c1, const struct rgbcolor *c2)
bool rgbcolor_to_hex(const struct rgbcolor *prgbcolor, char *hex, size_t hex_len)
#define rgbcolor_list_iterate_end
#define rgbcolor_list_iterate(rgbcolorlist, prgbcolor)
void script_server_signal_emit(const char *signal_name,...)
void script_server_remove_exported_object(void *object)
void array_shuffle(int *array, int n)
bool is_ascii_name(const char *name)
void remove_leading_trailing_spaces(char *s)
#define CLIP(lower, current, upper)
void send_spaceship_info(struct player *src, struct conn_list *dest)
void spaceship_init(struct player_spaceship *ship)
void player_nation_defaults(struct player *pplayer, struct nation_type *pnation, bool set_name)
bool game_was_started(void)
void check_for_full_turn_done(void)
enum server_states server_state(void)
void set_ai_level_direct(struct player *pplayer, enum ai_level level)
enum capital_type capital
struct rgbcolor_list * plr_colors
struct civ_game::@30::@34 server
char start_units[MAX_LEN_STARTUNIT]
enum plrcolor_mode plrcolormode
struct conn_list * est_connections
struct packet_game_info info
struct packet_scenario_info scenario
char nationset[MAX_LEN_NAME]
struct government * government_during_revolution
enum cmdlevel access_level
char username[MAX_LEN_NAME]
enum barbarian_type barb_type
struct nation_type::@50::@52 server
enum gameloss_style gameloss_style
enum ai_level skill_level
enum revolen_type revolentype
int civil_war_bonus_unhappy
enum persistent_ready persistent_ready
int civil_war_bonus_celebrating
bool is_pickable[MAX_NUM_NATIONS]
enum ai_level ai_skill_level
int multiplier[MAX_NUM_MULTIPLIERS]
char username[MAX_LEN_NAME]
bv_player gives_shared_vision
int love[MAX_NUM_PLAYER_SLOTS]
Government_type_id target_government
int multiplier_target[MAX_NUM_MULTIPLIERS]
bool real_embassy[MAX_NUM_PLAYER_SLOTS]
int multiplier_changed[MAX_NUM_MULTIPLIERS]
enum barbarian_type barbarian_type
Government_type_id government
enum ai_level skill_level
enum barbarian_type barbarian_type
int love[MAX_NUM_PLAYER_SLOTS]
char has_reason_to_cancel
struct city_list * cities
struct player_ai ai_common
struct government * target_government
char username[MAX_LEN_NAME]
struct government * government
struct connection * current_conn
char * savegame_ai_type_name
const struct ai_type * ai
struct conn_list * connections
struct player_economic economic
char delegate_to[MAX_LEN_NAME]
struct player_spaceship spaceship
bv_player gives_shared_vision
struct player_score score
struct player_tile * private_map
struct multiplier_value multipliers[MAX_NUM_MULTIPLIERS]
bv_player really_gives_vision
struct nation_type * nation
struct nation_style * style
struct player_slot * slot
struct player::@69::@71 server
char orig_username[MAX_LEN_NAME]
int bulbs_researched_saved
struct research::research_invention inventions[A_ARRAY_SIZE]
Tech_type_id researching_saved
struct player * extras_owner
struct music_style * player_music_style(struct player *plr)
int music_style_number(const struct music_style *pms)
int style_number(const struct nation_style *pstyle)
int fc_snprintf(char *str, size_t n, const char *format,...)
size_t fc_strlcpy(char *dest, const char *src, size_t n)
int fc_strcasecmp(const char *str0, const char *str1)
int cat_snprintf(char *str, size_t n, const char *format,...)
#define sz_strlcpy(dest, src)
int team_number(const struct team *pteam)
bool team_add_player(struct player *pplayer, struct team *pteam)
const struct player_list * team_members(const struct team *pteam)
#define advance_index_iterate_end
#define advance_index_iterate(_start, _index)
bool tile_has_claimable_base(const struct tile *ptile, const struct unit_type *punittype)
struct city * tile_city(const struct tile *ptile)
#define tile_owner(_tile)
#define trade_routes_iterate_safe_end
#define trade_routes_iterate_safe(c, proute)
#define unit_list_iterate(unitlist, punit)
#define unit_list_iterate_safe(unitlist, _unit)
#define unit_list_iterate_end
#define unit_list_iterate_safe_end
const struct unit_type * unit_type_get(const struct unit *punit)
bool unit_has_type_flag(const struct unit *punit, enum unit_type_flag_id flag)
void send_updated_vote_totals(struct conn_list *dest)