Freeciv-3.1
|
#include <stdio.h>
#include <string.h>
#include "bitvector.h"
#include "fciconv.h"
#include "fcintl.h"
#include "log.h"
#include "mem.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 "packets.h"
#include "player.h"
#include "research.h"
#include "specialist.h"
#include "unitlist.h"
#include "version.h"
#include "citytools.h"
#include "plrhand.h"
#include "score.h"
#include "srv_main.h"
#include "report.h"
Go to the source code of this file.
Data Structures | |
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 | MAX_SCORELOG_LINE_LEN (119 + 1) |
#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) |
static void | plrdata_slot_replace (struct plrdata_slot *plrdata, const char *name) |
static void | plrdata_slot_free (struct plrdata_slot *plrdata) |
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_population (const struct player *pplayer) |
static int | get_landarea (const struct player *pplayer) |
static int | get_settledarea (const struct player *pplayer) |
static int | get_research (const struct player *pplayer) |
static int | get_production (const struct player *pplayer) |
static int | get_economics (const struct player *pplayer) |
static int | get_pollution (const struct player *pplayer) |
static int | get_mil_service (const struct player *pplayer) |
static int | get_culture (const struct player *pplayer) |
static const char * | area_to_text (int value) |
static const char * | percent_to_text (int value) |
static const char * | production_to_text (int value) |
static const char * | economics_to_text (int value) |
static const char * | science_to_text (int value) |
static const char * | mil_service_to_text (int value) |
static const char * | pollution_to_text (int value) |
static const char * | culture_to_text (int value) |
BV_DEFINE (bv_cols, DEM_COL_LAST) | |
static int | secompare (const void *a, const void *b) |
static void | historian_generic (struct history_report *report, enum historian_type which_news) |
void | send_current_history_report (struct conn_list *dest) |
static int | nr_wonders (struct city *pcity) |
void | report_top_five_cities (struct conn_list *dest) |
void | report_wonders_of_the_world (struct conn_list *dest) |
static int | get_pop (const struct player *pplayer) |
static int | get_real_pop (const struct player *pplayer) |
static int | get_cities (const struct player *pplayer) |
static int | get_techs (const struct player *pplayer) |
static int | get_munits (const struct player *pplayer) |
static int | get_settlers (const struct player *pplayer) |
static int | get_wonders (const struct player *pplayer) |
static int | get_techout (const struct player *pplayer) |
static int | get_literacy2 (const struct player *pplayer) |
static int | get_spaceship (const struct player *pplayer) |
static int | get_units_built (const struct player *pplayer) |
static int | get_units_killed (const struct player *pplayer) |
static int | get_units_lost (const struct player *pplayer) |
static int | get_gold (const struct player *pplayer) |
static int | get_taxrate (const struct player *pplayer) |
static int | get_scirate (const struct player *pplayer) |
static int | get_luxrate (const struct player *pplayer) |
static int | get_riots (const struct player *pplayer) |
static int | get_happypop (const struct player *pplayer) |
static int | get_contentpop (const struct player *pplayer) |
static int | get_unhappypop (const struct player *pplayer) |
static int | get_specialists (const struct player *pplayer) |
static int | get_gov (const struct player *pplayer) |
static int | get_corruption (const struct player *pplayer) |
static int | get_total_score (const struct player *pplayer) |
static const char * | value_units (int val, const char *uni) |
static void | dem_line_item (char *outptr, size_t out_size, struct player *pplayer, struct dem_row *prow, bv_cols selcols) |
bool | is_valid_demography (const char *demography, int *error) |
void | report_demographics (struct connection *pconn) |
void | report_achievements (struct connection *pconn) |
static bool | scan_score_log (char *id) |
void | log_civ_score_init (void) |
void | log_civ_score_free (void) |
void | log_civ_score_now (void) |
void | make_history_report (void) |
void | report_final_scores (struct conn_list *dest) |
void | page_conn (struct conn_list *dest, const char *caption, const char *headline, const char *lines) |
struct history_report * | history_report_get (void) |
Variables | |
struct history_report | latest_history_report = { -2 } |
static struct logging_civ_score * | score_log = NULL |
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 [] |
#define GOOD_PLAYER | ( | p | ) | ((p)->is_alive && !is_barbarian(p)) |
#define HISTORIAN_FIRST HISTORIAN_RICHEST |
#define HISTORIAN_LAST HISTORIAN_LARGEST |
enum dem_flag |
enum historian_type |
|
static |
BV_DEFINE | ( | bv_cols | , |
DEM_COL_LAST | |||
) |
|
static |
|
static |
Construct one demographics line.
Definition at line 882 of file report.c.
Referenced by report_demographics().
|
static |
|
static |
Number of cities
Definition at line 558 of file report.c.
Referenced by log_civ_score_now(), and report_final_scores().
|
static |
Number of content citizens
Definition at line 723 of file report.c.
Referenced by log_civ_score_now().
|
static |
|
static |
Culture score
Definition at line 783 of file report.c.
Referenced by log_civ_score_now(), and report_final_scores().
|
static |
BNP of player
Definition at line 534 of file report.c.
Referenced by log_civ_score_now(), and report_final_scores().
|
static |
|
static |
|
static |
Number of happy citizens
Definition at line 715 of file report.c.
Referenced by log_civ_score_now().
|
static |
Land area controlled by player
Definition at line 502 of file report.c.
Referenced by log_civ_score_now(), and report_final_scores().
|
static |
Literacy score calculated one way. See also get_literacy() to see alternative way.
Definition at line 627 of file report.c.
Referenced by log_civ_score_now().
|
static |
|
static |
Military service length
Definition at line 550 of file report.c.
Referenced by report_final_scores().
|
static |
Number of military units
Definition at line 574 of file report.c.
Referenced by log_civ_score_now().
|
static |
|
static |
Number of citizen units of player
Definition at line 486 of file report.c.
Referenced by get_real_pop(), and log_civ_score_now().
|
static |
|
static |
Production of player
Definition at line 526 of file report.c.
Referenced by log_civ_score_now(), and report_final_scores().
|
static |
Number of citizens of player
Definition at line 494 of file report.c.
Referenced by report_final_scores().
|
static |
|
static |
Number of rioting cities
Definition at line 699 of file report.c.
Referenced by log_civ_score_now().
|
static |
|
static |
Area settled.
Definition at line 510 of file report.c.
Referenced by log_civ_score_now(), and report_final_scores().
|
static |
Number of city building units.
Definition at line 591 of file report.c.
Referenced by log_civ_score_now().
|
static |
Spaceship score
Definition at line 635 of file report.c.
Referenced by log_civ_score_now(), and report_final_scores().
|
static |
|
static |
|
static |
|
static |
Number of techs
Definition at line 566 of file report.c.
Referenced by log_civ_score_now(), and report_final_scores().
|
static |
|
static |
Number of unhappy citizens
Definition at line 731 of file report.c.
Referenced by log_civ_score_now().
|
static |
Number of units built
Definition at line 643 of file report.c.
Referenced by log_civ_score_now(), and report_final_scores().
|
static |
Number of units killed
Definition at line 651 of file report.c.
Referenced by log_civ_score_now(), and report_final_scores().
|
static |
Number of units lost
Definition at line 659 of file report.c.
Referenced by log_civ_score_now(), and report_final_scores().
|
static |
Wonder score
Definition at line 610 of file report.c.
Referenced by log_civ_score_now(), and report_final_scores().
|
static |
Construct Historian Report
Definition at line 238 of file report.c.
Referenced by make_history_report().
struct history_report * history_report_get | ( | void | ) |
Return current history report
Definition at line 1689 of file report.c.
Referenced by sg_load_history(), sg_load_history(), and sg_save_history().
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 946 of file report.c.
Referenced by demography_callback().
void log_civ_score_free | ( | void | ) |
Free resources allocated for score logging system
Definition at line 1302 of file report.c.
Referenced by log_civ_score_now(), scorelog_action(), and server_game_free().
void log_civ_score_init | ( | void | ) |
Initialize score logging system
Definition at line 1279 of file report.c.
Referenced by scorelog_action().
void log_civ_score_now | ( | void | ) |
Create a log file of the civilizations so you can see what was happening.
Definition at line 1332 of file report.c.
Referenced by begin_turn(), and srv_scores().
void make_history_report | ( | void | ) |
Produce random history report if it's time for one.
Definition at line 1533 of file report.c.
Referenced by end_turn().
|
static |
|
static |
Returns the number of wonders the given city has.
Definition at line 311 of file report.c.
Referenced by report_top_five_cities().
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 1634 of file report.c.
Referenced by report_achievements(), report_demographics(), report_top_five_cities(), and report_wonders_of_the_world().
|
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 1651 of file report.c.
Referenced by page_conn(), and send_current_history_report().
|
static |
|
static |
Free resources allocated for plrdata slot.
Definition at line 1110 of file report.c.
Referenced by log_civ_score_now(), and scan_score_log().
|
static |
Allocate and initialize plrdata slot.
Definition at line 1087 of file report.c.
Referenced by log_civ_score_now(), and scan_score_log().
|
static |
Replace plrdata slot with new one named according to input parameter.
Definition at line 1099 of file report.c.
Referenced by log_civ_score_now(), and plrdata_slot_init().
|
static |
|
static |
void report_achievements | ( | struct connection * | pconn | ) |
void report_demographics | ( | struct connection * | pconn | ) |
Send demographics report; what gets reported depends on value of demographics server option.
Definition at line 993 of file report.c.
Referenced by handle_report_req().
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 1555 of file report.c.
Referenced by connection_attach_real(), and srv_scores().
void report_top_five_cities | ( | struct conn_list * | dest | ) |
Send report listing the "best" 5 cities in the world.
Definition at line 327 of file report.c.
Referenced by handle_report_req().
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 401 of file report.c.
Referenced by handle_report_req().
|
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 1125 of file report.c.
Referenced by log_civ_score_now().
|
static |
|
static |
Compare two player score entries. Used as callback for qsort.
Definition at line 229 of file report.c.
Referenced by historian_generic(), report_final_scores(), and report_top_five_cities().
void send_current_history_report | ( | struct conn_list * | dest | ) |
Send history report of this turn.
Definition at line 298 of file report.c.
Referenced by establish_new_connection(), and make_history_report().
|
static |
Construct string containing value and its unit.
Definition at line 791 of file report.c.
Referenced by area_to_text(), culture_to_text(), economics_to_text(), mil_service_to_text(), percent_to_text(), pollution_to_text(), production_to_text(), and science_to_text().
|
static |
Referenced by is_valid_demography(), and report_demographics().
|
static |
Definition at line 89 of file report.c.
Referenced by historian_generic().
|
static |
struct history_report latest_history_report = { -2 } |
Definition at line 66 of file report.c.
Referenced by history_report_get(), log_civ_score_init(), make_history_report(), and send_current_history_report().
|
static |
Definition at line 193 of file report.c.
Referenced by historian_generic().
|
static |
Referenced by is_valid_demography(), and report_demographics().
|
static |
Definition at line 68 of file report.c.
Referenced by log_civ_score_free(), log_civ_score_init(), log_civ_score_now(), and scan_score_log().
|
static |
Definition at line 124 of file report.c.
Referenced by log_civ_score_now(), and scan_score_log().