66 char output_text[
O_LAST][16];
68 for (i = 0; i <
O_LAST; i++) {
69 int before_penalty = 0;
75 EFT_OUTPUT_PENALTY_TILE);
78 if (before_penalty > 0 && x > before_penalty) {
79 fc_snprintf(output_text[i],
sizeof(output_text[i]),
"%d(-1)", x);
81 fc_snprintf(output_text[i],
sizeof(output_text[i]),
"%d", x);
96 const struct player *pplayer)
98 if (!buf || buflen < 1) {
107 if (
is_ai(pplayer)) {
120 const struct player *pplayer)
122 if (!buf || buflen < 1) {
148 const char *activity_text;
151 const char *diplo_nation_plural_adjectives[DS_LAST] =
152 {
"" ,
Q_(
"?nation:Hostile"),
154 Q_(
"?nation:Peaceful"),
Q_(
"?nation:Friendly"),
155 Q_(
"?nation:Mysterious"),
Q_(
"?nation:Friendly(team)")};
156 const char *diplo_city_adjectives[DS_LAST] =
157 {
"" ,
Q_(
"?city:Hostile"),
159 Q_(
"?city:Peaceful"),
Q_(
"?city:Friendly"),
Q_(
"?city:Mysterious"),
160 Q_(
"?city:Friendly(team)")};
204 }
else if (NULL !=
owner) {
208 if (ds->
type == DS_CEASEFIRE) {
214 PL_(
"Territory of %s (%s) (%d turn cease-fire)",
215 "Territory of %s (%s) (%d turn cease-fire)",
217 username, nation, turns);
218 }
else if (ds->
type == DS_ARMISTICE) {
224 PL_(
"Territory of %s (%s) (%d turn armistice)",
225 "Territory of %s (%s) (%d turn armistice)",
227 username, nation, turns);
235 diplo_nation_plural_adjectives[
type]);
246 int has_improvements = 0;
258 if (ds->
type == DS_CEASEFIRE) {
264 "City: %s | %s (%s, %d turn cease-fire)",
267 }
else if (ds->
type == DS_ARMISTICE) {
273 "City: %s | %s (%s, %d turn armistice)",
281 diplo_city_adjectives[ds->
type]);
285 int count = unit_list_size(ptile->
units);
290 " | Occupied with %d units.", count), count);
307 improvements[has_improvements++] =
312 if (0 < has_improvements) {
337 if (*infratext !=
'\0') {
342 if (strlen(activity_text) > 0) {
345 if (
punit && !pcity) {
372 }
else if (hcity != NULL) {
376 }
else if (NULL !=
owner) {
379 if (ds->
type == DS_CEASEFIRE) {
385 "Unit: %s | %s (%s, %d turn cease-fire)",
388 username, nation, turns);
389 }
else if (ds->
type == DS_ARMISTICE) {
395 "Unit: %s | %s (%s, %d turn armistice)",
398 username, nation, turns);
404 diplo_city_adjectives[ds->
type]);
421 att_chance =
MIN(att, att_chance);
422 def_chance =
MIN(def, def_chance);
429 att_chance, def_chance);
439 const char *veteran_name =
458 && unit_list_size(ptile->
units) >= 2) {
468#define FAR_CITY_SQUARE_DIST (2*(6*6))
525 const char *veteran_name =
532 if (pplayer ==
owner) {
546 if (nationality != NULL &&
owner != nationality) {
579 const struct city *pdest)
582 bool src = (pdest == NULL);
583 enum texttype { AL_IMPOSSIBLE, AL_UNKNOWN, AL_FINITE, AL_INFINITE }
584 best = AL_IMPOSSIBLE;
585 int cur = 0, max = 0;
588 enum texttype
this = AL_IMPOSSIBLE;
602 this = AL_IMPOSSIBLE;
629 this = AL_IMPOSSIBLE;
643 if (best == AL_FINITE) {
644 fc_assert(cur == this_cur && max == this_max);
659 best =
MAX(best,
this);
685 int ours = 0, theirs = 0;
701 theirs -= pplayer->client.tech_upkeep;
720 return ours + theirs;
765 return ceil((
double)bulbs_to_loss / -per_turn);
777 int ours, theirs, perturn, upkeep;
791 return _(
"Progress: no research");
801 "Progress: %d turns/advance",
807 "Progress: %d turns/advance loss",
818 astr_set(&ourbuf,
PL_(
"%d bulb/turn",
"%d bulbs/turn", ours), ours);
823 PL_(
", %d bulb/turn from team",
824 ", %d bulbs/turn from team", theirs), theirs);
836 astr_add(&
str,
_(
" (needed for technology upkeep: %d)"), upkeep);
879 "%d/%d (%d turns to loss)", turns),
886 *percent = (double)done / (
double)total;
887 *percent =
CLIP(0.0, *percent, 1.0);
923 PL_(
"%d step",
"%d steps", steps), steps);
925 PL_(
"%d bulb",
"%d bulbs", bulbs_needed), bulbs_needed);
927 turns = (bulbs_needed + perturn - 1) / perturn;
929 PL_(
"%d turn",
"%d turns", turns), turns);
1094 int count = unit_list_size(punits);
1123 count = unit_list_size(punits);
1138 }
else if (min == max) {
1143 }
else if (count == 1) {
1149 }
else if (count > 1) {
1151 "%d units selected",
1160 struct unit *
punit = unit_list_get(punits, 0);
1170 if (*infratext !=
'\0') {
1186 if (nationality != NULL &&
owner != nationality) {
1196 }
else if (count > 1) {
1197 int mil = 0, nonmil = 0;
1198 int types_count[
U_LAST], i;
1201 memset(types_count, 0,
sizeof(types_count));
1211 top[0] = top[1] = top[2] = NULL;
1231 for (i = 0; i < 2; i++) {
1232 if (top[i] && types_count[
utype_index(top[i])] > 0) {
1246 if (top[2] && types_count[
utype_index(top[2])] > 0
1247 && types_count[
utype_index(top[2])] == nonmil + mil) {
1250 }
else if (nonmil > 0 && mil > 0) {
1252 }
else if (nonmil > 0) {
1254 }
else if (mil > 0) {
1291 struct unit_list *punits)
1293 if (unit_list_size(punits) == 0) {
1296 }
else if (unit_list_size(punits) == 1) {
1299 int upgrade_cost = 0;
1300 int num_upgraded = 0;
1310 from_unittype, to_unittype);
1313 upgrade_cost +=
cost;
1314 min_upgrade_cost =
MIN(min_upgrade_cost,
cost);
1317 if (num_upgraded == 0) {
1329 "Treasury contains %d gold.",
1344 "%s for %d gold?\n%s", upgrade_cost),
1345 ubuf, upgrade_cost, tbuf);
1357 struct unit_list *punits)
1359 if (unit_list_size(punits) == 0) {
1362 }
else if (unit_list_size(punits) == 1) {
1364 ACTION_DISBAND_UNIT)) {
1388 "Disband %d units?", count), count);
1407 "researching the current technology."));
1420 astr_set(&buf1,
PL_(
"%d turn",
"%d turns", turns), turns);
1422 astr_set(&buf1,
PL_(
"%d turn to loss",
"%d turns to loss", turns),
1433 astr_set(&buf2,
PL_(
"%d bulb/turn",
"%d bulbs/turn", perturn), perturn);
1542 memset(&ship, 0,
sizeof(ship));
1564 (
float) (0.1 * ((
int) (pship->
travel_time * 10.0))));
1632 if (duration < 60) {
1634 }
else if (duration < 3600) {
1635 astr_add(&
str,
Q_(
"?mins/secs:%02dm %02ds"), duration / 60, duration % 60);
1636 }
else if (duration < 360000) {
1637 astr_add(&
str,
Q_(
"?hrs/mns:%02dh %02dm"), duration / 3600, (duration / 60) % 60);
1638 }
else if (duration < 8640000) {
1639 astr_add(&
str,
Q_(
"?dys/hrs:%02dd %02dh"), duration / 86400,
1640 (duration / 3600) % 24);
1661 if (!pconn->observer
1663 && 0 == strcmp(pconn->username, pplayer->
username)) {
1664 if (pconn->ping_time >= 0) {
1665 double ping_time_in_ms = 1000 * pconn->ping_time;
1667 astr_add(&
str,
_(
"%6d.%02d ms"), (
int) ping_time_in_ms,
1668 ((
int) (ping_time_in_ms * 100.0)) % 100);
1714 if (pplayer != NULL) {
1771 _(
"%d one time bonus + %d trade"),
1791 _(
"%d one time bonus"), revenue);
1833 struct effect_list *plist = effect_list_new();
1837 if (0 < effect_list_size(plist)) {
1846 effect_list_destroy(plist);
1874 enemies += nationality;
1879 astr_add(&
str,
PL_(
"%d enemy nationalist",
"%d enemy nationalists", enemies),
1903 struct effect_list *plist = effect_list_new();
1909 if (0 < effect_list_size(plist)) {
1921 effect_list_destroy(plist);
1942 if (basis+
step <= 0) {
1946 PL_(
"Cities: %d total, but no penalty for empire size.",
1947 "Cities: %d total, but no penalty for empire size.",
1952 PL_(
"%d content per city.",
1953 "%d content per city.", content),
1964 penalty = 1 + (excess - 1) /
step;
1972 unhappy =
MIN(penalty, content);
1977 last = basis + (unhappy+angry-1)*
step;
1992 PL_(
"Cities: %d total:",
1993 "Cities: %d total:",
cities),
1999 PL_(
" %d over nearest threshold of %d city.",
2000 " %d over nearest threshold of %d cities.", last),
2004 PL_(
"%d content before penalty.",
2005 "%d content before penalty.", content),
2008 PL_(
"%d additional unhappy citizen.",
2009 "%d additional unhappy citizens.", unhappy),
2013 PL_(
"%d angry citizen.",
2014 "%d angry citizens.", angry),
2021 PL_(
" not more than %d, so no empire size penalty.",
2022 " not more than %d, so no empire size penalty.", next),
2026 PL_(
"%d content per city.",
2027 "%d content per city.", content),
2030 if (next >=
cities && penalty < content) {
2032 PL_(
"With %d more city, another citizen will become "
2034 "With %d more cities, another citizen will become "
2038 }
else if (next >=
cities) {
2043 PL_(
"With %d more city, another citizen will become "
2045 "With %d more cities, another citizen will become "
2053 _(
"More cities will not cause more unhappy citizens."));
2079 "Up to %d military units may impose martial "
2080 "law.", mlmax), mlmax);
2083 "unhappy citizen content.",
2084 "Each military unit makes %d "
2085 "unhappy citizens content.",
2087 }
else if (uhcfac > 0) {
2089 _(
"Military units in the field may cause unhappiness. "));
2092 _(
"Military units have no happiness effect. "));
2110 _(
"Luxury: %d total."),
2126 if (uni->
kind == VUT_UTYPE) {
2159 static char buf[1024];
2164 relation =
_(
" (us)");
2166 relation =
_(
" (an ally)");
2170 relation =
_(
" (an enemy)");
const char * action_prob_explain(const struct act_prob prob)
bool action_prob_possible(const struct act_prob probability)
enum action_target_kind action_get_target_kind(const struct action *paction)
#define action_has_result(_act_, _res_)
void astr_free(struct astring *astr)
void astr_set(struct astring *astr, const char *format,...)
const char * astr_build_and_list(struct astring *astr, const char *const *items, size_t number)
void astr_add_line(struct astring *astr, const char *format,...)
void astr_clear(struct astring *astr)
void astr_add(struct astring *astr, const char *format,...)
void astr_break_lines(struct astring *astr, size_t desired_len)
static const char * astr_str(const struct astring *astr) fc__attribute((nonnull(1)))
const char * calendar_text(void)
const char * textyear(int year)
#define citizens_foreign_iterate_end
#define citizens_foreign_iterate(_pcity, _pslot, _nationality)
int city_production_build_shield_cost(const struct city *pcity)
bool city_has_building(const struct city *pcity, const struct impr_type *pimprove)
const char * city_name_get(const struct city *pcity)
int city_airlift_max(const struct city *pcity)
struct output_type * get_output_type(Output_type_id output)
bool city_is_occupied(const struct city *pcity)
int city_tile_output(const struct city *pcity, const struct tile *ptile, bool is_celebrating, Output_type_id otype)
#define city_list_iterate(citylist, pcity)
#define city_owner(_pcity_)
#define city_list_iterate_end
bool client_is_global_observer(void)
int get_seconds_to_new_turn(void)
int get_seconds_to_turndone(void)
bool is_waiting_turn_change(void)
bool client_has_player(void)
const char * concat_tile_activity_text(struct tile *ptile)
enum known_type client_tile_get_known(const struct tile *ptile)
void nuclear_winter_scaled(int *chance, int *rate, int max)
void global_warming_scaled(int *chance, int *rate, int max)
struct city * get_nearest_city(const struct unit *punit, int *sq_dist)
static struct fc_sockaddr_list * list
double unit_win_chance(const struct civ_map *nmap, const struct unit *attacker, const struct unit *defender)
#define conn_list_iterate(connlist, pconn)
#define conn_list_iterate_end
struct unit_list * get_units_in_focus(void)
enum cursor_hover_state hover_state
struct unit * find_visible_unit(struct tile *ptile)
int city_history_gain(const struct city *pcity)
int nation_history_gain(const struct player *pplayer)
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
struct unit struct city * target_city
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 int cost
struct effect_list * effects[EFT_COUNT]
int get_player_output_bonus(const struct player *pplayer, const struct output_type *poutput, enum effect_type effect_type)
int get_city_bonus(const struct city *pcity, enum effect_type effect_type)
int get_city_bonus_effects(struct effect_list *plist, const struct city *pcity, const struct output_type *poutput, enum effect_type effect_type)
int get_player_bonus(const struct player *pplayer, enum effect_type effect_type)
void get_effect_list_req_text(const struct effect_list *plist, struct astring *astr)
#define PL_(String1, String2, n)
const char * population_to_text(int thousand_citizen)
int current_turn_timeout(void)
int civ_population(const struct player *pplayer)
struct city * game_city_by_number(int id)
bool goto_get_turns(int *min, int *max)
const char * ruler_title_for_player(const struct player *pplayer, char *buf, size_t buf_len)
const char * government_name_for_player(const struct player *pplayer)
bool is_improvement_visible(const struct impr_type *pimprove)
const char * improvement_name_translation(const struct impr_type *pimprove)
Impr_type_id improvement_count(void)
#define improvement_iterate_end
#define improvement_iterate(_p)
#define fc_assert(condition)
#define fc_assert_ret_val(condition, val)
#define index_to_native_pos(pnat_x, pnat_y, mindex)
#define index_to_map_pos(pmap_x, pmap_y, mindex)
const char * nation_adjective_for_player(const struct player *pplayer)
struct city_list * cities
struct player * player_by_number(const int player_id)
int player_get_expected_income(const struct player *pplayer)
const char * player_name(const struct player *pplayer)
bool pplayers_at_war(const struct player *pplayer, const struct player *pplayer2)
struct city * player_city_by_number(const struct player *pplayer, int city_id)
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 can_player_see_units_in_city(const struct player *pplayer, const struct city *pcity)
struct player * player_slot_get_player(const struct player_slot *pslot)
int research_goal_unknown_techs(const struct research *presearch, Tech_type_id goal)
bool research_goal_tech_req(const struct research *presearch, Tech_type_id goal, Tech_type_id tech)
int research_goal_bulbs_required(const struct research *presearch, Tech_type_id goal)
const char * research_advance_name_translation(const struct research *presearch, Tech_type_id tech)
struct research * research_get(const struct player *pplayer)
#define research_players_iterate(_presearch, _pplayer)
#define research_players_iterate_end
#define CLIP(lower, current, upper)
#define strvec_iterate(psv, str)
#define strvec_iterate_end
struct packet_game_info info
struct packet_timeout_info tinfo
enum borders_mode borders
enum tech_upkeep_style tech_upkeep_style
enum airlifting_style airlifting_style
enum phase_mode_type phase_mode
bool airlift_from_always_enabled
bool airlift_to_always_enabled
float last_turn_change_time
enum spaceship_state state
struct city_list * cities
char username[MAX_LEN_NAME]
struct player::@69::@72 client
struct conn_list * connections
struct player_economic economic
struct player_score score
struct nation_type * nation
struct research::@75::@77 client
struct goods_type * carrying
int fc_snprintf(char *str, size_t n, const char *format,...)
size_t fc_strlcpy(char *dest, const char *src, size_t n)
int cat_snprintf(char *str, size_t n, const char *format,...)
struct team * team_by_number(const int team_id)
const char * team_name_translation(const struct team *pteam)
const char * get_infrastructure_text(bv_extras extras)
const char * get_government_tooltip(void)
const char * text_happiness_cities(const struct city *pcity)
static const char * format_duration(int duration)
static void get_full_username(char *buf, int buflen, const struct player *pplayer)
const char * text_happiness_nationality(const struct city *pcity)
#define FAR_CITY_SQUARE_DIST
const char * score_tooltip(const struct player *pplayer, int score)
const char * text_happiness_wonders(const struct city *pcity)
bool get_units_upgrade_info(char *buf, size_t bufsz, struct unit_list *punits)
bool get_units_disband_info(char *buf, size_t bufsz, struct unit_list *punits)
static int turns_to_research_done(const struct research *presearch, int per_turn)
const char * get_airlift_text(const struct unit_list *punits, const struct city *pdest)
const char * get_info_label_text_popup(void)
const char * text_happiness_units(const struct city *pcity)
const char * text_happiness_luxuries(const struct city *pcity)
const char * science_dialog_text(void)
static int get_bulbs_per_turn(int *pours, bool *pteam, int *ptheirs)
const char * text_happiness_buildings(const struct city *pcity)
const char * get_ping_time_text(const struct player *pplayer)
const char * get_report_title(const char *report_name)
static int turns_to_tech_loss(const struct research *presearch, int per_turn)
const char * get_nuclear_winter_tooltip(void)
const char * get_score_text(const struct player *pplayer)
const char * get_science_target_text(double *percent)
const char * get_bulb_tooltip(void)
const char * get_timeout_label_text(void)
const char * get_nearest_city_text(struct city *pcity, int sq_dist)
const char * get_act_sel_action_custom_text(struct action *paction, const struct act_prob prob, const struct unit *actor_unit, const struct city *target_city)
const char * popup_info_text(struct tile *ptile)
const char * unit_description(struct unit *punit)
static void get_full_nation(char *buf, int buflen, const struct player *pplayer)
const char * get_global_warming_tooltip(void)
const char * get_tile_output_text(const struct tile *ptile)
const char * get_info_label_text(bool moreinfo)
const char * production_help(const struct universal *uni, char *buf, size_t bufsize)
static int turns_per_advance(const struct research *presearch, int per_turn)
const char * get_science_goal_text(Tech_type_id goal)
const char * get_unit_info_label_text2(struct unit_list *punits, int linebreaks)
const char * get_unit_info_label_text1(struct unit_list *punits)
const char * get_spaceship_descr(struct player_spaceship *pship)
const char * act_sel_action_tool_tip(const struct action *paction, const struct act_prob prob)
bool tile_has_visible_extra(const struct tile *ptile, const struct extra_type *pextra)
const char * tile_get_info_text(const struct tile *ptile, bool include_nuisances, int linebreaks)
struct city * tile_city(const struct tile *ptile)
#define tile_continent(_tile)
#define tile_owner(_tile)
bool can_cities_trade(const struct city *pc1, const struct city *pc2)
int trade_base_between_cities(const struct city *pc1, const struct city *pc2)
int get_caravan_enter_city_trade_bonus(const struct city *pc1, const struct city *pc2, struct goods_type *pgood, const bool establish_trade)
bool can_establish_trade_route(const struct city *pc1, const struct city *pc2)
const struct unit_type * utype
const struct impr_type * building
enum unit_upgrade_result unit_upgrade_info(const struct civ_map *nmap, const struct unit *punit, char *buf, size_t bufsz)
struct player * unit_nationality(const struct unit *punit)
enum unit_airlift_result test_unit_can_airlift_to(const struct civ_map *nmap, const struct player *restriction, const struct unit *punit, const struct city *pdest_city)
int unit_bribe_cost(struct unit *punit, struct player *briber)
void unit_upkeep_astr(const struct unit *punit, struct astring *astr)
bool unit_can_do_action(const struct unit *punit, const action_id act_id)
void unit_activity_astr(const struct unit *punit, struct astring *astr)
enum unit_upgrade_result unit_upgrade_test(const struct civ_map *nmap, const struct unit *punit, bool is_free)
#define unit_list_iterate(unitlist, punit)
#define unit_list_iterate_end
const char * utype_veteran_name_translation(const struct unit_type *punittype, int level)
const struct unit_type * unit_type_get(const struct unit *punit)
const char * unit_name_translation(const struct unit *punit)
const struct unit_type * can_upgrade_unittype(const struct player *pplayer, const struct unit_type *punittype)
bool unit_has_type_flag(const struct unit *punit, enum unit_type_flag_id flag)
Unit_type_id utype_index(const struct unit_type *punittype)
const char * utype_name_translation(const struct unit_type *punittype)
bool utype_can_do_action(const struct unit_type *putype, const action_id act_id)
int unit_upgrade_price(const struct player *pplayer, const struct unit_type *from, const struct unit_type *to)
static bool utype_has_flag(const struct unit_type *punittype, int flag)
#define unit_type_iterate(_p)
#define unit_type_iterate_end