Complete.Org: Mailing Lists: Archives: freeciv-dev: July 2004:
[Freeciv-Dev] (PR#9381) Bug: special case in city_buy_cost
Home

[Freeciv-Dev] (PR#9381) Bug: special case in city_buy_cost

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: jdorje@xxxxxxxxxxx
Subject: [Freeciv-Dev] (PR#9381) Bug: special case in city_buy_cost
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 29 Jul 2004 13:53:30 -0700
Reply-to: rt@xxxxxxxxxxx

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

Here is a patch.  Behavior is unchanged (except for upgrading a 0-shield
unit, which will be twice as expensive), but any future users of these
functions are more likely to be right.  (Earlier I wanted to use one of
these functions, and only after testing did I find that the results were
not correct.)

jason

Index: common/city.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/city.c,v
retrieving revision 1.233
diff -u -r1.233 city.c
--- common/city.c       20 Jul 2004 09:55:43 -0000      1.233
+++ common/city.c       29 Jul 2004 20:52:56 -0000
@@ -360,9 +360,6 @@
   } else {
     cost = impr_buy_gold_cost(pcity->currently_building, build);
   }
-  if (build == 0) {
-    cost *= 2;
-  }
   return cost;
 }
 
Index: common/improvement.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/improvement.c,v
retrieving revision 1.41
diff -u -r1.41 improvement.c
--- common/improvement.c        18 Jul 2004 17:09:39 -0000      1.41
+++ common/improvement.c        29 Jul 2004 20:52:57 -0000
@@ -189,6 +189,9 @@
   if (is_wonder(id)) {
     cost *= 2;
   }
+  if (shields_in_stock == 0) {
+    cost *= 2;
+  }
   return cost;
 }
 
Index: common/unittype.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/unittype.c,v
retrieving revision 1.37
diff -u -r1.37 unittype.c
--- common/unittype.c   20 Jul 2004 10:54:30 -0000      1.37
+++ common/unittype.c   29 Jul 2004 20:52:57 -0000
@@ -210,6 +210,9 @@
   if (missing > 0) {
     cost = 2 * missing + (missing * missing) / 20;
   }
+  if (shields_in_stock == 0) {
+    cost *= 2;
+  }
   return cost;
 }
 

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