diff -urN -X diff_ignore freeciv-cvs/client/cityrepdata.c freeciv-build/client/cityrepdata.c --- freeciv-cvs/client/cityrepdata.c Sat Nov 3 13:16:51 2001 +++ freeciv-build/client/cityrepdata.c Tue Nov 6 10:18:58 2001 @@ -21,6 +21,7 @@ #include "fcintl.h" #include "game.h" #include "support.h" +#include "map.h" #include "options.h" @@ -80,6 +81,37 @@ return buf; } +static char *cr_entry_happy(struct city *pcity) +{ + static char buf[8]; + my_snprintf(buf, sizeof(buf), "%2d", + pcity->ppl_happy[4]); + return buf; +} + +static char *cr_entry_content(struct city *pcity) +{ + static char buf[8]; + my_snprintf(buf, sizeof(buf), "%2d", + pcity->ppl_content[4]); + return buf; +} + +static char *cr_entry_unhappy(struct city *pcity) +{ + static char buf[8]; + my_snprintf(buf, sizeof(buf), "%2d", + pcity->ppl_unhappy[4]); + return buf; +} + +static char *cr_entry_angry(struct city *pcity) +{ + static char buf[8]; + my_snprintf(buf, sizeof(buf), "%2d", + pcity->ppl_angry[4]); + return buf; +} static char *cr_entry_specialists(struct city *pcity) { static char buf[32]; @@ -90,6 +122,115 @@ return buf; } +static char *cr_entry_entertainers(struct city *pcity) +{ + static char buf[8]; + my_snprintf(buf, sizeof(buf), "%2d", + pcity->ppl_elvis); + return buf; +} + +static char *cr_entry_scientists(struct city *pcity) +{ + static char buf[8]; + my_snprintf(buf, sizeof(buf), "%2d", + pcity->ppl_scientist); + return buf; +} + +static char *cr_entry_taxmen(struct city *pcity) +{ + static char buf[8]; + my_snprintf(buf, sizeof(buf), "%2d", + pcity->ppl_taxman); + return buf; +} + +static char *cr_entry_attack(struct city *pcity) +{ + static char buf[32]; + int attack_best[3] = {0,0,0}, break_now,i; + + unit_list_iterate(map_get_tile(pcity->x,pcity->y)->units, punit) + { + for(i=0,break_now=0; i<3 && !break_now; i++) + if(attack_best[i] <= get_unit_type(punit->type)->attack_strength) + { + if(i<2) + { + if(i<1) + attack_best[i+2] = attack_best[i+1]; + attack_best[i+1] = attack_best[i]; + } + + attack_best[i] = get_unit_type(punit->type)->attack_strength; + break_now=1; + } + } unit_list_iterate_end; + + my_snprintf(buf, sizeof(buf), "%d,%d,%d", attack_best[0], + attack_best[1], attack_best[2]); + + return buf; +} + +static char *cr_entry_defense(struct city *pcity) +{ + static char buf[32]; + int defense_best[3] = {0,0,0}, break_now,i; + + unit_list_iterate(map_get_tile(pcity->x,pcity->y)->units, punit) + { + for(i=0,break_now=0; i<3 && !break_now; i++) + if(defense_best[i] <= get_unit_type(punit->type)->defense_strength) + { + if(i<2) + { + if(i<1) + defense_best[i+2] = defense_best[i+1]; + defense_best[i+1] = defense_best[i]; + } + + defense_best[i] = get_unit_type(punit->type)->defense_strength; + break_now=1; + } + } unit_list_iterate_end; + + my_snprintf(buf, sizeof(buf), "%d,%d,%d", defense_best[0], + defense_best[1], defense_best[2]); + + return buf; +} + +static char *cr_entry_supported(struct city *pcity) +{ + static char buf[8]; + int supportedn=0; + + unit_list_iterate(pcity->units_supported,punit) { + supportedn++; + } unit_list_iterate_end; + + my_snprintf(buf, sizeof(buf), "%2d", supportedn); + + return buf; +} + +static char *cr_entry_present(struct city *pcity) +{ + static char buf[8]; + int presentn=0; + + unit_list_iterate(map_get_tile(pcity->x,pcity->y)->units, punit) { + presentn++; + } unit_list_iterate_end; + + my_snprintf(buf, sizeof(buf), "%2d", presentn); + + return buf; + +} + static char *cr_entry_resources(struct city *pcity) { static char buf[32]; @@ -100,6 +241,30 @@ return buf; } +static char *cr_entry_foodplus(struct city *pcity) +{ + static char buf[8]; + my_snprintf(buf, sizeof(buf), "%2d", + pcity->food_surplus); + return buf; +} + +static char *cr_entry_prodplus(struct city *pcity) +{ + static char buf[8]; + my_snprintf(buf, sizeof(buf), "%2d", + pcity->shield_surplus); + return buf; +} + +static char *cr_entry_tradeplus(struct city *pcity) +{ + static char buf[8]; + my_snprintf(buf, sizeof(buf), "%2d", + pcity->trade_prod); + return buf; +} + static char *cr_entry_output(struct city *pcity) { static char buf[32]; @@ -114,6 +279,36 @@ return buf; } +static char *cr_entry_gold(struct city *pcity) +{ + static char buf[8]; + int goldie; + + goldie = city_gold_surplus(pcity); + my_snprintf(buf, sizeof(buf), "%s%d", + (goldie < 0) ? "-" : (goldie > 0) ? "+" : "", + (goldie < 0) ? (-goldie) : goldie); + return buf; +} + +static char *cr_entry_luxyry(struct city *pcity) +{ + static char buf[8]; + + my_snprintf(buf, sizeof(buf), "%2d", + pcity->luxury_total); + return buf; +} + +static char *cr_entry_science(struct city *pcity) +{ + static char buf[8]; + + my_snprintf(buf, sizeof(buf), "%2d", + pcity->science_total); + return buf; +} + static char *cr_entry_food(struct city *pcity) { static char buf[32]; @@ -123,6 +318,21 @@ return buf; } +static char *cr_entry_growturns(struct city *pcity) +{ + static char buf[8]; + if(pcity->food_surplus > 0) + my_snprintf(buf, sizeof(buf), "%2d", + (city_granary_size(pcity->size)-pcity->food_stock)/ + pcity->food_surplus); + else if (pcity->food_surplus < 0) + my_snprintf(buf, sizeof(buf), "%2d", pcity->food_stock / + pcity->food_surplus); /* turns before famine loss */ + else + my_snprintf(buf, sizeof(buf), "999"); + return buf; +} + static char *cr_entry_pollution(struct city *pcity) { static char buf[8]; @@ -201,26 +411,83 @@ FUNC_TAG(hstate_verbose) }, { 0, 1, 1, NULL, NULL, N_("Concise *=Rapture, X=Disorder"), FUNC_TAG(hstate_concise) }, - { 1, 10, 1, N_("Workers"), N_("H/C/U/A"), - N_("Workers: Happy, Content, Unhappy, Angry"), + + { 1, 10, 1, N_("Workers"), N_("H/C/U"), + N_("Workers: Happy, Content, Unhappy"), FUNC_TAG(workers) }, - { 0, 7, 1, N_("Special"), N_("E/S/T"), + { 0, 2, 1, "", N_("Hap"), N_("Workers: Happy"), + FUNC_TAG(happy) }, + { 0, 2, 1, "", N_("Con"), N_("Workers: Content"), + FUNC_TAG(content) }, + { 0, 2, 1, "", N_("Unh"), N_("Workers: Unhappy"), + FUNC_TAG(unhappy) }, + { 0, 2, 1, "", N_("Ang"), N_("Workers: Angry"), + FUNC_TAG(angry) }, + { 0, 7, 1, N_("Special"), N_("E/S/T"), N_("Entertainers, Scientists, Taxmen"), - FUNC_TAG(specialists) }, + FUNC_TAG(specialists) }, + { 0, 2, 1, "", N_("Ent."), + N_("Entertainers"), + FUNC_TAG(entertainers) }, + { 0, 2, 1, "", N_("Sci."), + N_("Scientists"), + FUNC_TAG(scientists) }, + { 0, 2, 1, "", N_("Tax."), + N_("Taxmen"), + FUNC_TAG(taxmen) }, + + { 0, 8, 1, N_("Best"), N_("attack"), + N_("Attack power of best attacking units"), + FUNC_TAG(attack) }, + { 0, 8, 1, N_("Best"), N_("defense"), + N_("Defense power of best defensing units"), + FUNC_TAG(defense) }, + + { 1, 2, 1, N_("Units"), N_("sup."), + N_("Amount of supported units"), + FUNC_TAG(supported) }, + + { 0, 2, 1, N_("Units"), N_("pres."), + N_("Amount of present units"), + FUNC_TAG(present) }, + + { 1, 10, 1, N_("Surplus"), N_("F/P/T"), - N_("Surplus: Food, Production, Trade"), + N_("Surplus: Food, Production, Trade"), FUNC_TAG(resources) }, - { 1, 10, 1, N_("Economy"), N_("G/L/S"), - N_("Economy: Gold, Luxuries, Science"), + { 0, 2, 1, "", N_("F+"), + N_("Surplus: Food"), + FUNC_TAG(foodplus) }, + { 0, 2, 1, "", N_("P+"), N_("Surplus: Production"), + FUNC_TAG(prodplus) }, + { 0, 2, 1, "", N_("T+"), N_("Surplus: Trade"), + FUNC_TAG(tradeplus) }, + + { 1, 10, 1, N_("Economy"), N_("G/L/S"), + N_("Economy (trade): Gold, Luxuries, Science"), FUNC_TAG(output) }, + { 0, 2, 1, "", N_("T:G"), + N_("Economy (trade): Gold"), + FUNC_TAG(gold) }, + { 0, 2, 1, "", N_("T:L"), + N_("Economy (trade): Luxury"), + FUNC_TAG(luxyry) }, + { 0, 2, 1, "", N_("T:S"), + N_("Economy (trade): Science"), + FUNC_TAG(science) }, { 0, 1, 1, N_("n"), N_("T"), N_("Number of Trade Routes"), FUNC_TAG(num_trade) }, { 1, 7, 1, N_("Food"), N_("Stock"), N_("Food Stock"), FUNC_TAG(food) }, - { 0, 3, 1, NULL, N_("Pol"), N_("Pollution"), + { 1, 4, 1, N_("Grow"), N_("Turns"), N_("Turns before grow/population loss"), + FUNC_TAG(growturns) }, + + { 0, 3, 1, "", N_("Pol"), N_("Pollution"), FUNC_TAG(pollution) }, - { 0, 3, 1, NULL, N_("Cor"), N_("Corruption"), - FUNC_TAG(corruption) }, + { 0, 3, 1, "", N_("Cor"), N_("Corruption"), + FUNC_TAG(corruption) }, + + { 1, 0, 1, N_("Currently Building"), N_("(Stock,Target,Turns,Buy)"), N_("Currently Building"), FUNC_TAG(building) } diff -urN -X diff_ignore freeciv-cvs/client/cityrepdata.h freeciv-build/client/cityrepdata.h --- freeciv-cvs/client/cityrepdata.h Mon Dec 27 14:18:45 1999 +++ freeciv-build/client/cityrepdata.h Tue Nov 6 10:03:54 2001 @@ -19,7 +19,7 @@ #define REPORT_CITYNAME_ABBREV 15 /* Number of city report columns: have to set this manually now... */ -#define NUM_CREPORT_COLS 13 +#define NUM_CREPORT_COLS 30 struct city_report_spec { int show; /* modify this to customize */ diff -urN -X diff_ignore freeciv-cvs/client/gui-gtk/cityrep.c freeciv-build/client/gui-gtk/cityrep.c --- freeciv-cvs/client/gui-gtk/cityrep.c Sun Oct 21 16:57:13 2001 +++ freeciv-build/client/gui-gtk/cityrep.c Tue Nov 6 10:03:54 2001 @@ -1169,7 +1169,7 @@ *****************************************************************/ static void create_city_report_config_dialog(void) { - GtkWidget *config_label, *config_ok_command; + GtkWidget *config_label, *config_ok_command, *box, *box2; struct city_report_spec *spec; int i; @@ -1181,10 +1181,25 @@ gtk_box_pack_start(GTK_BOX(GTK_DIALOG(config_shell)->vbox), config_label, FALSE, FALSE, 0); + box = gtk_hbox_new(TRUE,0); + gtk_widget_show(box); + gtk_box_pack_start(GTK_BOX(GTK_DIALOG(config_shell)->vbox), box, + FALSE, FALSE, 0); + + box2 = gtk_vbox_new(FALSE,0); + gtk_widget_show(box2); + gtk_box_pack_start(GTK_BOX(box), box2, FALSE, FALSE, 0); + for(i=1, spec=city_report_specs+i; iexplanation)); + if(i==16||i==32) + { + box2 = gtk_vbox_new(FALSE,0); + gtk_widget_show(box2); + gtk_box_pack_start(GTK_BOX(box), box2, FALSE, FALSE, 0); + } + config_toggle[i]=gtk_check_button_new_with_label(_(spec->explanation)); - gtk_box_pack_start(GTK_BOX(GTK_DIALOG(config_shell)->vbox), config_toggle[i], + gtk_box_pack_start(GTK_BOX(box2), config_toggle[i], FALSE, FALSE, 0); }