--- freeciv/server/plrhand.c Mon Oct 11 10:55:20 1999 +++ freeciv-b/server/plrhand.c Thu Oct 28 12:41:06 1999 @@ -223,6 +223,18 @@ return place; } +static struct player *best_population() +{ + struct player *pplayer = &game.players[0]; + int i; + for(i = 1; i < game.nplayers; i++) { + if(game.players[i].score.population > pplayer->score.population) { + pplayer = &game.players[i]; + } + } + return pplayer; +} + static int rank_landarea(struct player *pplayer) { int basis=pplayer->score.landarea; @@ -235,6 +247,18 @@ return place; } +static struct player *best_landarea() +{ + struct player *pplayer = &game.players[0]; + int i; + for(i = 1; i < game.nplayers; i++) { + if(game.players[i].score.landarea > pplayer->score.landarea) { + pplayer = &game.players[i]; + } + } + return pplayer; +} + static int rank_settledarea(struct player *pplayer) { int basis=pplayer->score.settledarea; @@ -247,6 +271,18 @@ return place; } +static struct player *best_settledarea() +{ + struct player *pplayer = &game.players[0]; + int i; + for(i = 1; i < game.nplayers; i++) { + if(game.players[i].score.settledarea > pplayer->score.settledarea) { + pplayer = &game.players[i]; + } + } + return pplayer; +} + static int rank_calc_research(struct player *pplayer) { return (pplayer->score.techout*100)/(1+research_time(pplayer)); @@ -264,6 +300,18 @@ return place; } +static struct player *best_research() +{ + struct player *pplayer = &game.players[0]; + int i; + for(i = 1; i < game.nplayers; i++) { + if(rank_calc_research(&game.players[i]) > rank_calc_research(pplayer)) { + pplayer = &game.players[i]; + } + } + return pplayer; +} + static int rank_calc_literacy(struct player *pplayer) { int pop = civ_population(pplayer); @@ -289,6 +337,18 @@ return place; } +static struct player *best_literacy() +{ + struct player *pplayer = &game.players[0]; + int i; + for(i = 1; i < game.nplayers; i++) { + if(rank_calc_literacy(&game.players[i]) > rank_calc_literacy(pplayer)) { + pplayer = &game.players[i]; + } + } + return pplayer; +} + static int rank_production(struct player *pplayer) { int basis=pplayer->score.mfg; @@ -301,6 +361,18 @@ return place; } +static struct player *best_production() +{ + struct player *pplayer = &game.players[0]; + int i; + for(i = 1; i < game.nplayers; i++) { + if(game.players[i].score.mfg > pplayer->score.mfg) { + pplayer = &game.players[i]; + } + } + return pplayer; +} + static int rank_economics(struct player *pplayer) { int basis=pplayer->score.bnp; @@ -313,18 +385,42 @@ return place; } +static struct player *best_economics() +{ + struct player *pplayer = &game.players[0]; + int i; + for(i = 1; i < game.nplayers; i++) { + if(game.players[i].score.bnp > pplayer->score.bnp) { + pplayer = &game.players[i]; + } + } + return pplayer; +} + static int rank_pollution(struct player *pplayer) { int basis=pplayer->score.pollution; int place=1; int i; for (i=0;iscore.pollution) { + pplayer = &game.players[i]; + } + } + return pplayer; +} + static int rank_calc_mil_service(struct player *pplayer) { return (pplayer->score.units*50000)/(100+civ_population(pplayer)/100); @@ -336,12 +432,24 @@ int place=1; int i; for (i=0;ination), + int_to_text(best_player->score.population) ); + } break; case DEM_KEY_ROW_LAND_AREA: if (selcols & DEM_COL_QUANTITY) @@ -469,6 +588,14 @@ sprintf (outptr, fmt_rank, number_to_ordinal_string(rank_landarea(pplayer), TRUE)); } + if (selcols & DEM_COL_BEST && + player_has_embassy(pplayer,(best_player = best_landarea())) ) + { + outptr = strchr (outptr, '\0'); + sprintf (outptr, fmt_best, get_nation_name_plural(best_player->nation), + value_units (int_to_text(best_player->score.landarea), + _(" sq. mi."))); + } break; case DEM_KEY_ROW_SETTLED_AREA: if (selcols & DEM_COL_QUANTITY) @@ -484,6 +611,14 @@ sprintf (outptr, fmt_rank, number_to_ordinal_string(rank_settledarea(pplayer), TRUE)); } + if (selcols & DEM_COL_BEST && + player_has_embassy(pplayer,(best_player = best_settledarea())) ) + { + outptr = strchr (outptr, '\0'); + sprintf (outptr, fmt_best, get_nation_name_plural(best_player->nation), + value_units (int_to_text(best_player->score.settledarea), + _(" sq. mi."))); + } break; case DEM_KEY_ROW_RESEARCH_SPEED: if (selcols & DEM_COL_QUANTITY) @@ -499,6 +634,13 @@ sprintf (outptr, fmt_rank, number_to_ordinal_string(rank_research(pplayer), TRUE)); } + if (selcols & DEM_COL_BEST && + player_has_embassy(pplayer,(best_player = best_research())) ) + { + outptr = strchr (outptr, '\0'); + sprintf (outptr, fmt_best, get_nation_name_plural(best_player->nation), + value_units(int_to_text(rank_calc_research(best_player)),"%")); + } break; case DEM_KEY_ROW_LITERACY: if (selcols & DEM_COL_QUANTITY) @@ -514,6 +656,13 @@ sprintf (outptr, fmt_rank, number_to_ordinal_string(rank_literacy(pplayer), TRUE)); } + if (selcols & DEM_COL_BEST && + player_has_embassy(pplayer,(best_player = best_literacy())) ) + { + outptr = strchr (outptr, '\0'); + sprintf (outptr, fmt_best, get_nation_name_plural(best_player->nation), + value_units(int_to_text(rank_calc_literacy(best_player)),"%")); + } break; case DEM_KEY_ROW_PRODUCTION: if (selcols & DEM_COL_QUANTITY) @@ -529,6 +678,13 @@ sprintf (outptr, fmt_rank, number_to_ordinal_string(rank_production(pplayer), TRUE)); } + if (selcols & DEM_COL_BEST && + player_has_embassy(pplayer,(best_player = best_production())) ) + { + outptr = strchr (outptr, '\0'); + sprintf (outptr, fmt_best, get_nation_name_plural(best_player->nation), + value_units(int_to_text(best_player->score.mfg), _(" M tons"))); + } break; case DEM_KEY_ROW_ECONOMICS: if (selcols & DEM_COL_QUANTITY) @@ -544,6 +700,13 @@ sprintf (outptr, fmt_rank, number_to_ordinal_string(rank_economics(pplayer), TRUE)); } + if (selcols & DEM_COL_BEST && + player_has_embassy(pplayer,(best_player = best_economics())) ) + { + outptr = strchr (outptr, '\0'); + sprintf (outptr, fmt_best, get_nation_name_plural(best_player->nation), + value_units(int_to_text(best_player->score.bnp), _(" M goods"))); + } break; case DEM_KEY_ROW_MILITARY_SERVICE: if (selcols & DEM_COL_QUANTITY) @@ -559,6 +722,14 @@ sprintf (outptr, fmt_rank, number_to_ordinal_string(rank_mil_service(pplayer), TRUE)); } + if (selcols & DEM_COL_BEST && + player_has_embassy(pplayer,(best_player = best_mil_service())) ) + { + outptr = strchr (outptr, '\0'); + sprintf (outptr, fmt_best, get_nation_name_plural(best_player->nation), + value_units( int_to_text(rank_calc_mil_service(best_player)), + _(" months"))); + } break; case DEM_KEY_ROW_POLLUTION: if (selcols & DEM_COL_QUANTITY) @@ -574,6 +745,13 @@ sprintf (outptr, fmt_rank, number_to_ordinal_string(rank_pollution(pplayer), TRUE)); } + if (selcols & DEM_COL_BEST && + player_has_embassy(pplayer,(best_player = best_pollution())) ) + { + outptr = strchr (outptr, '\0'); + sprintf (outptr, fmt_best, get_nation_name_plural(best_player->nation), + value_units (int_to_text(best_player->score.pollution), _(" tons"))); + } break; } } @@ -601,7 +779,8 @@ { DEM_KEY_ROW_MILITARY_SERVICE, N_("Military Service"), DEM_ROW }, { DEM_KEY_ROW_POLLUTION, N_("Pollution"), DEM_ROW }, { DEM_KEY_COL_QUANTITY, "", DEM_COL_QUANTITY }, - { DEM_KEY_COL_RANK, "", DEM_COL_RANK } + { DEM_KEY_COL_RANK, "", DEM_COL_RANK }, + { DEM_KEY_COL_BEST, "", DEM_COL_BEST } }; anyrows = FALSE; --- freeciv/server/stdinhand.c Tue Oct 5 12:46:15 1999 +++ freeciv-b/server/stdinhand.c Thu Oct 28 12:25:33 1999 @@ -493,6 +502,7 @@ " Additionally, the following characters control whether or not certain\n" " columns are displayed in the report:\n" " q = display \"quantity\" column r = display \"rank\" column\n" + " b = display \"best nation\" column\n" " (The order of these characters is not significant, but their case is.)"), game.demography, GAME_DEFAULT_DEMOGRAPHY }, --- freeciv/common/game.h Sun Oct 3 12:46:48 1999 +++ freeciv-b/common/game.h Thu Oct 28 12:27:09 1999 @@ -250,12 +253,16 @@ #define GAME_DEFAULT_SKILL_LEVEL 3 /* easy */ #define GAME_OLD_DEFAULT_SKILL_LEVEL 5 /* normal; for old save games */ -#define GAME_DEFAULT_DEMOGRAPHY "NASRLPEMOqr" +#define GAME_DEFAULT_DEMOGRAPHY "NASRLPEMOqrb" #define GAME_START_YEAR -4000