diff -ru -X /home/jjm/cvs/no.freeciv FreecivCVS/client/options.c freeciv/client/options.c --- FreecivCVS/client/options.c Mon Jun 12 10:07:28 2000 +++ freeciv/client/options.c Wed Jun 14 13:17:34 2000 @@ -110,7 +110,8 @@ N_("Worklist Events "), /* E_WORKLIST */ N_("Pact Cancelled "), /* E_CANCEL_PACT */ N_("Diplomatic Incident "), /* E_DIPL_INCIDENT */ - N_("First Contact ") /* E_FIRST_CONTACT */ + N_("First Contact "), /* E_FIRST_CONTACT */ + N_("City May Soon Grow "), /* E_CITY_MAY_SOON_GROW */ }; /************************************************************************** diff -ru -X /home/jjm/cvs/no.freeciv FreecivCVS/common/events.h freeciv/common/events.h --- FreecivCVS/common/events.h Mon Jun 12 10:07:29 2000 +++ freeciv/common/events.h Wed Jun 14 13:17:34 2000 @@ -54,6 +54,7 @@ E_CANCEL_PACT, E_DIPL_INCIDENT, E_FIRST_CONTACT, + E_CITY_MAY_SOON_GROW, /* Note: If you add a new event, make sure you make a similar change to message_text in client/options.c */ diff -ru -X /home/jjm/cvs/no.freeciv FreecivCVS/server/cityturn.c freeciv/server/cityturn.c --- FreecivCVS/server/cityturn.c Sun May 28 00:46:53 2000 +++ freeciv/server/cityturn.c Wed Jun 14 13:32:20 2000 @@ -734,6 +734,42 @@ /************************************************************************** ... **************************************************************************/ +void send_city_turn_notifications(struct player *pplayer, struct city *pcity) +{ + int turns_growth, turns_granary; + + if (pcity->food_surplus > 0) { + turns_growth = (((pcity->size+1) * game.foodbox) - pcity->food_stock) + / pcity->food_surplus; + + if (!city_got_effect(pcity,B_GRANARY) && !pcity->is_building_unit && + (pcity->currently_building == B_GRANARY) && (pcity->shield_surplus > 0)) { + turns_granary = (improvement_value(B_GRANARY) - pcity->shield_stock) + / pcity->shield_surplus; + /* if growth and granary completion occur simultaneously, granary + preserves food. -AJS */ + if ((turns_growth < 5) && (turns_granary < 5) && + (turns_growth < turns_granary)) { + notify_player_ex(city_owner(pcity), pcity->x, pcity->y, + E_CITY_GRAN_THROTTLE, + _("Game: Suggest throttling growth in %s to use %s " + "(being built) more effectively."), pcity->name, + improvement_types[B_GRANARY].name); + } + } + + if (turns_growth <= 0) { + notify_player_ex(city_owner(pcity), pcity->x, pcity->y, + E_CITY_MAY_SOON_GROW, + _("Game: %s may soon grow to size %i."), + pcity->name, pcity->size + 1); + } + } +} + +/************************************************************************** +... +**************************************************************************/ void update_city_activities(struct player *pplayer) { int gold; @@ -1505,37 +1541,15 @@ { struct government *g = get_gov_pcity(pcity); int got_tech = 0; - int turns_growth, turns_granary; city_check_workers(pplayer, pcity); city_refresh(pcity); - if (!city_got_effect(pcity,B_GRANARY) && !pcity->is_building_unit && - (pcity->currently_building == B_GRANARY) && (pcity->food_surplus > 0) - && (pcity->shield_surplus > 0)) { - turns_growth = (((pcity->size+1) * game.foodbox) - pcity->food_stock) - / pcity->food_surplus; - turns_granary = (improvement_value(B_GRANARY) - pcity->shield_stock) - / pcity->shield_surplus; - /* if growth and granary completion occur simultaneously, granary - preserves food. -AJS */ - if ((turns_growth < 5) && (turns_granary < 5) && - (turns_growth < turns_granary)) { - notify_player_ex(city_owner(pcity), pcity->x, pcity->y, - E_CITY_GRAN_THROTTLE, - _("Game: %s suggest throttling growth to use %s " - "(being built) more effectively."), pcity->name, - improvement_types[B_GRANARY].name); - } - } - - -/* the AI often has widespread disorder when the Gardens or Oracle -become obsolete. This is a quick hack to prevent this. 980805 -- Syela */ + /* the AI often has widespread disorder when the Gardens or Oracle + become obsolete. This is a quick hack to prevent this. 980805 -- Syela */ while (pplayer->ai.control && city_unhappy(pcity)) { if (!ai_make_elvis(pcity)) break; } /* putting this lower in the routine would basically be cheating. -- Syela */ - /* reporting of celebrations rewritten, copying the treatment of disorder below, with the added rapture rounds count. 991219 -- Jing */ diff -ru -X /home/jjm/cvs/no.freeciv FreecivCVS/server/cityturn.h freeciv/server/cityturn.h --- FreecivCVS/server/cityturn.h Wed Jan 19 11:33:24 2000 +++ freeciv/server/cityturn.h Wed Jun 14 13:17:34 2000 @@ -32,6 +32,7 @@ /**** This part isn't meant to be used ****/ /* huh? which part? --dwp */ void city_auto_remove_worker(struct city *pcity); +void send_city_turn_notifications(struct player *pplayer, struct city *pcity); void update_city_activities(struct player *pplayer); void city_incite_cost(struct city *pcity); void remove_obsolete_buildings(struct player *plr); diff -ru -X /home/jjm/cvs/no.freeciv FreecivCVS/server/civserver.c freeciv/server/civserver.c --- FreecivCVS/server/civserver.c Mon Jun 12 10:07:35 2000 +++ freeciv/server/civserver.c Wed Jun 14 13:36:33 2000 @@ -860,12 +860,14 @@ } } +/************************************************************************** +... +**************************************************************************/ static int end_turn(void) { int i; - - nocity_send = 1; + nocity_send = 1; for(i=0; icities, pcity) { + send_city_turn_notifications(pplayer, pcity); + } + city_list_iterate_end; +} + /************************************************************************** ... **************************************************************************/ diff -ru -X /home/jjm/cvs/no.freeciv FreecivCVS/server/plrhand.h freeciv/server/plrhand.h --- FreecivCVS/server/plrhand.h Mon Jun 12 10:07:35 2000 +++ freeciv/server/plrhand.h Wed Jun 14 13:17:34 2000 @@ -68,6 +68,7 @@ void wonders_of_the_world(struct player *pplayer); void demographics_report(struct player *pplayer); void top_five_cities(struct player *pplayer); +void send_player_turn_notifications(struct player *pplayer); void make_history_report(void); void do_dipl_cost(struct player *pplayer); void do_free_cost(struct player *pplayer);