29#ifdef HAVE_SYS_IOCTL_H
32#ifdef HAVE_SYS_TERMIO_H
33#include <sys/termio.h>
35#ifdef FREECIV_HAVE_SYS_TYPES_H
152 const struct player *pplayer,
156 const struct player *pplayer,
bool knowledge);
158 const struct player *pplayer,
161 const struct player *pplayer,
164 const struct player *pplayer,
206#ifdef FREECIV_TESTMATIC
258#ifdef FREECIV_JSON_CONNECTION
308 int emerg_version,
const char *distribution)
312 if (emerg_version > 0) {
313 log_debug(
"It's emergency release .%d", emerg_version);
315 if (strcmp(distribution,
"")) {
316 log_debug(
"It comes from %s distribution.", distribution);
355 int candidates, defeated;
374 pplayer->is_winner =
TRUE;
399 if ((pplayer)->is_alive
408 if (0 == candidates) {
422 const struct player_list *members =
team_members(pteam);
423 int team_candidates = 0, team_defeated = 0;
425 if (1 == player_list_size(members)) {
431 if (pplayer->is_alive
439 fc_assert(team_candidates + team_defeated
440 == player_list_size(members));
442 if (team_candidates == candidates && team_defeated < defeated) {
445 _(
"Team victory to %s."),
450 pplayer->is_winner =
TRUE;
460 struct player_list *winner_list = player_list_new();
471 player_list_destroy(winner_list);
477 if (NULL == winner_list) {
480 player_list_append(winner_list, pplayer);
483 if (NULL != winner_list) {
486 fc_assert(candidates == player_list_size(winner_list));
500 pplayer->is_winner =
TRUE;
507 player_list_destroy(winner_list);
513 if (1 == candidates && NULL != victor) {
517 if (pplayer != victor
519 && (!pplayer->is_alive
531 _(
"Game ended in conquest victory for %s."),
player_name(victor));
541 struct player *best = NULL;
543 int second_value = -1;
554 }
else if (pplayer->score.culture > second_value) {
555 second_value = pplayer->score.culture;
562 _(
"Game ended in cultural domination victory for %s."),
564 log_normal(
_(
"Game ended in cultural domination victory for %s."),
575 _(
"Game ended as the turn limit was exceeded."));
576 log_normal(
_(
"Game ended as the turn limit was exceeded."));
581 _(
"Notice: game will end at the end of this turn due "
582 "to 'endturn' server setting."));
595 for (i = 0; i <
n; i++) {
596 struct player *pplayer = arrivals[i];
597 const struct player_list *members;
632 if (1 < player_list_size(members)) {
634 _(
"Team victory to %s."),
638 pteammate->is_winner =
TRUE;
642 _(
"Game ended in victory for %s."),
player_name(pplayer));
656 const struct player *pplayer = arrivals[i];
668 _(
"Notice: the %s spaceship will likely arrive at "
669 "Alpha Centauri next turn."),
760 bool new_border_vision;
765 if (new_border_vision != plr->server.border_vision) {
778 int *current,
int *accum,
int *
level,
780 void (*upset_action_fn)(
int))
795 *current = (count * percent) / 100;
797 if (*accum < *
level) {
808 log_debug(
"environmental_upset: type=%-4d current=%-2d "
809 "level=%-2d accum=%-2d",
type, *current, *
level, *accum);
820 struct unit *a_unit = NULL;
833 PL_(
"Warning: you still have %d military unit in %s territory.",
834 "Warning: you still have %d military units in %s territory.",
842 PL_(
"%s Any such units will be disbanded in %d turn, "
843 "in accordance with peace treaty.",
844 "%s Any such units will be disbanded in %d turns, "
845 "in accordance with peace treaty.", turns_left),
862 _(
"Your %s was disbanded in accordance with "
863 "your peace treaty with the %s."),
873 _(
"Your %s was disbanded in accordance with "
874 "your peace treaty with the %s."),
902 if (state->
type == DS_ARMISTICE
908 state->
type = DS_PEACE;
909 state2->
type = DS_PEACE;
918 if (state->
type == DS_CEASEFIRE) {
923 _(
"Concerned citizens point out that the cease-fire "
932 _(
"The cease-fire with %s has run out. "
933 "You are now at war with the %s."),
937 _(
"The cease-fire with %s has run out. "
938 "You are now at war with the %s."),
941 state->
type = DS_WAR;
942 state2->
type = DS_WAR;
954 if (plr3 != plr1 && plr3 != plr2
977 _(
"The cease-fire between %s and %s has run out. "
978 "They are at war. You cancel your alliance "
980 plr1name, plr2name, plr2name);
987 _(
"The cease-fire between %s and %s has run out. "
988 "They are at war. You cancel your alliance "
990 plr1name, plr2name, plr1name);
997 _(
"The cease-fire between %s and %s has run out. "
998 "They are at war. You cancel your alliance "
1050 bool voter_died =
FALSE;
1054 if (0 == city_list_size(pplayer->cities)
1055 && 0 == unit_list_size(pplayer->units)) {
1061 voter_died = voter_died || pplayer->is_connected;
1077 if (
is_ai(pplayer)) {
1105 case PMT_CONCURRENT:
1108 case PMT_PLAYERS_ALTERNATE:
1111 case PMT_TEAMS_ALTERNATE:
1115 log_error(
"Unrecognized phase mode %d in begin_turn().",
1161 if (pplayer->unassigned_ranked
1163 && pplayer->is_alive) {
1164 sz_strlcpy(pplayer->ranked_username, pplayer->username);
1165 pplayer->unassigned_ranked = pplayer->unassigned_user;
1205 pplayer->phase_done =
FALSE;
1207 pplayer->ai_phase_done =
FALSE;
1231 if (ptile->placing != NULL) {
1239 if (pcity != NULL) {
1244 if (
owner == NULL) {
1246 ptile->placing = NULL;
1251 ptile->infra_turns--;
1252 if (ptile->infra_turns <= 0) {
1254 ptile->placing = NULL;
1299 log_debug(
"beginning player turn for #%d (%s)",
1321 if (
is_ai(pplayer)) {
1330 if (
is_ai(pplayer)) {
1381 if (pplayer->multipliers[idx].value != pmul->def) {
1383 _(
"%s restored to the default value %d"),
1386 pplayer->multipliers[idx].value = pmul->def;
1390 if (pplayer->multipliers[idx].value != pplayer->multipliers[idx].target) {
1392 _(
"%s now at value %d"),
1394 pplayer->multipliers[idx].target);
1396 pplayer->multipliers[idx].value = pplayer->multipliers[idx].target;
1432 if (
is_ai(pplayer)) {
1452 if (!pplayer->is_alive) {
1462 _(
"Automatically placed spaceship parts that were still not placed."));
1520 if (NULL == pconn->playing) {
1534 int food = 0, shields = 0, trade = 0, settlers = 0;
1548 food += pcity->prod[
O_FOOD];
1549 trade += pcity->prod[
O_TRADE];
1552 log_debug(
"%s T%d cities:%d pop:%d food:%d prod:%d "
1553 "trade:%d settlers:%d units:%d",
player_name(pplayer),
1556 settlers, unit_list_size(pplayer->units));
1585 struct player_list *achievers = player_list_new();
1592 if (
first != NULL) {
1609 if (pplayer !=
first) {
1621 player_list_destroy(achievers);
1646 &&
fc_rand(10000) < pextra->disappearance_chance
1658 _(
"%s disappears from %s."),
1673 &&
fc_rand(10000) < pextra->appearance_chance
1686 _(
"%s appears to %s."),
1708 pplayer->turns_alive++;
1735 const char *reason_filename = NULL;
1743 reason_filename = NULL;
1746 reason_filename =
"final";
1749 reason_filename =
"quitidle";
1752 reason_filename =
"interrupted";
1755 reason_filename =
"timer";
1782 if (pconn->access_level == ALLOW_CTRL) {
1784 _(
"%s lost control cmdlevel on "
1785 "game start. Use voting from now on."),
1884 struct conn_list *dest = pconn->
self;
1887 log_error(
"Got a report request %d before game start",
type);
1892 log_error(
"Got a report request %d from detached connection",
type);
1912 _(
"request for unknown report (type %d)"),
type);
1945 return server.identity_number;
1961 "Exhausted city and unit numbers!");
1965 return server.identity_number;
1999 unsigned char buffer[4096];
2013 _(
"Your client is too old. To use this server, "
2014 "please upgrade your client to a "
2015 "Freeciv 2.2 or later."));
2051 log_error(
"Received game packet %s(%d) from unaccepted connection %s.",
2072 _(
"You are not allowed to edit."));
2077 log_error(
"Received unknown packet %d from %s.",
2085 if (NULL == pplayer || pconn->
observer) {
2091 log_error(
"Received packet %s(%d) from non-player connection %s.",
2103 log_debug(
"Got a packet of type %s(%d) in %s.",
2106 log_error(
"Got a packet of type %s(%d) outside %s.",
2115 log_error(
"Got a packet of type %s(%d) from a dead player.",
2124 log_error(
"Received unknown packet %d from %s.",
2147 bool connected =
FALSE;
2164 if (pplayer->is_connected && (
is_human(pplayer) || pplayer->phase_done)) {
2175 if (!pplayer->phase_done && pplayer->is_alive) {
2176 if (pplayer->is_connected) {
2185 if (
is_ai(pplayer) && !pplayer->ai_phase_done) {
2206 if (pnation->player->nation == pnation) {
2209 pnation->server.no_startpos = FALSE;
2211 }
else if (NULL != pnation->player->nation) {
2214 pnation->player->nation->player = NULL;
2215 pnation->player = NULL;
2219 pnation->player = NULL;
2220 },
"Player assigned to nation before %s()!", __FUNCTION__);
2225 pnation->server.no_startpos =
FALSE;
2231 pnation->server.no_startpos =
TRUE;
2240 pnation->server.no_startpos =
FALSE;
2249 pnation->server.no_startpos =
FALSE;
2261 const char *
name,
int style)
2282 _(
"%s nation is not available for user selection."),
2286 if (new_nation->
player && new_nation->
player != pplayer) {
2288 _(
"%s nation is already in use."),
2304 _(
"%s is the %s ruler %s."),
2311 }
else if (
name[0] ==
'\0') {
2347 if (NULL == pplayer || S_S_INITIAL !=
server_state()) {
2351 if (pplayer != requestor) {
2366 int num_ready = 0, num_unready = 0;
2369 if (other_player->is_connected) {
2370 if (other_player->is_ready) {
2378 if (num_unready > 0) {
2380 _(
"Waiting to start game: %d out of %d alive players "
2381 "are ready to start."),
2382 num_ready, num_ready + num_unready);
2397 char *limitreason = NULL;
2405 if (limit < amount) {
2406 limitreason =
_(
"requested more than 'maxplayers' setting");
2410 if (limit >
server.playable_nations) {
2411 limit =
server.playable_nations;
2413 limitreason =
_(
"not enough playable nations in this nation set "
2414 "(see 'nationset' setting)");
2416 limitreason =
_(
"not enough playable nations");
2470 log_normal(
_(
"%s has been added as %s level AI-controlled player (%s)."),
2475 _(
"%s has been added as %s level AI-controlled player (%s)."),
2489#define SPECHASH_TAG startpos
2490#define SPECHASH_IKEY_TYPE struct startpos *
2491#define SPECHASH_INT_DATA_TYPE
2493#define startpos_hash_iterate(hash, psp, c) \
2494 TYPED_HASH_ITERATE(struct startpos *, intptr_t, hash, psp, c)
2495#define startpos_hash_iterate_end HASH_ITERATE_END
2563 int nations_to_assign = 0;
2583 struct nation_list *candidates = nation_list_new();
2589 && NULL == pnation->player
2591 nation_list_append(candidates, pnation);
2597 nation_list_get(candidates,
fc_rand(
n)));
2599 nation_list_destroy(candidates);
2604 nations_to_assign++;
2612 struct startpos_hash *
hash = startpos_hash_new();
2633 startpos_hash_insert(
hash, psp, c);
2653 || NULL != pnation->player) {
2669 }
else if (val == min && 0 ==
fc_rand(++i)) {
2679 nations_to_assign--;
2684 startpos_hash_replace(
hash, psp, val + 1);
2695 startpos_hash_destroy(
hash);
2698 if (0 < nations_to_assign) {
2706 bool needs_startpos =
TRUE;
2712 needs_startpos =
FALSE;
2717 nations_to_assign--;
2735 const char *choice = NULL;
2736 struct nation_leader_list *candidates = nation_leader_list_new();
2744 nation_leader_list_append(candidates, pleader);
2748 n = nation_leader_list_size(candidates);
2753 nation_leader_list_destroy(candidates);
2790 log_verbose(
"srv_running() mostly redundant send_server_settings()");
2830 if (need_send_pending_events) {
2837 need_send_pending_events =
FALSE;
2851 log_verbose(
"End/start-turn server/ai activities: %g seconds",
2872 if (pmapdef != NULL) {
2880 skip_mapimg =
FALSE;
2970 "authentication support, but it's currently not "
2990#if IS_BETA_VERSION || IS_DEVEL_VERSION
3026 const char *testfilename;
3029 if (testfilename == NULL) {
3051 con_write(
C_FAIL,
_(
"Not starting without explicitly requested metaserver connection."));
3074 _(
"The game is over..."));
3102 pplayer->revolution_finishes = 0;
3108 pplayer->multipliers[midx].value
3109 = pplayer->multipliers[midx].target
3124 if (!pplayer->is_connected &&
is_human(pplayer)) {
3159 } mapgen_settings[] = {
3162 {
"teamplacement", }
3169 int max = retry_ok ? 3 : 1;
3170 bool created =
FALSE;
3175 for (i = 0; utype == NULL && i < sucount; i++) {
3185 for (i = 0; i <
ARRAY_SIZE(mapgen_settings); i++) {
3190 mapgen_settings[i].
value,
3191 sizeof(mapgen_settings[i].
value));
3193 mapgen_settings[i].pretty,
3194 sizeof(mapgen_settings[i].pretty));
3197 for (i = 0; !created && i < max ; i++) {
3199 if (!created && max > 1) {
3207 log_normal(
_(
"Failed to create suitable map, retrying with another mapseed."));
3221 for (set = 0; set <
ARRAY_SIZE(mapgen_settings); set++) {
3223#ifdef FREECIV_NDEBUG
3231 NULL, error,
sizeof(error));
3233 "Failed to restore '%s': %s",
3234 mapgen_settings[set].
name,
3254 for (i = 0; i <
ARRAY_SIZE(mapgen_settings); i++) {
3256 char pretty[
sizeof(mapgen_settings[i].pretty)];
3261 mapgen_settings[i].pretty)) {
3265 _(
"Setting '%s' has been adjusted from %s to %s."),
3267 mapgen_settings[i].pretty,
3269 log_normal(
_(
"Setting '%s' has been adjusted from %s to %s."),
3271 mapgen_settings[i].pretty,
3337 if (
is_ai(pplayer)) {
3385 server.playable_nations = 0;
3427 pcity->server.vision->
radius_sq[v] = -1;
3430 pcity->server.vision = NULL;
3470 log_normal(
_(
"Now accepting new client connections on port %d."),
3527 const struct player *pplayer)
3560 log_error(
"No server setting with the id %d exists.",
id);
3575 log_error(
"No server setting with the id %d exists.",
id);
3576 return sset_type_invalid();
3590 log_error(
"No server setting with the id %d exists.",
id);
3605 log_error(
"No server setting with the id %d exists.",
id);
3620 log_error(
"No server setting with the id %d exists.",
id);
3654 const struct player *pplayer,
3657 if (knowledge && pplayer) {
3669 const struct player *pplayer,
bool knowledge)
3671 if (knowledge && pplayer) {
3683 const struct player *pplayer,
3686 if (knowledge && pplayer
3689 return plrtile->
owner;
3699 const struct player *pplayer,
3708 if (knowledge && pplayer) {
3712 return pdcity->
owner;
3725 const struct player *pplayer,
3728 int unit_count = unit_list_size(ptile->
units);
3730 if (unit_count == 0) {
3734 if (knowledge && pplayer
int achievement_index(const struct achievement *pach)
struct player * achievement_plr(struct achievement *ach, struct player_list *achievers)
const char * achievement_later_msg(struct achievement *pach)
const char * achievement_first_msg(struct achievement *pach)
#define achievements_iterate_end
#define achievements_iterate(_ach_)
void building_advisor(struct player *pplayer)
void adv_data_analyze_rulesets(struct player *pplayer)
bool adv_data_phase_init(struct player *pplayer, bool is_new_phase)
void adv_data_phase_done(struct player *pplayer)
void adv_data_default(struct player *pplayer)
bool adv_spaceship_autoplace(struct player *pplayer, struct player_spaceship *ship)
const char * ai_name(const struct ai_type *ai)
#define ai_timer_free(...)
#define CALL_FUNC_EACH_AI(_func,...)
#define ai_timer_init(...)
#define CALL_PLR_AI_FUNC(_func, _player,...)
const char * default_ai_type_name(void)
void ai_traits_init(struct player *pplayer)
void create_animals(void)
void astr_free(struct astring *astr)
void astr_set(struct astring *astr, const char *format,...)
void astr_init(struct astring *astr)
void astr_add(struct astring *astr, const char *format,...)
static const char * astr_str(const struct astring *astr) fc__attribute((nonnull(1)))
bool auth_handle_reply(struct connection *pconn, char *password)
void auto_settlers_player(struct player *pplayer)
void adv_settlers_free(void)
void summon_barbarians(void)
#define BV_ISSET(bv, bit)
void bugreport_request(const char *reason_format,...)
void game_advance_year(void)
void game_next_year(struct packet_game_info *info)
struct canvas int int struct sprite bool int int fog_y struct canvas struct sprite struct color * pcolor
void free_city_map_index(void)
#define cities_iterate_end
#define city_list_iterate(citylist, pcity)
#define cities_iterate(pcity)
#define city_owner(_pcity_)
#define city_list_iterate_end
bool check_city_migrations(void)
void send_city_turn_notifications(struct connection *pconn)
void update_city_activities(struct player *pplayer)
void city_tc_effect_refresh(struct player *pplayer)
void check_disasters(void)
bool handle_login_request(struct connection *pconn, struct packet_server_join_req *req)
void conn_set_access(struct connection *pconn, enum cmdlevel new_level, bool granted)
void conn_list_do_unbuffer(struct conn_list *dest)
bool can_conn_edit(const struct connection *pconn)
void conn_list_compression_thaw(const struct conn_list *pconn_list)
void conn_list_do_buffer(struct conn_list *dest)
void conn_list_compression_freeze(const struct conn_list *pconn_list)
bool conn_controls_player(const struct connection *pconn)
const char * conn_description(const struct connection *pconn)
bool connection_send_data(struct connection *pconn, const unsigned char *data, int len)
#define conn_list_iterate(connlist, pconn)
#define conn_list_iterate_end
void con_log_init(const char *log_filename, enum log_level level, int fatal_assertions)
void con_write(enum rfc_status rfc_status, const char *message,...)
void con_puts(enum rfc_status rfc_status, const char *str)
int nation_history_gain(const struct player *pplayer)
void dio_output_init(struct raw_data_out *dout, void *destination, size_t dest_size)
void dio_put_uint16_raw(struct raw_data_out *dout, int value)
void dio_put_uint8_raw(struct raw_data_out *dout, int value)
void dio_put_string_raw(struct raw_data_out *dout, const char *value)
size_t dio_output_used(struct raw_data_out *dout)
void dio_put_bool32_raw(struct raw_data_out *dout, bool value)
void dio_output_rewind(struct raw_data_out *dout)
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 send_diplomatic_meetings(struct connection *dest)
void set_diplstate_type(struct player_diplstate *state1, struct player_diplstate *state2, enum diplstate_type type)
int get_unit_bonus(const struct unit *punit, enum effect_type effect_type)
int get_player_bonus(const struct player *pplayer, enum effect_type effect_type)
void cmdline_option_values_free(void)
void libfreeciv_init(bool check_fc_interface)
void libfreeciv_free(void)
struct functions * fc_interface_funcs(void)
#define MAX_NUM_PLAYER_SLOTS
#define IDENTITY_NUMBER_ZERO
bool fcdb_init(const char *conf_file)
const char * get_internal_encoding(void)
static char void init_character_encodings(const char *my_internal_encoding, bool my_use_transliteration)
#define FC_DEFAULT_DATA_ENCODING
const char * get_locale_dir(void)
#define bindtextdomain(Package, Directory)
#define PL_(String1, String2, n)
void fc_destroy_mutex(fc_mutex *mutex)
void fc_init_mutex(fc_mutex *mutex)
const char * tile_link(const struct tile *ptile)
const struct ft_color ftc_server
const struct ft_color ftc_editor
const char * unit_tile_link(const struct unit *punit)
bool is_player_phase(const struct player *pplayer, int phase)
int current_turn_timeout(void)
void game_init(bool keep_ruleset_value)
int generate_save_name(const char *format, char *buf, int buflen, const char *reason)
#define TURNS_NEEDED_TO_RANK
void send_year_to_clients(void)
void send_game_info(struct conn_list *dest)
struct unit_type * crole_to_unit_type(char crole, struct player *pplayer)
static char * leader_name
static struct gui_funcs funcs
bool server_handle_packet(enum packet_type type, const void *packet, struct player *pplayer, struct connection *pconn)
void handle_conn_pong(struct connection *pc)
void handle_diplomacy_cancel_pact(struct player *pplayer, int other_player_id, enum clause_type clause)
void adv_city_free(struct city *pcity)
#define fc_assert_msg(condition, message,...)
#define fc_assert_ret(condition)
#define fc_assert_exit_msg(condition, message,...)
#define log_verbose(message,...)
#define fc_assert(condition)
#define fc_assert_action_msg(condition, action, message,...)
#define log_fatal(message,...)
#define fc_assert_action(condition, action)
#define log_debug(message,...)
#define log_normal(message,...)
#define log_error(message,...)
#define log_testmatic(message,...)
bool startpos_nation_allowed(const struct startpos *psp, const struct nation_type *pnation)
bool startpos_allows_all(const struct startpos *psp)
void main_map_allocate(void)
int map_startpos_count(void)
#define map_startpos_iterate(NAME_psp)
#define map_startpos_iterate_end
#define whole_map_iterate(_map, _tile)
#define whole_map_iterate_end
bool map_fractal_generate(bool autosize, struct unit_type *initial_unit)
void generator_free(void)
void player_map_init(struct player *pplayer)
void map_set_border_vision(struct player *pplayer, const bool is_enabled)
void send_map_info(struct conn_list *dest)
void destroy_extra(struct tile *ptile, struct extra_type *pextra)
void disable_fog_of_war(void)
void show_map_to_all(void)
void send_all_known_tiles(struct conn_list *dest)
struct vision_site * map_get_player_city(const struct tile *ptile, const struct player *pplayer)
void enable_fog_of_war(void)
void create_extra(struct tile *ptile, struct extra_type *pextra, struct player *pplayer)
void map_show_all(struct player *pplayer)
void map_show_tile(struct player *src_player, struct tile *ptile)
void nuclear_winter(int effect)
void tile_change_side_effects(struct tile *ptile, bool refresh_city)
bool map_is_known_and_seen(const struct tile *ptile, const struct player *pplayer, enum vision_layer vlayer)
void map_calculate_borders(void)
void update_tile_knowledge(struct tile *ptile)
void give_shared_vision(struct player *pfrom, struct player *pto)
void global_warming(int effect)
struct player_tile * map_get_player_tile(const struct tile *ptile, const struct player *pplayer)
struct mapdef * mapimg_isvalid(int id)
void mapimg_init(mapimg_tile_known_func mapimg_tile_known, mapimg_tile_terrain_func mapimg_tile_terrain, mapimg_tile_player_func mapimg_tile_owner, mapimg_tile_player_func mapimg_tile_city, mapimg_tile_player_func mapimg_tile_unit, mapimg_plrcolor_count_func mapimg_plrcolor_count, mapimg_plrcolor_get_func mapimg_plrcolor_get)
bool mapimg_create(struct mapdef *pmapdef, bool force, const char *savename, const char *path)
const char * mapimg_error(void)
const char * multiplier_name_translation(const struct multiplier *pmul)
bool multiplier_can_be_changed(struct multiplier *pmul, struct player *pplayer)
Multiplier_type_id multiplier_index(const struct multiplier *pmul)
#define multipliers_iterate(_mul_)
#define multipliers_iterate_end
struct nation_leader * nation_leader_by_name(const struct nation_type *pnation, const char *name)
bool nation_leader_is_male(const struct nation_leader *pleader)
const char * nation_adjective_for_player(const struct player *pplayer)
const char * nation_adjective_translation(const struct nation_type *pnation)
struct nation_type * nation_by_number(const Nation_type_id nation)
const struct nation_leader_list * nation_leaders(const struct nation_type *pnation)
struct nation_type * nation_of_player(const struct player *pplayer)
bool is_nation_playable(const struct nation_type *nation)
int nation_set_count(void)
bool can_conn_edit_players_nation(const struct connection *pconn, const struct player *pplayer)
const char * nation_leader_name(const struct nation_leader *pleader)
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)
struct nation_style * style_of_nation(const struct nation_type *pnation)
#define nation_leader_list_iterate(leaderlist, pleader)
#define nations_iterate_end
#define nations_iterate(NAME_pnation)
#define nation_leader_list_iterate_end
#define NO_NATION_SELECTED
void fc_init_network(void)
void notify_player(const struct player *pplayer, const struct tile *ptile, enum event_type event, const struct ft_color color, const char *format,...)
void event_cache_remove_old(void)
void send_pending_events(struct connection *pconn, bool include_public)
void notify_conn(struct conn_list *dest, const struct tile *ptile, enum event_type event, const struct ft_color color, const char *format,...)
void event_cache_clear(void)
void event_cache_free(void)
void event_cache_phases_invalidate(void)
void event_cache_init(void)
void send_attribute_block(const struct player *pplayer, struct connection *pconn)
@ REPORT_WONDERS_OF_THE_WORLD
const char * packet_name(enum packet_type type)
void lsend_packet_begin_turn(struct conn_list *dest)
int send_packet_end_phase(struct connection *pc)
void dlsend_packet_start_phase(struct conn_list *dest, int phase)
void lsend_packet_freeze_client(struct conn_list *dest)
void lsend_packet_end_phase(struct conn_list *dest)
void lsend_packet_achievement_info(struct conn_list *dest, const struct packet_achievement_info *packet)
void lsend_packet_end_turn(struct conn_list *dest)
void lsend_packet_thaw_client(struct conn_list *dest)
@ PACKET_NATION_SELECT_REQ
@ PACKET_CLIENT_HEARTBEAT
@ PACKET_AUTHENTICATION_REPLY
@ PACKET_SINGLE_WANT_HACK_REQ
struct player * player_by_number(const int player_id)
bool players_on_same_team(const struct player *pplayer1, const struct player *pplayer2)
int player_slot_count(void)
int player_number(const struct player *pplayer)
const char * player_name(const struct player *pplayer)
struct player * player_by_name(const char *name)
int player_index(const struct player *pplayer)
struct player * player_by_user(const char *name)
bool player_set_nation(struct player *pplayer, struct nation_type *pnation)
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)
#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 players_iterate_alive_end
#define players_iterate_alive(_pplayer)
void server_player_set_name(struct player *pplayer, const char *name)
void send_player_all_c(struct player *src, struct conn_list *dest)
struct player * server_create_player(int player_id, const char *ai_tname, struct rgbcolor *prgbcolor, bool allow_ai_type_fallbacking)
void player_status_add(struct player *plr, enum player_status pstatus)
int normal_player_count(void)
void playercolor_free(void)
void player_limit_to_max_rates(struct player *pplayer)
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)
struct nation_type * pick_a_nation(const struct nation_list *choices, bool ignore_conflicts, bool needs_startpos, enum barbarian_type barb_type)
void playercolor_init(void)
void kill_player(struct player *pplayer)
void send_player_info_c(struct player *src, struct conn_list *dest)
bool player_status_check(struct player *plr, enum player_status pstatus)
struct rgbcolor * playercolor_get(int id)
int playercolor_count(void)
void shuffle_players(void)
void server_remove_player(struct player *pplayer)
void server_player_init(struct player *pplayer, bool initmap, bool needs_team)
void make_contact(struct player *pplayer1, struct player *pplayer2, struct tile *ptile)
void update_capital(struct player *pplayer)
void assign_player_colors(void)
bool client_can_pick_nation(const struct nation_type *pnation)
bool nation_is_in_current_set(const struct nation_type *pnation)
void enter_war(struct player *pplayer, struct player *pplayer2)
void update_revolution(struct player *pplayer)
#define alive_phase_players_iterate(pplayer)
#define alive_phase_players_iterate_end
#define phase_players_iterate(pplayer)
#define allowed_nations_iterate(pnation)
#define allowed_nations_iterate_end
#define phase_players_iterate_end
bool fc_rand_is_init(void)
void fc_srand(RANDOM_TYPE seed)
void fc_rand_uninit(void)
randseed generate_game_seed(void)
void registry_module_init(void)
void registry_module_close(void)
void report_final_scores(struct conn_list *dest)
void report_wonders_of_the_world(struct conn_list *dest)
void report_demographics(struct connection *pconn)
void report_top_five_cities(struct conn_list *dest)
void make_history_report(void)
void log_civ_score_free(void)
void report_achievements(struct connection *pconn)
void log_civ_score_now(void)
int player_tech_upkeep(const struct player *pplayer)
struct research * research_get(const struct player *pplayer)
Tech_type_id research_goal_step(const struct research *presearch, Tech_type_id goal)
#define researches_iterate(_presearch)
#define researches_iterate_end
void rulesets_deinit(void)
bool load_rulesets(const char *restore, const char *alt, bool compat_mode, rs_conversion_logger logger, bool act, bool buffer_script, bool load_luadata)
void save_system_close(void)
void save_game(const char *orig_filename, const char *save_reason, bool scenario)
void calc_civ_score(struct player *pplayer)
void rank_users(bool interrupt)
int total_player_citizens(const struct player *pplayer)
void script_server_signal_emit(const char *signal_name,...)
int server_open_socket(void)
void init_connections(void)
enum server_events server_sniff_all_input(void)
void readline_atexit(void)
void close_connections_and_socket(void)
#define SERVER_SETTING_NONE
void settings_init(bool act)
int setting_int_get(struct setting *pset)
struct setting * setting_by_name(const char *name)
const char * setting_value_name(const struct setting *pset, bool pretty, char *buf, size_t buf_len)
int setting_number(const struct setting *pset)
struct setting * setting_by_number(int id)
enum sset_type setting_type(const struct setting *pset)
struct setting_list * level[OLEVELS_NUM]
void settings_game_start(void)
bool setting_enum_set(struct setting *pset, const char *val, struct connection *caller, char *reject_msg, size_t reject_msg_len)
const char * setting_name(const struct setting *pset)
int setting_bitwise_get(struct setting *pset)
bool setting_bool_get(struct setting *pset)
void send_server_settings(struct conn_list *dest)
const char * fileinfoname(const struct strvec *dirs, const char *filename)
const struct strvec * get_data_dirs(void)
int rank_spaceship_arrival(struct player **result)
double spaceship_arrival(const struct player *pplayer)
void send_spaceship_info(struct player *src, struct conn_list *dest)
void spaceship_arrived(struct player *pplayer)
void timing_log_init(void)
void timing_log_free(void)
static void srv_prepare(void)
static struct player * mapimg_server_tile_owner(const struct tile *ptile, const struct player *pplayer, bool knowledge)
static void server_gui_color_free(struct color *pcolor)
void server_game_init(bool keep_ruleset_value)
static struct terrain * mapimg_server_tile_terrain(const struct tile *ptile, const struct player *pplayer, bool knowledge)
static struct player * mapimg_server_tile_city(const struct tile *ptile, const struct player *pplayer, bool knowledge)
static void update_diplomatics(void)
static struct player * mapimg_server_tile_unit(const struct tile *ptile, const struct player *pplayer, bool knowledge)
void handle_nation_select_req(struct connection *pc, int player_no, Nation_type_id nation_no, bool is_male, const char *name, int style)
static void do_have_contacts_effect(void)
static void ai_start_phase(void)
static struct timer * eot_timer
const char * pick_random_player_name(const struct nation_type *pnation)
void identity_number_release(int id)
void player_nation_defaults(struct player *pplayer, struct nation_type *pnation, bool set_name)
static void handle_observer_ready(struct connection *pconn)
bv_id identity_numbers_used
void handle_report_req(struct connection *pconn, enum report_type type)
static void generate_players(void)
static void do_reveal_effects(void)
static int mapimg_server_plrcolor_count(void)
void handle_client_info(struct connection *pc, enum gui_type gui, int emerg_version, const char *distribution)
void handle_player_ready(struct player *requestor, int player_no, bool is_ready)
const char * aifill(int amount)
static bool identity_number_is_used(int id)
static void end_phase(void)
static enum server_states civserver_state
static void begin_turn(bool is_new_turn)
static void end_turn(void)
void save_game_auto(const char *save_reason, enum autosave_type type)
static struct rgbcolor * mapimg_server_plrcolor_get(int i)
void set_server_state(enum server_states newstate)
static int increment_identity_number(void)
const char * server_ss_name_get(server_setting_id id)
static void begin_phase(bool is_new_phase)
static void update_environmental_upset(enum environment_upset_type type, int *current, int *accum, int *level, int percent, void(*upset_action_fn)(int))
static void kill_dying_players(void)
bool game_was_started(void)
static void srv_scores(void)
#define startpos_hash_iterate(hash, psp, c)
void identity_number_reserve(int id)
struct server_arguments srvarg
static void srv_ready(void)
static void srv_running(void)
static void final_ruleset_adjustments(void)
#define startpos_hash_iterate_end
static int server_plr_tile_city_id_get(const struct tile *ptile, const struct player *pplayer)
static bool is_client_edit_packet(int type)
static void notify_illegal_armistice_units(struct player *phost, struct player *pguest, int turns_left)
bool server_ss_val_bool_get(server_setting_id id)
static void remove_illegal_armistice_units(struct player *plr1, struct player *plr2)
int identity_number(void)
server_setting_id server_ss_by_name(const char *name)
void check_for_full_turn_done(void)
static void player_set_nation_full(struct player *pplayer, struct nation_type *pnation)
static void announce_player(struct player *pplayer)
bool server_packet_input(struct connection *pconn, void *packet, int type)
static void fc_interface_init_server(void)
int server_ss_val_int_get(server_setting_id id)
static struct timer * between_turns
unsigned int server_ss_val_bitwise_get(server_setting_id id)
static bool has_been_srv_init
void send_all_info(struct conn_list *dest)
void init_game_seed(void)
void update_nations_with_startpos(void)
enum sset_type server_ss_type_get(server_setting_id id)
bool check_for_game_over(void)
static enum known_type mapimg_server_tile_known(const struct tile *ptile, const struct player *pplayer, bool knowledge)
static void do_border_vision_effect(void)
enum server_states server_state(void)
void server_game_free(void)
#define IDENTITY_NUMBER_SIZE
#define IDENTITY_NUMBER_SKIP
bool read_init_script(struct connection *caller, char *script_filename, bool from_cmdline, bool check)
void set_running_game_access_level(void)
void stdinhand_turn(void)
void stdinhand_init(void)
void set_ai_level_direct(struct player *pplayer, enum ai_level level)
void stdinhand_free(void)
bool load_command(struct connection *caller, const char *filename, bool check, bool cmdline_load)
bool start_command(struct connection *caller, bool check, bool notify)
void toggle_ai_player_direct(struct connection *caller, struct player *pplayer)
void(* unit_deallocate)(int unit_id)
struct civ_game::@30::@34 server
char start_units[MAX_LEN_STARTUNIT]
struct packet_ruleset_control control
struct civ_game::@32 callbacks
struct conn_list * est_connections
struct packet_game_info info
struct timer * save_timer
char rulesetdir[MAX_LEN_NAME]
int additional_phase_seconds
struct packet_scenario_info scenario
struct civ_game::@30::@34::@38 mutexes
struct timer * phase_timer
int nuclear_winter_percent
char save_name[MAX_LEN_NAME]
struct packet_timeout_info tinfo
int global_warming_percent
struct government * government_during_revolution
struct civ_map::@41::@43 server
enum map_generator generator
enum cmdlevel access_level
char username[MAX_LEN_NAME]
struct government * init_government
enum borders_mode borders
enum ai_level skill_level
enum phase_mode_type phase_mode
float seconds_to_phasedone
float last_turn_change_time
enum ai_level skill_level
char has_reason_to_cancel
struct vision_site * site
struct player_ai ai_common
char username[MAX_LEN_NAME]
struct connection * current_conn
const struct ai_type * ai
struct player_score score
struct nation_type * nation
struct nation_style * style
Tech_type_id researching_saved
bool metaconnection_persistent
char metaserver_addr[256]
char * scenarios_pathname
struct unit::@80::@83 server
struct nation_style * style_by_number(int id)
int fc_snprintf(char *str, size_t n, const char *format,...)
#define sz_strlcpy(dest, src)
const char * team_name_translation(const struct team *pteam)
const struct player_list * team_members(const struct team *pteam)
#define teams_iterate_end
#define teams_iterate(_pteam)
bool tile_extra_apply(struct tile *ptile, struct extra_type *tgt)
bool tile_extra_rm_apply(struct tile *ptile, struct extra_type *tgt)
enum known_type tile_get_known(const struct tile *ptile, const struct player *pplayer)
struct city * tile_city(const struct tile *ptile)
#define tile_worked(_tile)
#define tile_terrain(_tile)
#define tile_has_extra(ptile, pextra)
#define tile_owner(_tile)
struct timer * timer_new(enum timer_timetype type, enum timer_use use)
void timer_clear(struct timer *t)
void timer_destroy(struct timer *t)
void timer_start(struct timer *t)
double timer_read_seconds(struct timer *t)
struct timer * timer_renew(struct timer *t, enum timer_timetype type, enum timer_use use)
static int best_value(const void *a, const void *b)
bool is_military_unit(const struct unit *punit)
bool unit_is_cityfounder(const struct unit *punit)
#define unit_list_iterate(unitlist, punit)
#define unit_list_iterate_safe(unitlist, _unit)
#define unit_list_iterate_end
#define unit_list_iterate_safe_end
struct unit_type * get_role_unit(int role, int role_index)
const char * unstable_message(void)
bool victory_enabled(enum victory_condition_type victory)
void vision_free(struct vision *vision)
#define vision_layer_iterate(v)
#define vision_layer_iterate_end
void send_updated_vote_totals(struct conn_list *dest)
void clear_all_votes(void)