92#define HISTORIAN_FIRST HISTORIAN_RICHEST
93#define HISTORIAN_LAST HISTORIAN_CULTURAL
97 N_(
"%s %s reports on the RICHEST Civilizations in the World."),
99 N_(
"%s %s reports on the most ADVANCED Civilizations in the World."),
101 N_(
"%s %s reports on the most MILITARIZED Civilizations in the World."),
103 N_(
"%s %s reports on the HAPPIEST Civilizations in the World."),
105 N_(
"%s %s reports on the LARGEST Civilizations in the World."),
107 N_(
"%s %s reports on the MOST CULTURAL Civilizations in the World.")
116 N_(
"Pliny the Elder"),
130#define MAX_SCORELOG_LINE_LEN (119 + 1)
234#define GOOD_PLAYER(p) ((p)->is_alive && !is_barbarian(p))
243 const char *(*to_text) (
int);
274 N_(
"%2d: The Supreme %s"),
276 N_(
"%2d: The Magnificent %s"),
278 N_(
"%2d: The Great %s"),
280 N_(
"%2d: The Glorious %s"),
282 N_(
"%2d: The Excellent %s"),
284 N_(
"%2d: The Eminent %s"),
286 N_(
"%2d: The Distinguished %s"),
288 N_(
"%2d: The Average %s"),
290 N_(
"%2d: The Mediocre %s"),
292 N_(
"%2d: The Ordinary %s"),
294 N_(
"%2d: The Pathetic %s"),
296 N_(
"%2d: The Useless %s"),
298 N_(
"%2d: The Valueless %s"),
300 N_(
"%2d: The Worthless %s"),
302 N_(
"%2d: The Wretched %s"),
320 int i, j = 0,
rank = 0;
328 size[j].value = pplayer->economic.gold;
335 size[j].value = pplayer->score.units;
339 = (((pplayer->score.happy - pplayer->score.unhappy
340 - 2 * pplayer->score.angry) * 1000) /
351 size[j].player = pplayer;
358 for (
i = 0;
i < j;
i++) {
422 size[
i].city =
nullptr;
458 _(
"%2d: The %s City of %s (%s) of size %d, "),
i + 1,
464 _(
"%2d: The %s City of %s of size %d, "),
i + 1,
471 cat_snprintf(buffer,
sizeof(buffer),
_(
"with no Great Wonders\n"));
474 PL_(
"with %d Great Wonder\n",
"with %d Great Wonders\n",
481 PL_(
"The %d Greatest City in the World!",
482 "The %d Greatest Cities in the World!",
485 page_conn(dest,
_(
"Traveler's Report:"), header, buffer);
518 _(
"%s in %s (%s, %s)\n"),
538 cat_snprintf(buffer,
sizeof(buffer),
"----------------------------\n");
544 cat_snprintf(buffer,
sizeof(buffer),
_(
"%s has been DESTROYED\n"),
551 cat_snprintf(buffer,
sizeof(buffer),
"----------------------------\n");
563 &&
pcity->production.value.building ==
i) {
572 _(
"(building %s in %s (%s, %s))\n"),
577 _(
"(building %s in %s (%s))\n"),
597 _(
"Wonders of the World"), buffer);
623 _(
"%s in %s (%s, %s)\n"),
635 cat_snprintf(buffer,
sizeof(buffer),
_(
"%s has been DESTROYED\n"),
646 &&
pcity->production.value.building ==
i) {
655 _(
"(building %s in %s (%s, %s))\n"),
660 _(
"(building %s in %s (%s))\n"),
671 _(
"Wonders of the World"), buffer);
699 return 1000 *
get_pop(pplayer);
915 if (
pcity->anarchy > 0) {
1004 static char buf[64];
1007 log_error(
"String truncated in value_units()!");
1099 const char *text =
prow->to_text(
prow->get_value(pplayer));
1112 && ((
prow->greater_values_are_better
1114 || (!
prow->greater_values_are_better
1125 int best_value = (pplayer !=
nullptr) ?
prow->get_value(pplayer) : 0;
1140 if (pplayer ==
nullptr
1164 for (
i = 0;
i <
len;
i++) {
1189 if (error !=
nullptr) {
1232 if ((!
pconn->observer && !pplayer)
1237 _(
"Sorry, the Demographics report is unavailable."),
"");
1275 if (pplayer ==
nullptr) {
1324 if (plrdata->
name !=
nullptr) {
1326 plrdata->
name =
nullptr;
1360 log_error(
"[%s:-] Can't read scorelog file header!",
1387 log_error(
"[%s:%d] IDs don't match! game='%s' scorelog='%s'",
1410 log_error(
"[%s:%d] Bad line (addplayer)!",
1418 while (*ptr !=
'\0' &&
spaces < 2) {
1429 log_error(
"[%s:%d] Invalid player number: %d!",
1435 if (plrdata->
name !=
nullptr) {
1436 log_error(
"[%s:%d] Two names for one player (id %d)!",
1447 log_error(
"[%s:%d] Bad line (delplayer)!",
1453 log_error(
"[%s:%d] Invalid player number: %d!",
1459 if (plrdata->
name ==
nullptr) {
1460 log_error(
"[%s:%d] Trying to remove undefined player (id %d)!",
1480 log_error(
"[%s:-] Scorelog doesn't match savegame!",
1505 plrdata->
name =
nullptr;
1530 if (plrdata->
name !=
nullptr) {
1580 log_error(
"Can't open scorelog file '%s' for creation!",
1587 "# For a specification of the format of this see doc/README.scorelog or \n"
1588 "# <https://raw.githubusercontent.com/freeciv/freeciv/main/doc/README.scorelog>.\n"
1599 log_error(
"Can't open scorelog file '%s' for appending!",
1619 if (plrdata->
name !=
nullptr
1637 if (
is_ai(pplayer)) {
1657 if (
is_ai(pplayer) && plrdata->
name ==
nullptr) {
1666 log_debug(
"player names does not match '%s' != '%s'", plrdata->
name,
1726 static const struct {
1772 size[
i].value = pplayer->score.game;
1773 size[
i].player = pplayer;
1842 for (
i = 0;
i < packet.
parts;
i++) {
bool achievement_player_has(const struct achievement *pach, const struct player *pplayer)
int get_literacy(const struct player *pplayer)
const char * achievement_name_translation(struct achievement *pach)
#define achievements_iterate_end
#define achievements_iterate(_ach_)
#define BV_DEFINE(name, bits)
#define BV_ISSET(bv, bit)
const char * calendar_text(void)
const char * city_improvement_name_translation(const struct city *pcity, const struct impr_type *pimprove)
const char * city_name_get(const struct city *pcity)
#define city_list_iterate(citylist, pcity)
static citizens city_size_get(const struct city *pcity)
#define city_owner(_pcity_)
#define city_list_iterate_end
#define city_built_iterate(_pcity, _p)
#define city_built_iterate_end
int player_culture(const struct player *plr)
const char const char * headline
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 struct unit struct tile struct extra_type const struct act_prob *act_probs int actor_unit_id struct unit struct unit int const struct action *paction struct unit struct city * pcity
#define MAX_LEN_GAME_IDENTIFIER
size_t get_internal_string_length(const char *text)
#define PL_(String1, String2, n)
const char * population_to_text(int thousand_citizen)
#define GAME_DEFAULT_SCORETURN
struct government * government_of_player(const struct player *pplayer)
const char * government_name_for_player(const struct player *pplayer)
Government_type_id government_number(const struct government *pgovern)
bool great_wonder_is_destroyed(const struct impr_type *pimprove)
bool is_great_wonder(const struct impr_type *pimprove)
const char * improvement_name_translation(const struct impr_type *pimprove)
struct city * city_from_great_wonder(const struct impr_type *pimprove)
#define improvement_iterate_end
#define improvement_iterate(_p)
#define fc_assert_ret(condition)
#define fc_assert(condition)
#define fc_assert_ret_val(condition, val)
#define log_debug(message,...)
#define log_error(message,...)
#define fc_calloc(n, esz)
const char * nation_adjective_for_player(const struct player *pplayer)
const char * nation_plural_for_player(const struct player *pplayer)
void lsend_packet_endgame_player(struct conn_list *dest, const struct packet_endgame_player *packet)
void lsend_packet_endgame_report(struct conn_list *dest, const struct packet_endgame_report *packet)
void lsend_packet_page_msg(struct conn_list *dest, const struct packet_page_msg *packet)
void lsend_packet_page_msg_part(struct conn_list *dest, const struct packet_page_msg_part *packet)
bool player_slot_is_used(const struct player_slot *pslot)
int player_slot_count(void)
int player_number(const struct player *pplayer)
const char * player_name(const struct player *pplayer)
int player_slot_index(const struct player_slot *pslot)
bool team_has_embassy(const struct team *pteam, const struct player *tgt_player)
int player_index(const struct player *pplayer)
struct player * player_slot_get_player(const struct player_slot *pslot)
#define players_iterate_end
#define players_iterate(_pplayer)
static bool is_barbarian(const struct player *pplayer)
#define player_slots_iterate(_pslot)
#define player_slots_iterate_end
#define shuffled_players_iterate_end
#define shuffled_players_iterate(NAME_pplayer)
static int get_units_killed(const struct player *pplayer)
static int get_units_built(const struct player *pplayer)
static int get_contentpop(const struct player *pplayer)
static struct logging_civ_score * score_log
static int nr_wonders(struct city *pcity)
static const char * ranking[]
void report_final_scores(struct conn_list *dest)
static const char * economics_to_text(int value)
static const char * production_to_text(int value)
static int get_munits(const struct player *pplayer)
static const char * science_to_text(int value)
static int get_pollution(const struct player *pplayer)
static int get_economics(const struct player *pplayer)
static int get_techs(const struct player *pplayer)
static void plrdata_slot_init(struct plrdata_slot *plrdata, const char *name)
static void page_conn_etype(struct conn_list *dest, const char *caption, const char *headline, const char *lines, enum event_type event)
static int get_pop(const struct player *pplayer)
static int get_riots(const struct player *pplayer)
static void historian_generic(struct history_report *report, enum historian_type which_news)
static const char * pollution_to_text(int value)
static void plrdata_slot_replace(struct plrdata_slot *plrdata, const char *name)
static int get_production(const struct player *pplayer)
struct history_report latest_history_report
static bool scan_score_log(char *id)
static int get_scirate(const struct player *pplayer)
static int get_taxrate(const struct player *pplayer)
void send_current_history_report(struct conn_list *dest)
static int get_spaceship(const struct player *pplayer)
void report_wonders_of_the_world(struct conn_list *dest)
int(* get_value)(const struct player *)
void report_demographics(struct connection *pconn)
static const char * historian_message[]
static int get_corruption(const struct player *pplayer)
static int get_wonders(const struct player *pplayer)
void report_wonders_of_the_world_long(struct conn_list *dest)
static int get_landarea(const struct player *pplayer)
static int get_total_score(const struct player *pplayer)
static const char * area_to_text(int value)
static const char scorelog_magic[]
static int get_population(const struct player *pplayer)
int get_tag_score(const char *tag, const struct player *pplayer)
static struct dem_col coltable[]
static int get_units_used(const struct player *pplayer)
static const char * historian_name[]
struct history_report * history_report_get(void)
void make_history_report(void)
void log_civ_score_free(void)
static int get_culture(const struct player *pplayer)
static const char * value_units(int val, const char *uni)
static int get_techout(const struct player *pplayer)
static int get_specialists(const struct player *pplayer)
static struct dem_row rowtable[]
static int get_unhappypop(const struct player *pplayer)
bool is_valid_demography(const char *demography, int *error)
static const struct @100 score_tags[]
void report_top_cities(struct conn_list *dest)
static int get_settledarea(const struct player *pplayer)
void log_civ_score_init(void)
static int get_literacy2(const struct player *pplayer)
static void dem_line_item(char *outptr, size_t out_size, struct player *pplayer, struct dem_row *prow, bv_cols selcols)
static const char * culture_to_text(int value)
static int get_mil_service(const struct player *pplayer)
void report_achievements(struct connection *pconn)
static const char * percent_to_text(int value)
static int secompare(const void *a, const void *b)
static int get_happypop(const struct player *pplayer)
static void plrdata_slot_free(struct plrdata_slot *plrdata)
static void page_conn(struct conn_list *dest, const char *caption, const char *headline, const char *lines)
static int get_settlers(const struct player *pplayer)
static int get_real_pop(const struct player *pplayer)
static int get_luxrate(const struct player *pplayer)
void log_civ_score_now(void)
static int get_units_lost(const struct player *pplayer)
static int get_gold(const struct player *pplayer)
#define MAX_SCORELOG_LINE_LEN
static int get_cities(const struct player *pplayer)
static const char * mil_service_to_text(int value)
static int get_gov(const struct player *pplayer)
static int get_research(const struct player *pplayer)
struct research * research_get(const struct player *pplayer)
int total_player_citizens(const struct player *pplayer)
int compare_strings_strvec(const char *const *first, const char *const *second)
const char * int_to_text(unsigned int number)
#define specialist_type_iterate_end
#define specialist_type_iterate(sp)
void strvec_sort(struct strvec *psv, int(*sort_func)(const char *const *, const char *const *))
void strvec_from_str(struct strvec *psv, char separator, const char *str)
struct strvec * strvec_new(void)
void strvec_remove_duplicate(struct strvec *psv, int(*cmp_func)(const char *, const char *))
#define strvec_iterate(psv, str)
#define strvec_iterate_end
char scorefile[MAX_LEN_PATH]
char demography[MAX_LEN_DEMOGRAPHY]
struct conn_list * est_connections
struct packet_game_info info
enum scorelog_level scoreloglevel
struct packet_scenario_info scenario
struct civ_game::@32::@36 server
int(* get_value)(const struct player *)
bool greater_values_are_better
char title[REPORT_TITLESIZE]
char body[REPORT_BODYSIZE]
struct plrdata_slot * plrdata
char category_name[32][MAX_LEN_NAME]
char headline[MAX_LEN_MSG]
char caption[MAX_LEN_MSG]
const struct player * player
struct city_list * cities
struct player_economic economic
struct player_score score
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)
size_t fc_strlcat(char *dest, const char *src, size_t n)
int cat_snprintf(char *str, size_t n, const char *format,...)
FILE * fc_fopen(const char *filename, const char *opentype)
#define sz_strlcpy(dest, src)
#define sz_strlcat(dest, src)
#define fc_strncmp(_s1_, _s2_, _len_)
int team_pretty_name(const struct team *pteam, char *buf, size_t buf_len)
static int best_value(const void *a, const void *b)
bool unit_can_do_action(const struct unit *punit, const action_id act_id)
bool is_special_unit(const struct unit *punit)
#define unit_list_iterate(unitlist, punit)
#define unit_list_iterate_end