Freeciv21
Develop your civilization from humble roots to a global empire
report.cpp File Reference
#include <fc_config.h>
#include <cstdio>
#include <cstring>
#include <math.h>
#include "bitvector.h"
#include "fciconv.h"
#include "fcintl.h"
#include "log.h"
#include "rand.h"
#include "support.h"
#include "achievements.h"
#include "calendar.h"
#include "connection.h"
#include "events.h"
#include "game.h"
#include "government.h"
#include "nation.h"
#include "packets.h"
#include "player.h"
#include "research.h"
#include "specialist.h"
#include "unitlist.h"
#include "version.h"
#include "plrhand.h"
#include "score.h"
#include "srv_main.h"
#include "report.h"
+ Include dependency graph for report.cpp:

Go to the source code of this file.

Classes

struct  plrdata_slot
 
struct  logging_civ_score
 
struct  player_score_entry
 
struct  city_score_entry
 
struct  dem_row
 
struct  dem_col
 

Macros

#define HISTORIAN_FIRST   HISTORIAN_RICHEST
 
#define HISTORIAN_LAST   HISTORIAN_LARGEST
 
#define GOOD_PLAYER(p)   ((p)->is_alive && !is_barbarian(p))
 

Enumerations

enum  historian_type {
  HISTORIAN_RICHEST = 0 , HISTORIAN_ADVANCED = 1 , HISTORIAN_MILITARY = 2 , HISTORIAN_HAPPIEST = 3 ,
  HISTORIAN_LARGEST = 4
}
 
enum  dem_flag { DEM_COL_QUANTITY , DEM_COL_RANK , DEM_COL_BEST , DEM_COL_LAST }
 

Functions

static void plrdata_slot_init (struct plrdata_slot *plrdata, const char *name)
 Allocate and initialize plrdata slot. More...
 
static void plrdata_slot_replace (struct plrdata_slot *plrdata, const char *name)
 Replace plrdata slot with new one named according to input parameter. More...
 
static void plrdata_slot_free (struct plrdata_slot *plrdata)
 Free resources allocated for plrdata slot. More...
 
static void page_conn_etype (struct conn_list *dest, const char *caption, const char *headline, const char *lines, enum event_type event)
 This function pops up a non-modal message dialog on the player's desktop. More...
 
static int get_great_wonders (const struct player *pplayer)
 Great wonders for wonder score. More...
 
static int get_total_score (const struct player *pplayer)
 Total score. More...
 
static int get_league_score (const struct player *pplayer)
 League score Score = N_techs^1. More...
 
static int get_population (const struct player *pplayer)
 Helper functions which return the value for the given player. More...
 
static int get_landarea (const struct player *pplayer)
 Land area controlled by player. More...
 
static int get_settledarea (const struct player *pplayer)
 Area settled. More...
 
static int get_research (const struct player *pplayer)
 Research speed. More...
 
static int get_income (const struct player *pplayer)
 Gold income. More...
 
static int get_production (const struct player *pplayer)
 Production of player. More...
 
static int get_economics (const struct player *pplayer)
 BNP of player. More...
 
static int get_agriculture (const struct player *pplayer)
 Food output. More...
 
static int get_pollution (const struct player *pplayer)
 Pollution of player. More...
 
static int get_mil_service (const struct player *pplayer)
 Military service length. More...
 
static int get_culture (const struct player *pplayer)
 Culture score. More...
 
static int get_pop (const struct player *pplayer)
 Number of citizen units of player. More...
 
static int get_cities (const struct player *pplayer)
 Number of cities. More...
 
static int get_improvements (const struct player *pplayer)
 Number of buildings in cities (not wonders) More...
 
static int get_all_wonders (const struct player *pplayer)
 All wonders, including small wonders. More...
 
static int get_mil_units (const struct player *pplayer)
 Military units. More...
 
static int get_units_built (const struct player *pplayer)
 Number of units built. More...
 
static int get_units_killed (const struct player *pplayer)
 Number of units killed. More...
 
static int get_units_lost (const struct player *pplayer)
 Number of units lost. More...
 
static const char * area_to_text (int value)
 Helper functions which transform the given value to a string depending on the unit. More...
 
static const char * percent_to_text (int value)
 Construct string containing value followed by ''. More...
 
static const char * production_to_text (int value)
 Construct string containing value followed by unit suitable for production stats. More...
 
static const char * economics_to_text (int value)
 Construct string containing value followed by unit suitable for economics stats. More...
 
static const char * agriculture_to_text (int value)
 Construct string containing value followed by unit suitable for agriculture stats. More...
 
static const char * science_to_text (int value)
 Construct string containing value followed by unit suitable for science stats. More...
 
static const char * income_to_text (int value)
 Construct string containing value followed by unit suitable for gold income stats. More...
 
static const char * mil_service_to_text (int value)
 Construct string containing value followed by unit suitable for military service stats. More...
 
static const char * pollution_to_text (int value)
 Construct string containing value followed by unit suitable for pollution stats. More...
 
static const char * culture_to_text (int value)
 Construct string containing value followed by unit suitable for culture stats. More...
 
static const char * citizenunits_to_text (int value)
 Construct string containing value followed by unit suitable for citizen unit stats. More...
 
static const char * cities_to_text (int value)
 Construct string containing value followed by unit suitable for city stats. More...
 
static const char * improvements_to_text (int value)
 Construct string containing value followed by unit suitable for improvement stats. More...
 
static const char * wonders_to_text (int value)
 Construct string containing value followed by unit suitable for wonders stats. More...
 
static const char * mil_units_to_text (int value)
 Construct string containing value followed by unit suitable for military unit stats. More...
 
static const char * score_to_text (int value)
 Construct string containing value followed by unit suitable for score stats. More...
 
 BV_DEFINE (bv_cols, DEM_COL_LAST)
 
static int secompare (const void *a, const void *b)
 Compare two player score entries. More...
 
static void historian_generic (struct history_report *report, enum historian_type which_news)
 Construct Historian Report. More...
 
void send_current_history_report (struct conn_list *dest)
 Send history report of this turn. More...
 
static int nr_wonders (struct city *pcity)
 Returns the number of wonders the given city has. More...
 
void report_top_five_cities (struct conn_list *dest)
 Send report listing the "best" 5 cities in the world. More...
 
void report_wonders_of_the_world (struct conn_list *dest)
 Send report listing all built and destroyed wonders, and wonders currently being built. More...
 
static int get_real_pop (const struct player *pplayer)
 Number of citizens of player. More...
 
static int get_techs (const struct player *pplayer)
 Number of techs. More...
 
static int get_munits (const struct player *pplayer)
 Number of military units. More...
 
static int get_settlers (const struct player *pplayer)
 Number of city building units. More...
 
static int get_techout (const struct player *pplayer)
 Technology output. More...
 
static int get_literacy2 (const struct player *pplayer)
 Literacy score calculated one way. More...
 
static int get_spaceship (const struct player *pplayer)
 Spaceship score. More...
 
static int get_gold (const struct player *pplayer)
 Amount of gold. More...
 
static int get_taxrate (const struct player *pplayer)
 Tax rate. More...
 
static int get_scirate (const struct player *pplayer)
 Science rate. More...
 
static int get_luxrate (const struct player *pplayer)
 Luxury rate. More...
 
static int get_riots (const struct player *pplayer)
 Number of rioting cities. More...
 
static int get_happypop (const struct player *pplayer)
 Number of happy citizens. More...
 
static int get_contentpop (const struct player *pplayer)
 Number of content citizens. More...
 
static int get_unhappypop (const struct player *pplayer)
 Number of unhappy citizens. More...
 
static int get_specialists (const struct player *pplayer)
 Number of specialists. More...
 
static int get_gov (const struct player *pplayer)
 Current government. More...
 
static int get_corruption (const struct player *pplayer)
 Total corruption. More...
 
static const char * value_units (int val, const char *uni)
 Construct string containing value and its unit. More...
 
static void dem_line_item (char *outptr, size_t out_size, struct player *pplayer, struct dem_row *prow, bv_cols selcols)
 Construct one demographics line. More...
 
bool is_valid_demography (const char *demography, int *error)
 Verify that a given demography string is valid. More...
 
void report_demographics (struct connection *pconn)
 Send demographics report; what gets reported depends on value of demographics server option. More...
 
void report_achievements (struct connection *pconn)
 Send achievements list. More...
 
static bool scan_score_log (char *id)
 Reads the whole file denoted by fp. More...
 
void log_civ_score_init ()
 Initialize score logging system. More...
 
void log_civ_score_free ()
 Free resources allocated for score logging system. More...
 
void log_civ_score_now ()
 Create a log file of the civilizations so you can see what was happening. More...
 
void make_history_report ()
 Produce random history report if it's time for one. More...
 
void report_final_scores (struct conn_list *dest)
 Inform clients about player scores and statistics when the game ends. More...
 
void page_conn (struct conn_list *dest, const char *caption, const char *headline, const char *lines)
 This function pops up a non-modal message dialog on the player's desktop. More...
 
struct history_reporthistory_report_get ()
 Return current history report. More...
 

Variables

struct history_report latest_history_report = {-2}
 
static struct logging_civ_scorescore_log = nullptr
 
static const char * historian_message []
 
static const char * historian_name []
 
static const char scorelog_magic [] = "#FREECIV SCORELOG2 "
 
static struct dem_row rowtable []
 
static struct dem_col coltable [] = {{'q'}, {'r'}, {'b'}}
 
static const char * ranking []
 

Macro Definition Documentation

◆ GOOD_PLAYER

#define GOOD_PLAYER (   p)    ((p)->is_alive && !is_barbarian(p))

Definition at line 172 of file report.cpp.

◆ HISTORIAN_FIRST

#define HISTORIAN_FIRST   HISTORIAN_RICHEST

Definition at line 85 of file report.cpp.

◆ HISTORIAN_LAST

#define HISTORIAN_LAST   HISTORIAN_LARGEST

Definition at line 86 of file report.cpp.

Enumeration Type Documentation

◆ dem_flag

enum dem_flag
Enumerator
DEM_COL_QUANTITY 
DEM_COL_RANK 
DEM_COL_BEST 
DEM_COL_LAST 

Definition at line 211 of file report.cpp.

◆ historian_type

Enumerator
HISTORIAN_RICHEST 
HISTORIAN_ADVANCED 
HISTORIAN_MILITARY 
HISTORIAN_HAPPIEST 
HISTORIAN_LARGEST 

Definition at line 77 of file report.cpp.

Function Documentation

◆ agriculture_to_text()

static const char * agriculture_to_text ( int  value)
static

Construct string containing value followed by unit suitable for agriculture stats.

Definition at line 948 of file report.cpp.

◆ area_to_text()

static const char * area_to_text ( int  value)
static

Helper functions which transform the given value to a string depending on the unit.

Definition at line 908 of file report.cpp.

◆ BV_DEFINE()

BV_DEFINE ( bv_cols  ,
DEM_COL_LAST   
)

◆ cities_to_text()

static const char * cities_to_text ( int  value)
static

Construct string containing value followed by unit suitable for city stats.

Definition at line 1024 of file report.cpp.

◆ citizenunits_to_text()

static const char * citizenunits_to_text ( int  value)
static

Construct string containing value followed by unit suitable for citizen unit stats.

Definition at line 1006 of file report.cpp.

◆ culture_to_text()

static const char * culture_to_text ( int  value)
static

Construct string containing value followed by unit suitable for culture stats.

Definition at line 996 of file report.cpp.

◆ dem_line_item()

static void dem_line_item ( char *  outptr,
size_t  out_size,
struct player pplayer,
struct dem_row prow,
bv_cols  selcols 
)
static

Construct one demographics line.

Definition at line 1059 of file report.cpp.

Referenced by report_demographics().

◆ economics_to_text()

static const char * economics_to_text ( int  value)
static

Construct string containing value followed by unit suitable for economics stats.

Definition at line 938 of file report.cpp.

◆ get_agriculture()

static int get_agriculture ( const struct player pplayer)
static

Food output.

Definition at line 590 of file report.cpp.

◆ get_all_wonders()

static int get_all_wonders ( const struct player pplayer)
static

All wonders, including small wonders.

Definition at line 638 of file report.cpp.

◆ get_cities()

static int get_cities ( const struct player pplayer)
static

Number of cities.

Definition at line 622 of file report.cpp.

Referenced by log_civ_score_now(), and report_final_scores().

◆ get_contentpop()

static int get_contentpop ( const struct player pplayer)
static

Number of content citizens.

Definition at line 809 of file report.cpp.

Referenced by log_civ_score_now().

◆ get_corruption()

static int get_corruption ( const struct player pplayer)
static

Total corruption.

Definition at line 846 of file report.cpp.

Referenced by log_civ_score_now().

◆ get_culture()

static int get_culture ( const struct player pplayer)
static

Culture score.

Definition at line 885 of file report.cpp.

Referenced by log_civ_score_now(), and report_final_scores().

◆ get_economics()

static int get_economics ( const struct player pplayer)
static

BNP of player.

Definition at line 582 of file report.cpp.

Referenced by log_civ_score_now(), and report_final_scores().

◆ get_gold()

static int get_gold ( const struct player pplayer)
static

Amount of gold.

Definition at line 751 of file report.cpp.

Referenced by log_civ_score_now().

◆ get_gov()

static int get_gov ( const struct player pplayer)
static

Current government.

Definition at line 838 of file report.cpp.

Referenced by log_civ_score_now().

◆ get_great_wonders()

static int get_great_wonders ( const struct player pplayer)
static

Great wonders for wonder score.

Definition at line 694 of file report.cpp.

Referenced by log_civ_score_now(), and report_final_scores().

◆ get_happypop()

static int get_happypop ( const struct player pplayer)
static

Number of happy citizens.

Definition at line 801 of file report.cpp.

Referenced by log_civ_score_now().

◆ get_improvements()

static int get_improvements ( const struct player pplayer)
static

Number of buildings in cities (not wonders)

Definition at line 630 of file report.cpp.

◆ get_income()

static int get_income ( const struct player pplayer)
static

Gold income.

Definition at line 566 of file report.cpp.

◆ get_landarea()

static int get_landarea ( const struct player pplayer)
static

Land area controlled by player.

Definition at line 542 of file report.cpp.

Referenced by log_civ_score_now(), and report_final_scores().

◆ get_league_score()

static int get_league_score ( const struct player pplayer)
static

League score Score = N_techs^1.

7 + N_units_built + 3xN_units_killedx[N_units_killed/(N_units_lost+1)]^0.5

Definition at line 872 of file report.cpp.

◆ get_literacy2()

static int get_literacy2 ( const struct player pplayer)
static

Literacy score calculated one way.

See also get_literacy() to see alternative way.

Definition at line 711 of file report.cpp.

Referenced by log_civ_score_now().

◆ get_luxrate()

static int get_luxrate ( const struct player pplayer)
static

Luxury rate.

Definition at line 775 of file report.cpp.

Referenced by log_civ_score_now().

◆ get_mil_service()

static int get_mil_service ( const struct player pplayer)
static

Military service length.

Definition at line 606 of file report.cpp.

Referenced by report_final_scores().

◆ get_mil_units()

static int get_mil_units ( const struct player pplayer)
static

Military units.

Definition at line 614 of file report.cpp.

◆ get_munits()

static int get_munits ( const struct player pplayer)
static

Number of military units.

Definition at line 654 of file report.cpp.

Referenced by log_civ_score_now().

◆ get_pollution()

static int get_pollution ( const struct player pplayer)
static

Pollution of player.

Definition at line 598 of file report.cpp.

Referenced by log_civ_score_now().

◆ get_pop()

static int get_pop ( const struct player pplayer)
static

Number of citizen units of player.

Definition at line 526 of file report.cpp.

Referenced by get_real_pop(), and log_civ_score_now().

◆ get_population()

static int get_population ( const struct player pplayer)
static

Helper functions which return the value for the given player.

Population of player

Definition at line 518 of file report.cpp.

◆ get_production()

static int get_production ( const struct player pplayer)
static

Production of player.

Definition at line 574 of file report.cpp.

Referenced by log_civ_score_now(), and report_final_scores().

◆ get_real_pop()

static int get_real_pop ( const struct player pplayer)
static

Number of citizens of player.

Definition at line 534 of file report.cpp.

Referenced by report_final_scores().

◆ get_research()

static int get_research ( const struct player pplayer)
static

Research speed.

Definition at line 558 of file report.cpp.

Referenced by report_final_scores().

◆ get_riots()

static int get_riots ( const struct player pplayer)
static

Number of rioting cities.

Definition at line 783 of file report.cpp.

Referenced by log_civ_score_now().

◆ get_scirate()

static int get_scirate ( const struct player pplayer)
static

Science rate.

Definition at line 767 of file report.cpp.

Referenced by log_civ_score_now().

◆ get_settledarea()

static int get_settledarea ( const struct player pplayer)
static

Area settled.

Definition at line 550 of file report.cpp.

Referenced by log_civ_score_now(), and report_final_scores().

◆ get_settlers()

static int get_settlers ( const struct player pplayer)
static

Number of city building units.

Definition at line 673 of file report.cpp.

Referenced by log_civ_score_now().

◆ get_spaceship()

static int get_spaceship ( const struct player pplayer)
static

Spaceship score.

Definition at line 719 of file report.cpp.

Referenced by log_civ_score_now(), and report_final_scores().

◆ get_specialists()

static int get_specialists ( const struct player pplayer)
static

Number of specialists.

Definition at line 825 of file report.cpp.

Referenced by log_civ_score_now().

◆ get_taxrate()

static int get_taxrate ( const struct player pplayer)
static

Tax rate.

Definition at line 759 of file report.cpp.

Referenced by log_civ_score_now().

◆ get_techout()

static int get_techout ( const struct player pplayer)
static

Technology output.

Definition at line 702 of file report.cpp.

Referenced by log_civ_score_now().

◆ get_techs()

static int get_techs ( const struct player pplayer)
static

Number of techs.

Definition at line 646 of file report.cpp.

Referenced by log_civ_score_now(), and report_final_scores().

◆ get_total_score()

static int get_total_score ( const struct player pplayer)
static

Total score.

Definition at line 862 of file report.cpp.

Referenced by log_civ_score_now().

◆ get_unhappypop()

static int get_unhappypop ( const struct player pplayer)
static

Number of unhappy citizens.

Definition at line 817 of file report.cpp.

Referenced by log_civ_score_now().

◆ get_units_built()

static int get_units_built ( const struct player pplayer)
static

Number of units built.

Definition at line 727 of file report.cpp.

Referenced by log_civ_score_now(), and report_final_scores().

◆ get_units_killed()

static int get_units_killed ( const struct player pplayer)
static

Number of units killed.

Definition at line 735 of file report.cpp.

Referenced by log_civ_score_now(), and report_final_scores().

◆ get_units_lost()

static int get_units_lost ( const struct player pplayer)
static

Number of units lost.

Definition at line 743 of file report.cpp.

Referenced by log_civ_score_now(), and report_final_scores().

◆ historian_generic()

static void historian_generic ( struct history_report report,
enum historian_type  which_news 
)
static

Construct Historian Report.

Definition at line 263 of file report.cpp.

Referenced by make_history_report().

◆ history_report_get()

struct history_report* history_report_get ( )

Return current history report.

Definition at line 1877 of file report.cpp.

Referenced by sg_load_history(), and sg_save_history().

◆ improvements_to_text()

static const char * improvements_to_text ( int  value)
static

Construct string containing value followed by unit suitable for improvement stats.

Definition at line 1042 of file report.cpp.

◆ income_to_text()

static const char * income_to_text ( int  value)
static

Construct string containing value followed by unit suitable for gold income stats.

Definition at line 969 of file report.cpp.

◆ is_valid_demography()

bool is_valid_demography ( const char *  demography,
int *  error 
)

Verify that a given demography string is valid.

See game.demography. If the string is not valid the index of the first invalid character is return as 'error'.

Other settings callback functions are in settings.c, but this one uses static values from this file so it's done separately.

Definition at line 1128 of file report.cpp.

Referenced by demography_callback().

◆ log_civ_score_free()

void log_civ_score_free ( )

Free resources allocated for score logging system.

Definition at line 1474 of file report.cpp.

Referenced by log_civ_score_now(), scorelog_action(), and server_game_free().

◆ log_civ_score_init()

void log_civ_score_init ( )

Initialize score logging system.

Definition at line 1450 of file report.cpp.

Referenced by scorelog_action().

◆ log_civ_score_now()

void log_civ_score_now ( )

Create a log file of the civilizations so you can see what was happening.

Definition at line 1505 of file report.cpp.

Referenced by begin_turn(), and srv_scores().

◆ make_history_report()

void make_history_report ( )

Produce random history report if it's time for one.

Definition at line 1718 of file report.cpp.

Referenced by end_turn().

◆ mil_service_to_text()

static const char * mil_service_to_text ( int  value)
static

Construct string containing value followed by unit suitable for military service stats.

Definition at line 978 of file report.cpp.

◆ mil_units_to_text()

static const char * mil_units_to_text ( int  value)
static

Construct string containing value followed by unit suitable for military unit stats.

Definition at line 1015 of file report.cpp.

◆ nr_wonders()

static int nr_wonders ( struct city pcity)
static

Returns the number of wonders the given city has.

Definition at line 336 of file report.cpp.

Referenced by report_top_five_cities().

◆ page_conn()

void page_conn ( struct conn_list *  dest,
const char *  caption,
const char *  headline,
const char *  lines 
)

This function pops up a non-modal message dialog on the player's desktop.

Definition at line 1822 of file report.cpp.

Referenced by report_achievements(), report_demographics(), report_top_five_cities(), and report_wonders_of_the_world().

◆ page_conn_etype()

static void page_conn_etype ( struct conn_list *  dest,
const char *  caption,
const char *  headline,
const char *  lines,
enum event_type  event 
)
static

This function pops up a non-modal message dialog on the player's desktop.

event == E_REPORT: message should not be ignored by clients watching AI players with ai_popup_windows off. Example: Server Options, Demographics Report, etc.

event == E_BROADCAST_REPORT: message can safely be ignored by clients watching AI players with ai_popup_windows off. For example: Herodot's report... and similar messages.

Definition at line 1839 of file report.cpp.

Referenced by page_conn(), and send_current_history_report().

◆ percent_to_text()

static const char * percent_to_text ( int  value)
static

Construct string containing value followed by ''.

So value is already considered to be in units of 1/100.

Definition at line 918 of file report.cpp.

◆ plrdata_slot_free()

static void plrdata_slot_free ( struct plrdata_slot plrdata)
static

Free resources allocated for plrdata slot.

Definition at line 1290 of file report.cpp.

Referenced by log_civ_score_free(), log_civ_score_init(), log_civ_score_now(), and scan_score_log().

◆ plrdata_slot_init()

static void plrdata_slot_init ( struct plrdata_slot plrdata,
const char *  name 
)
static

Allocate and initialize plrdata slot.

Definition at line 1268 of file report.cpp.

Referenced by log_civ_score_now(), and scan_score_log().

◆ plrdata_slot_replace()

static void plrdata_slot_replace ( struct plrdata_slot plrdata,
const char *  name 
)
static

Replace plrdata slot with new one named according to input parameter.

Definition at line 1279 of file report.cpp.

Referenced by log_civ_score_now(), and plrdata_slot_init().

◆ pollution_to_text()

static const char * pollution_to_text ( int  value)
static

Construct string containing value followed by unit suitable for pollution stats.

Definition at line 987 of file report.cpp.

◆ production_to_text()

static const char * production_to_text ( int  value)
static

Construct string containing value followed by unit suitable for production stats.

Definition at line 927 of file report.cpp.

◆ report_achievements()

void report_achievements ( struct connection pconn)

Send achievements list.

Definition at line 1237 of file report.cpp.

Referenced by handle_report_req().

◆ report_demographics()

void report_demographics ( struct connection pconn)

Send demographics report; what gets reported depends on value of demographics server option.

Definition at line 1175 of file report.cpp.

Referenced by handle_report_req().

◆ report_final_scores()

void report_final_scores ( struct conn_list *  dest)

Inform clients about player scores and statistics when the game ends.

Called only from server/srv_main.c srv_scores()

Definition at line 1741 of file report.cpp.

Referenced by connection_attach_real(), and srv_scores().

◆ report_top_five_cities()

void report_top_five_cities ( struct conn_list *  dest)

Send report listing the "best" 5 cities in the world.

Definition at line 354 of file report.cpp.

Referenced by handle_report_req().

◆ report_wonders_of_the_world()

void report_wonders_of_the_world ( struct conn_list *  dest)

Send report listing all built and destroyed wonders, and wonders currently being built.

Definition at line 433 of file report.cpp.

Referenced by handle_report_req().

◆ scan_score_log()

static bool scan_score_log ( char *  id)
static

Reads the whole file denoted by fp.

Sets last_turn and id to the values contained in the file. Returns the player_names indexed by player_no at the end of the log file.

Returns TRUE iff the file had read successfully.

Definition at line 1303 of file report.cpp.

Referenced by log_civ_score_now().

◆ science_to_text()

static const char * science_to_text ( int  value)
static

Construct string containing value followed by unit suitable for science stats.

Definition at line 960 of file report.cpp.

◆ score_to_text()

static const char * score_to_text ( int  value)
static

Construct string containing value followed by unit suitable for score stats.

Definition at line 1033 of file report.cpp.

◆ secompare()

static int secompare ( const void *  a,
const void *  b 
)
static

Compare two player score entries.

Used as callback for qsort.

Definition at line 254 of file report.cpp.

Referenced by historian_generic(), report_final_scores(), and report_top_five_cities().

◆ send_current_history_report()

void send_current_history_report ( struct conn_list *  dest)

Send history report of this turn.

Definition at line 323 of file report.cpp.

Referenced by establish_new_connection(), and make_history_report().

◆ value_units()

◆ wonders_to_text()

static const char * wonders_to_text ( int  value)
static

Construct string containing value followed by unit suitable for wonders stats.

Definition at line 1051 of file report.cpp.

Variable Documentation

◆ coltable

struct dem_col coltable[] = {{'q'}, {'r'}, {'b'}}
static

◆ historian_message

const char* historian_message[]
static
Initial value:
= {
N_("%s %s reports on the RICHEST Civilizations in the World."),
N_("%s %s reports on the most ADVANCED Civilizations in the World."),
N_("%s %s reports on the most MILITARIZED Civilizations in the World."),
N_("%s %s reports on the HAPPIEST Civilizations in the World."),
N_("%s %s reports on the LARGEST Civilizations in the World.")}
#define N_(String)
Definition: fcintl.h:52

Definition at line 88 of file report.cpp.

Referenced by historian_generic().

◆ historian_name

const char* historian_name[]
static
Initial value:
= {
N_("Herodotus"),
N_("Thucydides"),
N_("Pliny the Elder"),
N_("Livy"),
N_("Toynbee"),
N_("Gibbon"),
N_("Ssu-ma Ch'ien"),
N_("Pan Ku")}

Definition at line 100 of file report.cpp.

Referenced by historian_generic().

◆ latest_history_report

struct history_report latest_history_report = {-2}

◆ ranking

const char* ranking[]
static

Definition at line 218 of file report.cpp.

Referenced by historian_generic().

◆ rowtable

struct dem_row rowtable[]
static
Initial value:
= {
{'s', N_("Score"), get_total_score, score_to_text, true},
{'z', N_("League Score"), get_league_score, score_to_text,
true},
{'N', N_("Population"), get_population, population_to_text, true},
{'n', N_("Population"), get_pop, citizenunits_to_text, true},
{'c', N_("Cities"), get_cities, cities_to_text, true},
{'i', N_("Improvements"), get_improvements, improvements_to_text, true},
{'w', N_("Wonders"), get_all_wonders, wonders_to_text, true},
{'A', N_("Land Area"), get_landarea, area_to_text, true},
{'S', N_("Settled Area"), get_settledarea, area_to_text, true},
{'L', N_("?ability:Literacy"), get_literacy, percent_to_text, true},
{'a', N_("Agriculture"), get_agriculture, agriculture_to_text, true},
{'P', N_("Production"), get_production, production_to_text, true},
{'E', N_("Economics"), get_economics, economics_to_text, true},
{'g', N_("Gold Income"), get_income, income_to_text, true},
{'R', N_("Research Speed"), get_research, science_to_text, true},
{'M', N_("Military Service"), get_mil_service, mil_service_to_text,
false},
{'m', N_("Military Units"), get_mil_units, mil_units_to_text, true},
{'u', N_("Built Units"), get_units_built, mil_units_to_text, true},
{'k', N_("Killed Units"), get_units_killed, mil_units_to_text, true},
{'l', N_("Lost Units"), get_units_lost, mil_units_to_text, true},
{'O', N_("Pollution"), get_pollution, pollution_to_text, true},
{'C', N_("Culture"), get_culture, culture_to_text, true}}
int get_literacy(const struct player *pplayer)
Literacy score calculated one way.
const char * population_to_text(int thousand_citizen)
Return a prettily formatted string containing the population text.
Definition: game.cpp:699
static int get_units_killed(const struct player *pplayer)
Number of units killed.
Definition: report.cpp:735
static int get_units_built(const struct player *pplayer)
Number of units built.
Definition: report.cpp:727
static const char * economics_to_text(int value)
Construct string containing value followed by unit suitable for economics stats.
Definition: report.cpp:938
static const char * production_to_text(int value)
Construct string containing value followed by unit suitable for production stats.
Definition: report.cpp:927
static const char * science_to_text(int value)
Construct string containing value followed by unit suitable for science stats.
Definition: report.cpp:960
static int get_pollution(const struct player *pplayer)
Pollution of player.
Definition: report.cpp:598
static int get_all_wonders(const struct player *pplayer)
All wonders, including small wonders.
Definition: report.cpp:638
static int get_economics(const struct player *pplayer)
BNP of player.
Definition: report.cpp:582
static int get_pop(const struct player *pplayer)
Number of citizen units of player.
Definition: report.cpp:526
static const char * mil_units_to_text(int value)
Construct string containing value followed by unit suitable for military unit stats.
Definition: report.cpp:1015
static const char * pollution_to_text(int value)
Construct string containing value followed by unit suitable for pollution stats.
Definition: report.cpp:987
static int get_production(const struct player *pplayer)
Production of player.
Definition: report.cpp:574
static const char * score_to_text(int value)
Construct string containing value followed by unit suitable for score stats.
Definition: report.cpp:1033
static int get_league_score(const struct player *pplayer)
League score Score = N_techs^1.
Definition: report.cpp:872
static int get_landarea(const struct player *pplayer)
Land area controlled by player.
Definition: report.cpp:542
static int get_total_score(const struct player *pplayer)
Total score.
Definition: report.cpp:862
static const char * area_to_text(int value)
Helper functions which transform the given value to a string depending on the unit.
Definition: report.cpp:908
static int get_population(const struct player *pplayer)
Helper functions which return the value for the given player.
Definition: report.cpp:518
static int get_improvements(const struct player *pplayer)
Number of buildings in cities (not wonders)
Definition: report.cpp:630
static int get_mil_units(const struct player *pplayer)
Military units.
Definition: report.cpp:614
static int get_culture(const struct player *pplayer)
Culture score.
Definition: report.cpp:885
static int get_income(const struct player *pplayer)
Gold income.
Definition: report.cpp:566
static const char * citizenunits_to_text(int value)
Construct string containing value followed by unit suitable for citizen unit stats.
Definition: report.cpp:1006
static const char * wonders_to_text(int value)
Construct string containing value followed by unit suitable for wonders stats.
Definition: report.cpp:1051
static int get_agriculture(const struct player *pplayer)
Food output.
Definition: report.cpp:590
static int get_settledarea(const struct player *pplayer)
Area settled.
Definition: report.cpp:550
static const char * agriculture_to_text(int value)
Construct string containing value followed by unit suitable for agriculture stats.
Definition: report.cpp:948
static const char * culture_to_text(int value)
Construct string containing value followed by unit suitable for culture stats.
Definition: report.cpp:996
static int get_mil_service(const struct player *pplayer)
Military service length.
Definition: report.cpp:606
static const char * cities_to_text(int value)
Construct string containing value followed by unit suitable for city stats.
Definition: report.cpp:1024
static const char * percent_to_text(int value)
Construct string containing value followed by ''.
Definition: report.cpp:918
static const char * improvements_to_text(int value)
Construct string containing value followed by unit suitable for improvement stats.
Definition: report.cpp:1042
static int get_units_lost(const struct player *pplayer)
Number of units lost.
Definition: report.cpp:743
static const char * income_to_text(int value)
Construct string containing value followed by unit suitable for gold income stats.
Definition: report.cpp:969
static int get_cities(const struct player *pplayer)
Number of cities.
Definition: report.cpp:622
static const char * mil_service_to_text(int value)
Construct string containing value followed by unit suitable for military service stats.
Definition: report.cpp:978
static int get_research(const struct player *pplayer)
Research speed.
Definition: report.cpp:558

Referenced by is_valid_demography(), and report_demographics().

◆ score_log

struct logging_civ_score* score_log = nullptr
static

◆ scorelog_magic

const char scorelog_magic[] = "#FREECIV SCORELOG2 "
static

Definition at line 118 of file report.cpp.

Referenced by log_civ_score_now(), and scan_score_log().