diff -r -u my_freeciv/common/city.c my_freeciv2/common/city.c --- my_freeciv/common/city.c Mon Jan 31 01:32:17 2000 +++ my_freeciv2/common/city.c Mon Jan 31 15:02:46 2000 @@ -930,9 +930,17 @@ int city_celebrating(struct city *pcity) { - struct government *g = get_gov_pcity(pcity); - return (pcity->size>=g->rapture_size && pcity->was_happy && city_happy(pcity)); + struct government *g = get_gov_pcity(pcity); + return (pcity->size>=g->rapture_size && pcity->was_happy && city_happy(pcity)); } + +int city_rapture_grow(struct city *pcity) +{ + struct government *g = get_gov_pcity(pcity); + return (pcity->rapture>0 && pcity->food_surplus>0 && + government_has_flag(g, G_RAPTURE_CITY_GROWTH)); +} + /* The find_city_by_id() code has returned from its trip to server land and * lives in common once again. There are two ways find_city_by_id() works. diff -r -u my_freeciv/common/city.h my_freeciv2/common/city.h --- my_freeciv/common/city.h Wed Jan 19 13:28:16 2000 +++ my_freeciv2/common/city.h Mon Jan 31 07:25:52 2000 @@ -236,6 +236,7 @@ int city_happy(struct city *pcity); /* generally use celebrating instead */ int city_unhappy(struct city *pcity); /* anarchy??? */ int city_celebrating(struct city *pcity); /* love the king ??? */ +int city_rapture_grow(struct city *pcity); /* improvement functions */ diff -r -u my_freeciv/server/cityturn.c my_freeciv2/server/cityturn.c --- my_freeciv/server/cityturn.c Mon Jan 31 01:30:51 2000 +++ my_freeciv2/server/cityturn.c Mon Jan 31 14:30:55 2000 @@ -773,6 +773,7 @@ { int have_square, x, y; int has_granary = city_got_effect(pcity, B_GRANARY); + int rapture_grow = city_rapture_grow(pcity); int new_food; if (!city_got_building(pcity, B_AQUEDUCT) @@ -814,10 +815,15 @@ } pcity->size++; - if (has_granary) - new_food = ((pcity->size+1) * game.foodbox) / 2; - else - new_food = 0; + /* Do not empty food stock if city is growing by celevbrating */ + if (rapture_grow) { + new_food = (pcity->size+1) * game.foodbox; + } else { + if (has_granary) + new_food = ((pcity->size+1) * game.foodbox) / 2; + else + new_food = 0; + } pcity->food_stock = MIN(pcity->food_stock, new_food); /* If there is enough food, and the city is big enough, @@ -879,7 +885,7 @@ static void city_populate(struct city *pcity) { pcity->food_stock+=pcity->food_surplus; - if(pcity->food_stock >= (pcity->size+1)*game.foodbox) + if(pcity->food_stock >= (pcity->size+1)*game.foodbox || city_rapture_grow(pcity)) city_increase_size(pcity); else if(pcity->food_stock<0) { /* FIXME: should this depend on units with ability to build @@ -1426,12 +1432,6 @@ city_check_workers(pplayer, pcity); city_refresh(pcity); - /* increase city size if it is in rapture -- jjm */ - if (city_celebrating(pcity) && government_has_flag(g, G_RAPTURE_CITY_GROWTH) && - pcity->size >= g->rapture_size && pcity->food_surplus > 0) { - city_increase_size(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)) { @@ -1480,12 +1480,14 @@ } pcity->was_happy=city_happy(pcity); - { - int id=pcity->id; - city_populate(pcity); - if(!city_list_find_id(&pplayer->cities, id)) - return 0; - } + + /* City population is updated here -- must be after the above rapture stuff. --Jing */ + { + int id=pcity->id; + city_populate(pcity); + if(!city_list_find_id(&pplayer->cities, id)) + return 0; + } pcity->is_updated=1;