Complete.Org: Mailing Lists: Archives: freeciv-dev: January 2005:
[Freeciv-Dev] (PR#9430) Bug?: Leonardo's Workshop cancels experience, ma
Home

[Freeciv-Dev] (PR#9430) Bug?: Leonardo's Workshop cancels experience, ma

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: ChrisK@xxxxxxxx, matt@xxxxxxxxxxxx, wmerriam@xxxxxxxxx
Subject: [Freeciv-Dev] (PR#9430) Bug?: Leonardo's Workshop cancels experience, makes green units.
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 7 Jan 2005 22:49:29 -0800
Reply-to: bugs@xxxxxxxxxxx

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

Here's a new patch.  It fixes typos in the ruleset as well as updating
the capstring.  I think it's ready for inclusion into the dev branch. 
Probably this shouldn't go into the stable branch but I don't feel
strongly on this (probably this is a bug in the stable branch, but there
is some chance of introducing a new bug with the patch so...).

-jason

Index: client/packhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/packhand.c,v
retrieving revision 1.455
diff -u -r1.455 packhand.c
--- client/packhand.c   21 Dec 2004 03:36:18 -0000      1.455
+++ client/packhand.c   8 Jan 2005 06:48:14 -0000
@@ -2574,6 +2574,7 @@
   game.rgame.tech_cost_style = packet->tech_cost_style;
   game.rgame.tech_leakage = packet->tech_leakage;
   game.rgame.tech_cost_double_year = packet->tech_cost_double_year;
+  game.rgame.autoupgrade_veteran_loss = packet->autoupgrade_veteran_loss;
   game.rgame.killstack = packet->killstack;
 
   for (i = 0; i < MAX_VET_LEVELS; i++) {
Index: common/capstr.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/capstr.c,v
retrieving revision 1.214
diff -u -r1.214 capstr.c
--- common/capstr.c     21 Dec 2004 03:37:38 -0000      1.214
+++ common/capstr.c     8 Jan 2005 06:48:14 -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.2004.Dec.21"
+#define CAPABILITY "+Freeciv.Devel.2005.Jan.8"
 
 void init_our_capability(void)
 {
Index: common/game.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/game.h,v
retrieving revision 1.168
diff -u -r1.168 game.h
--- common/game.h       24 Dec 2004 16:03:19 -0000      1.168
+++ common/game.h       8 Jan 2005 06:48:14 -0000
@@ -216,6 +216,8 @@
     int global_init_techs[MAX_NUM_TECH_LIST];
     int global_init_buildings[MAX_NUM_BUILDING_LIST];
 
+    int autoupgrade_veteran_loss;
+
     bool killstack;
   } rgame;
   
Index: common/packets.def
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/packets.def,v
retrieving revision 1.86
diff -u -r1.86 packets.def
--- common/packets.def  6 Jan 2005 00:35:50 -0000       1.86
+++ common/packets.def  8 Jan 2005 06:48:14 -0000
@@ -994,6 +994,7 @@
   UINT8 tech_leakage;
   TECH_LIST global_init_techs[MAX_NUM_TECH_LIST];
 
+  UINT8 autoupgrade_veteran_loss;
   BOOL killstack;
 
   UINT8 trireme_loss_chance[MAX_VET_LEVELS];
Index: data/civ1/game.ruleset
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/civ1/game.ruleset,v
retrieving revision 1.17
diff -u -r1.17 game.ruleset
--- data/civ1/game.ruleset      18 Nov 2004 09:56:35 -0000      1.17
+++ data/civ1/game.ruleset      8 Jan 2005 06:48:14 -0000
@@ -23,6 +23,9 @@
 min_city_center_shield = 0
 min_city_center_trade  = 0
 
+; Number of veteran levels lost when auto-upgrading a unit
+autoupgrade_veteran_loss = 255
+
 ; Minimum distance between cities (move distance).
 ; (Minimum value for this is 1, which means adjacent is okay.)
 min_dist_bw_cities     = 1
Index: data/civ2/game.ruleset
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/civ2/game.ruleset,v
retrieving revision 1.17
diff -u -r1.17 game.ruleset
--- data/civ2/game.ruleset      18 Nov 2004 09:56:35 -0000      1.17
+++ data/civ2/game.ruleset      8 Jan 2005 06:48:14 -0000
@@ -23,6 +23,9 @@
 min_city_center_shield = 1
 min_city_center_trade  = 0
 
+; Number of veteran levels lost when auto-upgrading a unit
+autoupgrade_veteran_loss = 255
+
 ; Minimum distance between cities (move distance).
 ; (Minimum value for this is 1, which means adjacent is okay.)
 min_dist_bw_cities     = 2
Index: data/default/game.ruleset
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/default/game.ruleset,v
retrieving revision 1.20
diff -u -r1.20 game.ruleset
--- data/default/game.ruleset   18 Nov 2004 09:56:35 -0000      1.20
+++ data/default/game.ruleset   8 Jan 2005 06:48:14 -0000
@@ -23,6 +23,9 @@
 min_city_center_shield = 1
 min_city_center_trade  = 0
 
+; Number of veteran levels lost when auto-upgrading a unit
+autoupgrade_veteran_loss = 0
+
 ; Minimum distance between cities (move distance).
 ; (Minimum value for this is 1, which means adjacent is okay.)
 min_dist_bw_cities     = 2
Index: data/history/game.ruleset
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/history/game.ruleset,v
retrieving revision 1.9
diff -u -r1.9 game.ruleset
--- data/history/game.ruleset   18 Nov 2004 09:56:35 -0000      1.9
+++ data/history/game.ruleset   8 Jan 2005 06:48:14 -0000
@@ -23,6 +23,9 @@
 min_city_center_shield = 1
 min_city_center_trade  = 0
 
+; Number of veteran levels lost when auto-upgrading a unit
+autoupgrade_veteran_loss = 0
+
 ; Minimum distance between cities (move distance).
 ; (Minimum value for this is 1, which means adjacent is okay.)
 min_dist_bw_cities     = 2
Index: server/ruleset.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/ruleset.c,v
retrieving revision 1.226
diff -u -r1.226 ruleset.c
--- server/ruleset.c    6 Jan 2005 00:35:51 -0000       1.226
+++ server/ruleset.c    8 Jan 2005 06:48:15 -0000
@@ -2676,6 +2676,9 @@
   game.rgame.tech_cost_double_year = 
       secfile_lookup_int_default(&file, 1, "civstyle.tech_cost_double_year");
 
+  game.rgame.autoupgrade_veteran_loss
+    = secfile_lookup_int(&file, "civstyle.autoupgrade_veteran_loss");
+
   game.rgame.tech_leakage =
       secfile_lookup_int(&file, "civstyle.tech_leakage");
   if (game.rgame.tech_leakage < 0 || game.rgame.tech_leakage > 3) {
@@ -3110,7 +3113,7 @@
         ARRAY_SIZE(game.rgame.global_init_techs));
   memcpy(misc_p.global_init_techs, game.rgame.global_init_techs,
         sizeof(misc_p.global_init_techs));
-
+  misc_p.autoupgrade_veteran_loss = game.rgame.autoupgrade_veteran_loss;
   misc_p.killstack = game.rgame.killstack;
   lsend_packet_ruleset_game(dest, &misc_p);
 }
Index: server/unittools.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/unittools.c,v
retrieving revision 1.314
diff -u -r1.314 unittools.c
--- server/unittools.c  16 Dec 2004 23:18:48 -0000      1.314
+++ server/unittools.c  8 Jan 2005 06:48:16 -0000
@@ -250,9 +250,15 @@
                  get_unit_type(upgrade_type)->name,
                  get_location_str_in(pplayer, punit->tile));
 
-    /* For historical reasons we negate the unit's veteran status.  Note that
-     * the upgraded unit may have the NoVeteran flag set. */
-    punit->veteran = 0;
+    /* For historical reasons some veteran status may be lost while
+     * upgrading.  Note that the upgraded unit may have the NoVeteran
+     * flag set. */
+    if (unit_type_flag(upgrade_type, F_NO_VETERAN)) {
+      punit->veteran = 0;
+    } else {
+      punit->veteran = MAX(punit->veteran
+                          - game.rgame.autoupgrade_veteran_loss, 0);
+    }
     assert(test_unit_upgrade(punit, TRUE) == UR_OK);
     upgrade_unit(punit, upgrade_type, TRUE);
     unit_list_unlink(&candidates, punit);

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#9430) Bug?: Leonardo's Workshop cancels experience, makes green units., Jason Short <=