diff --git a/common/player.h b/common/player.h index 31edb2cd90..ddbba6344f 100644 --- a/common/player.h +++ b/common/player.h @@ -81,15 +81,19 @@ struct player_score { int wonders; int techs; int techout; + int goldout; int landarea; int settledarea; int population; // in thousand of citizen int cities; + int improvements; + int all_wonders; int units; int pollution; int literacy; int bnp; int mfg; + int food; int spaceship; int units_built; // Number of units this player produced. int units_killed; // Number of enemy units killed. diff --git a/server/report.cpp b/server/report.cpp index 0bc153e4e9..1c119a7e4a 100644 --- a/server/report.cpp +++ b/server/report.cpp @@ -129,14 +129,17 @@ struct city_score_entry { int value; }; +static int get_great_wonders(const struct player *pplayer); static int get_total_score(const struct player *pplayer); static int get_league_score(const struct player *pplayer); 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_income(const struct player *pplayer); static int get_production(const struct player *pplayer); static int get_economics(const struct player *pplayer); +static int get_agriculture(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); @@ -144,6 +147,8 @@ static int get_pop( const struct player *pplayer); /* this would better be named get_citizenunits or such */ static int get_cities(const struct player *pplayer); +static int get_improvements(const struct player *pplayer); +static int get_all_wonders(const struct player *pplayer); static int get_mil_units(const struct player *pplayer); static int get_units_built(const struct player *pplayer); static int get_units_killed(const struct player *pplayer); @@ -153,12 +158,16 @@ 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 *agriculture_to_text(int value); static const char *science_to_text(int value); +static const char *income_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); static const char *citizenunits_to_text(int value); static const char *cities_to_text(int value); +static const char *improvements_to_text(int value); +static const char *wonders_to_text(int value); static const char *mil_units_to_text(int value); static const char *score_to_text(int value); @@ -180,13 +189,17 @@ static struct dem_row { {'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}, - {'R', N_("Research Speed"), get_research, science_to_text, true}, // TRANS: How literate people are. {'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}, @@ -549,6 +562,14 @@ static int get_research(const struct player *pplayer) return pplayer->score.techout; } +/** + Gold income + */ +static int get_income(const struct player *pplayer) +{ + return pplayer->score.goldout; +} + /** Production of player */ @@ -565,6 +586,14 @@ static int get_economics(const struct player *pplayer) return pplayer->score.bnp; } +/** + Food output + */ +static int get_agriculture(const struct player *pplayer) +{ + return pplayer->score.food; +} + /** Pollution of player */ @@ -597,6 +626,22 @@ static int get_cities(const struct player *pplayer) return pplayer->score.cities; } +/** + Number of buildings in cities (not wonders) + */ +static int get_improvements(const struct player *pplayer) +{ + return pplayer->score.improvements; +} + +/** + All wonders, including small wonders + */ +static int get_all_wonders(const struct player *pplayer) +{ + return pplayer->score.all_wonders; +} + /** Number of techs */ @@ -646,9 +691,9 @@ static int get_settlers(const struct player *pplayer) } /** - Wonder score + Great wonders for wonder score */ -static int get_wonders(const struct player *pplayer) +static int get_great_wonders(const struct player *pplayer) { return pplayer->score.wonders; } @@ -898,6 +943,18 @@ static const char *economics_to_text(int value) return value_units(value, PL_(" M goods", " M goods", value)); } +/** + Construct string containing value followed by unit suitable for + agriculture stats. + */ +static const char *agriculture_to_text(int value) +{ + /* TRANS: "M bushels" = million bushels, so always plural */ + // FIXME: value can go negative for food + + return value_units(value, PL_(" M bushels", " M bushels", value)); +} + /** Construct string containing value followed by unit suitable for science stats. @@ -907,6 +964,15 @@ static const char *science_to_text(int value) return value_units(value, PL_(" bulb", " bulbs", value)); } +/** +Construct string containing value followed by unit suitable for +gold income stats. + */ +static const char *income_to_text(int value) +{ + return value_units(value, PL_(" gold", " gold", value)); +} + /** Construct string containing value followed by unit suitable for military service stats. @@ -941,7 +1007,7 @@ static const char *culture_to_text(int value) */ static const char *citizenunits_to_text(int value) { - return value_units(value, PL_(" citizen unit", " citizen units", value)); + return value_units(value, PL_(" citizen", " citizens", value)); } /** @@ -971,6 +1037,24 @@ static const char *score_to_text(int value) return value_units(value, PL_(" point", " points", value)); } +/** + Construct string containing value followed by unit suitable for + improvement stats. + */ +static const char *improvements_to_text(int value) +{ + return value_units(value, PL_(" improvement", " improvements", value)); +} + +/** + Construct string containing value followed by unit suitable for + wonders stats. + */ +static const char *wonders_to_text(int value) +{ + return value_units(value, PL_(" wonder", " wonders", value)); +} + /** Construct one demographics line. */ @@ -1440,7 +1524,7 @@ void log_civ_score_now() {"munits", get_munits}, {"settlers", get_settlers}, // "original" tags end here - {"wonders", get_wonders}, + {"wonders", get_great_wonders}, {"techout", get_techout}, {"landarea", get_landarea}, {"settledarea", get_settledarea}, @@ -1670,7 +1754,7 @@ void report_final_scores(struct conn_list *dest) {N_("Cities\n"), get_cities}, {N_("Technologies\n"), get_techs}, {N_("Military Service\n(months)"), get_mil_service}, - {N_("Wonders\n"), get_wonders}, + {N_("Wonders\n"), get_great_wonders}, {N_("Research Speed\n(bulbs)"), get_research}, // TRANS: "sq. mi." is abbreviation for "square miles" {N_("Land Area\n(sq. mi.)"), get_landarea}, diff --git a/server/score.cpp b/server/score.cpp index ec7a7e9926..528246a26c 100644 --- a/server/score.cpp +++ b/server/score.cpp @@ -268,14 +268,18 @@ void calc_civ_score(struct player *pplayer) pplayer->score.wonders = 0; pplayer->score.techs = 0; pplayer->score.techout = 0; + pplayer->score.goldout = 0; pplayer->score.landarea = 0; pplayer->score.settledarea = 0; pplayer->score.population = 0; pplayer->score.cities = 0; + pplayer->score.improvements = 0; + pplayer->score.all_wonders = 0; pplayer->score.units = 0; pplayer->score.pollution = 0; pplayer->score.bnp = 0; pplayer->score.mfg = 0; + pplayer->score.food = 0; pplayer->score.literacy = 0; pplayer->score.spaceship = 0; pplayer->score.culture = player_culture(pplayer); @@ -301,8 +305,22 @@ void calc_civ_score(struct player *pplayer) pplayer->score.cities++; pplayer->score.pollution += pcity->pollution; pplayer->score.techout += pcity->prod[O_SCIENCE]; + /* XXX: BEFORE upkeep paid (consider gold_upkeep_style) */ + pplayer->score.goldout += pcity->prod[O_GOLD]; pplayer->score.bnp += pcity->surplus[O_TRADE]; - pplayer->score.mfg += pcity->surplus[O_SHIELD]; + pplayer->score.mfg += pcity->surplus[O_SHIELD]; /* after upkeep paid */ + pplayer->score.food += pcity->surplus[O_FOOD]; /* after upkeep paid */ + + city_built_iterate(pcity, impr) + { + /* Great wonders are also counted separately */ + if (is_improvement(impr)) { + pplayer->score.improvements++; + } else if (is_wonder(impr)) { + pplayer->score.all_wonders++; + } + } + city_built_iterate_end; bonus = get_final_city_output_bonus(pcity, O_SCIENCE) - 100; bonus = CLIP(0, bonus, 100); diff --git a/server/settings.cpp b/server/settings.cpp index b64c4eec81..28ae4f25ea 100644 --- a/server/settings.cpp +++ b/server/settings.cpp @@ -2821,12 +2821,16 @@ static struct setting settings[] = { " N = include Population\n" " n = include Population in Citizen Units\n" " c = include Cities\n" - " P = include Production\n" + " i = include Improvements\n" + " w = include Wonders\n" " A = include Land Area\n" - " L = include Literacy\n" - " R = include Research Speed\n" " S = include Settled Area\n" + " L = include Literacy\n" + " a = include Agriculture\n" + " P = include Production\n" " E = include Economics\n" + " g = include Gold Income\n" + " R = include Research Speed\n" " M = include Military Service\n" " m = include Military Units\n" " u = include Built Units\n"