Complete.Org: Mailing Lists: Archives: freeciv-dev: June 2005:
[Freeciv-Dev] (PR#12966) make foodbox and researchcost consistent
Home

[Freeciv-Dev] (PR#12966) make foodbox and researchcost consistent

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#12966) make foodbox and researchcost consistent
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 7 Jun 2005 21:12:16 -0700
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=12966 >

Here's an updated version of the patch.  It simply changes foodbox to be
a percentage value.

-jason

? diff
Index: common/capstr.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/capstr.c,v
retrieving revision 1.255
diff -u -r1.255 capstr.c
--- common/capstr.c     7 Jun 2005 06:20:05 -0000       1.255
+++ common/capstr.c     8 Jun 2005 04:08:36 -0000
@@ -82,7 +82,7 @@
  *     as long as possible.  We want to maintain network compatibility with
  *     the stable branch for as long as possible.
  */
-#define CAPABILITY "+Freeciv.Devel.2005.Jun.7-2"
+#define CAPABILITY "+Freeciv.Devel.2005.Jun.8"
 
 void init_our_capability(void)
 {
Index: common/city.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/city.c,v
retrieving revision 1.348
diff -u -r1.348 city.c
--- common/city.c       7 Jun 2005 06:17:11 -0000       1.348
+++ common/city.c       8 Jun 2005 04:08:36 -0000
@@ -1409,15 +1409,18 @@
 {
   int food_inis = game.info.granary_num_inis;
   int food_inc = game.info.granary_food_inc;
+  int base_value;
 
   /* Granary sizes for the first food_inis citizens are given directly.
    * After that we increase the granary size by food_inc per citizen. */
   if (city_size > food_inis) {
-    return (game.info.granary_food_ini[food_inis - 1] * game.info.foodbox
-           + food_inc * (city_size - food_inis) * game.info.foodbox / 100);
+    base_value = game.info.granary_food_ini[food_inis - 1];
+    base_value += food_inc * (city_size - food_inis);
   } else {
-    return game.info.granary_food_ini[city_size - 1] * game.info.foodbox;
+    base_value = game.info.granary_food_ini[city_size - 1];
   }
+
+  return MAX(base_value * game.info.foodbox / 100, 1);
 }
 
 /**************************************************************************
Index: common/game.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/game.h,v
retrieving revision 1.192
diff -u -r1.192 game.h
--- common/game.h       19 May 2005 16:58:23 -0000      1.192
+++ common/game.h       8 Jun 2005 04:08:37 -0000
@@ -186,6 +186,10 @@
 #define GAME_MIN_AIFILL              0
 #define GAME_MAX_AIFILL              GAME_MAX_MAX_PLAYERS
 
+#define GAME_DEFAULT_FOODBOX         100
+#define GAME_MIN_FOODBOX             1
+#define GAME_MAX_FOODBOX             10000
+
 #define GAME_DEFAULT_SCIENCEBOX 100
 #define GAME_MIN_SCIENCEBOX 1
 #define GAME_MAX_SCIENCEBOX 10000
@@ -248,10 +252,6 @@
 
 #define GAME_DEFAULT_NATURALCITYNAMES TRUE
 
-#define GAME_DEFAULT_FOODBOX         10
-#define GAME_MIN_FOODBOX             5
-#define GAME_MAX_FOODBOX             30
-
 #define GAME_DEFAULT_AQUEDUCTLOSS    0
 #define GAME_MIN_AQUEDUCTLOSS        0
 #define GAME_MAX_AQUEDUCTLOSS        100
Index: common/packets.def
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/packets.def,v
retrieving revision 1.132
diff -u -r1.132 packets.def
--- common/packets.def  7 Jun 2005 06:20:05 -0000       1.132
+++ common/packets.def  8 Jun 2005 04:08:37 -0000
@@ -365,7 +365,7 @@
   UINT8 unhappysize;
   UINT8 angrycitizen;
   UINT8 techpenalty;
-  UINT8 foodbox;
+  UINT32 foodbox;
   UINT32 sciencebox;
   UINT8 diplomacy;
   UINT8 dispersion;
Index: data/civ1/game.ruleset
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/civ1/game.ruleset,v
retrieving revision 1.18
diff -u -r1.18 game.ruleset
--- data/civ1/game.ruleset      29 Jan 2005 17:58:18 -0000      1.18
+++ data/civ1/game.ruleset      8 Jun 2005 04:08:37 -0000
@@ -52,8 +52,8 @@
 ;   if city_size > num_inis;
 ;     city_granary_size = (granary_food_ini[num_inis] * foodbox) +
 ;        (granary_food_inc * (city_size - num_inis)) * foodbox / 100
-granary_food_ini       = 2
-granary_food_inc       = 100
+granary_food_ini       = 20
+granary_food_inc       = 10
 
 ; Method of calculating technology costs
 ;   0 - Civ (I|II) style. Every new tech add researchcost to cost of next tech.
Index: data/civ2/game.ruleset
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/civ2/game.ruleset,v
retrieving revision 1.18
diff -u -r1.18 game.ruleset
--- data/civ2/game.ruleset      29 Jan 2005 17:58:18 -0000      1.18
+++ data/civ2/game.ruleset      8 Jun 2005 04:08:37 -0000
@@ -52,8 +52,8 @@
 ;   if city_size > num_inis;
 ;     city_granary_size = (granary_food_ini[num_inis] * foodbox) +
 ;        (granary_food_inc * (city_size - num_inis)) * foodbox / 100
-granary_food_ini       = 2
-granary_food_inc       = 100
+granary_food_ini       = 20
+granary_food_inc       = 10
 
 ; Method of calculating technology costs
 ;   0 - Civ (I|II) style. Every new tech add researchcost to cost of next tech.
Index: data/default/game.ruleset
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/default/game.ruleset,v
retrieving revision 1.21
diff -u -r1.21 game.ruleset
--- data/default/game.ruleset   29 Jan 2005 17:58:19 -0000      1.21
+++ data/default/game.ruleset   8 Jun 2005 04:08:38 -0000
@@ -48,12 +48,12 @@
 
 ; Parameters used to generalize the calculation of city granary size:
 ;   if city_size <= num_inis:
-;     city_granary_size = (granary_food_ini[city_size] * foodbox)
+;     city_granary_size = (granary_food_ini[city_size] * foodbox / 100)
 ;   if city_size > num_inis;
-;     city_granary_size = (granary_food_ini[num_inis] * foodbox) +
-;        (granary_food_inc * (city_size - num_inis)) * foodbox / 100
-granary_food_ini       = 2
-granary_food_inc       = 100
+;     city_granary_size = (granary_food_ini[num_inis] +
+;        granary_food_inc * (city_size - num_inis)) * foodbox / 100
+granary_food_ini       = 20
+granary_food_inc       = 10
 
 ; Method of calculating technology costs
 ;   0 - Civ (I|II) style. Every new tech add researchcost to cost of next tech.
Index: data/history/game.ruleset
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/history/game.ruleset,v
retrieving revision 1.10
diff -u -r1.10 game.ruleset
--- data/history/game.ruleset   29 Jan 2005 17:58:19 -0000      1.10
+++ data/history/game.ruleset   8 Jun 2005 04:08:38 -0000
@@ -52,8 +52,8 @@
 ;   if city_size > num_inis;
 ;     city_granary_size = (granary_food_ini[num_inis] * foodbox) +
 ;        (granary_food_inc * (city_size - num_inis)) * foodbox / 100
-granary_food_ini       = 2
-granary_food_inc       = 100
+granary_food_ini       = 20
+granary_food_inc       = 10
 
 ; Method of calculating technology costs
 ;   0 - Civ (I|II) style. Every new tech add researchcost to cost of next tech.
Index: server/savegame.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/savegame.c,v
retrieving revision 1.253
diff -u -r1.253 savegame.c
--- server/savegame.c   7 Jun 2005 06:17:14 -0000       1.253
+++ server/savegame.c   8 Jun 2005 04:08:39 -0000
@@ -3376,7 +3376,12 @@
       game.info.diplcost    = secfile_lookup_int(file, "game.diplcost");
       game.info.freecost    = secfile_lookup_int(file, "game.freecost");
       game.info.conquercost = secfile_lookup_int(file, "game.conquercost");
-      game.info.foodbox     = secfile_lookup_int(file, "game.foodbox");
+      game.info.foodbox
+       = secfile_lookup_int_default(file, 0, "game.box_food");
+      if (game.info.foodbox == 0) {
+       /* foodbox was used for 2.0 and earlier servers. */
+       game.info.foodbox = 10 * secfile_lookup_int(file, "game.foodbox");
+      }
       game.info.techpenalty = secfile_lookup_int(file, "game.techpenalty");
       game.info.razechance  = secfile_lookup_int(file, "game.razechance");
 
@@ -3922,11 +3927,12 @@
   secfile_insert_int(file, game.info.diplcost, "game.diplcost");
   secfile_insert_int(file, game.info.freecost, "game.freecost");
   secfile_insert_int(file, game.info.conquercost, "game.conquercost");
-  secfile_insert_int(file, game.info.foodbox, "game.foodbox");
+  secfile_insert_int(file, game.info.foodbox, "game.box_food");
   secfile_insert_int(file, game.info.sciencebox, "game.box_science");
   {
     /* These values are for compatibility with 2.0 and previous servers. */
     secfile_insert_int(file, game.info.sciencebox / 5, "game.researchcost");
+  secfile_insert_int(file, game.info.foodbox / 10, "game.foodbox");
   }
   secfile_insert_int(file, game.info.techpenalty, "game.techpenalty");
   secfile_insert_int(file, game.info.razechance, "game.razechance");

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#12966) make foodbox and researchcost consistent, Jason Short <=