diff -ruN -Xcvs/diff_ignore cvs/client/gui-gtk/citydlg.c test/client/gui-gtk/citydlg.c --- cvs/client/gui-gtk/citydlg.c Mon Nov 19 15:46:25 2001 +++ test/client/gui-gtk/citydlg.c Tue Dec 4 11:37:39 2001 @@ -1668,7 +1668,7 @@ int i, style; char buf[NUM_INFO_FIELDS][512]; struct city *pcity = pdialog->pcity; - int granaryturns; + int granaryturns, shrinking; enum { FOOD, PROD, TRADE, GOLD, LUXURY, SCIENCE, GRANARY, GROWTH, CORRUPTION, POLLUTION }; @@ -1689,12 +1689,19 @@ my_snprintf(buf[SCIENCE], sizeof(buf[SCIENCE]), "%2d", pcity->science_total); - if (pcity->food_surplus > 0) { + shrinking = pcity->food_surplus < 0; + if ( pcity->food_stock + pcity->food_surplus >= + city_granary_size(pcity->size) ) { + /* capture special case in just conquered cities where food_stock + * becomes larger than granary_size when the city is chrunk */ + granaryturns = 1; + shrinking = 0; + } else if (pcity->food_surplus > 0) { granaryturns = (city_granary_size(pcity->size) - pcity->food_stock + pcity->food_surplus - 1) / pcity->food_surplus; } else if (pcity->food_surplus < 0) { - granaryturns = 1 - (pcity->food_stock / pcity->food_surplus); /* turns before famine loss */ + granaryturns = 1 - (pcity->food_stock / pcity->food_surplus); } else { granaryturns = 999; } @@ -1735,7 +1742,7 @@ info_label_style[style]); } - style = (granaryturns == 0 || pcity->food_surplus < 0) ? 2 : 0; + style = (granaryturns == 0 || shrinking) ? 2 : 0; gtk_widget_modify_style(pdialog->overview.info_label[GROWTH], info_label_style[style]); if (pdialog->pcity->owner == game.player_idx) {