Complete.Org: Mailing Lists: Archives: freeciv-dev: January 2003:
[Freeciv-Dev] Re: (PR#725) Production upgrade of newly-researched units
Home

[Freeciv-Dev] Re: (PR#725) Production upgrade of newly-researched units

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: ChrisK@xxxxxxxx
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#725) Production upgrade of newly-researched units deferred
From: "Per I. Mathisen via RT" <rt@xxxxxxxxxxxxxx>
Date: Fri, 17 Jan 2003 00:33:44 -0800
Reply-to: rt@xxxxxxxxxxxxxx

On Fri, 17 Jan 2003, Jason Short via RT wrote:
> > The proposed solution is to reorder the handling of cities so that all
> > gold and science is generated first, then everything else (including
> > unit upgrades) is considered.
>
> Upon further review, this really is the only solution.

While we're at it, let's ensure that cities grow before producing
settlers. Here's Thomas's patch for this issue, which I haven't yet gotten
around to testing properly, let alone committing.

  - Per

--- server/cityturn.c.orig      2002-09-03 21:00:31.000000000 +0200
+++ server/cityturn.c   2002-09-03 21:35:35.000000000 +0200
@@ -566,7 +566,6 @@
 **************************************************************************/
 static void city_populate(struct city *pcity)
 {
-  pcity->food_stock+=pcity->food_surplus;
   if(pcity->food_stock >= city_granary_size(pcity->size) 
      || city_rapture_grow(pcity)) {
     city_increase_size(pcity);
@@ -1089,7 +1088,6 @@
 **************************************************************************/
 static bool city_build_stuff(struct player *pplayer, struct city *pcity)
 {
-  city_distribute_surplus_shields(pplayer, pcity);
   nullify_caravan_and_disband_plus(pcity);
 
   if (!pcity->is_building_unit) {
@@ -1265,8 +1263,28 @@
 
   /* reporting of celebrations rewritten, copying the treatment of disorder 
below,
      with the added rapture rounds count.  991219 -- Jing */
-  if (city_build_stuff(pplayer, pcity)) {
-    if (city_celebrating(pcity)) {
+
+  /*
+   * calculate food, production, trade of the old round
+   * (that should be done for all cities before they change - traderoutes)
+   *
+   * look for grow by rapturing 
+   * decide if growing by rapturing lets more in foodbox than normal
+   *
+   * build units/improvements
+   *
+   * 
+   * */
+
+  /* getting new shields and disbanding units when shieldsurplus < 0 */
+  city_distribute_surplus_shields(pplayer, pcity); 
+  pcity->food_stock+=pcity->food_surplus;
+
+  update_tech(pplayer, pcity->science_total);
+  pplayer->economic.gold+=pcity->tax_total;
+  pay_for_buildings(pplayer, pcity);
+
+  if (city_celebrating(pcity)) {
       pcity->rapture++;
       if (pcity->rapture == 1)
        notify_player_ex(pplayer, pcity->x, pcity->y, E_CITY_LOVE,
@@ -1302,10 +1320,6 @@
       pcity->airlift=TRUE;
     else
       pcity->airlift=FALSE;
-    update_tech(pplayer, pcity->science_total);
-    pplayer->economic.gold+=pcity->tax_total;
-    pay_for_buildings(pplayer, pcity);
-
     if(city_unhappy(pcity)) { 
       pcity->anarchy++;
       if (pcity->anarchy == 1) 
@@ -1334,7 +1348,7 @@
       handle_player_revolution(pplayer);
     }
     sanity_check_city(pcity);
-  }
+    city_build_stuff(pplayer, pcity);
 }
 
 /**************************************************************************

[Prev in Thread] Current Thread [Next in Thread]