Complete.Org: Mailing Lists: Archives: freeciv-dev: October 2004:
[Freeciv-Dev] (PR#10451) granary emptied if no acqueduct
Home

[Freeciv-Dev] (PR#10451) granary emptied if no acqueduct

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: ggracian@xxxxxxx
Subject: [Freeciv-Dev] (PR#10451) granary emptied if no acqueduct
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 8 Oct 2004 20:38:24 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=10451 >

> [eneg - Wed Oct 06 21:11:43 2004]:

> In recent cvs, when a city fills its granary at size 8 and has no
aqueduct, 
> the granary is emptied (or half emptied if there is a granary-building or 
> pyramids) even with aqueductloss 0.

Good report.  The aqueductloss is being reversed.  Here's a fix.  The
logic here is way too complicated, but it's hard to see how to simplify
it without adding potential rounding problems (we always want to round
down, but only at the end).

jason

? 1
? 2
? newtiles
Index: server/cityturn.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/cityturn.c,v
retrieving revision 1.267
diff -u -r1.267 cityturn.c
--- server/cityturn.c   30 Sep 2004 12:31:26 -0000      1.267
+++ server/cityturn.c   9 Oct 2004 03:36:40 -0000
@@ -461,8 +461,9 @@
                       pcity->name);
     }
     /* Granary can only hold so much */
-    new_food = (city_granary_size(pcity->size) * (100 - game.aqueductloss)
-               * savings_pct) / (100 * 100);
+    new_food = (city_granary_size(pcity->size)
+               * (100 * 100 - game.aqueductloss * (100 - savings_pct))
+               / (100 * 100));
     pcity->food_stock = MIN(pcity->food_stock, new_food);
     return;
   }

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