Complete.Org: Mailing Lists: Archives: freeciv-dev: December 2004:
[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: Tue, 14 Dec 2004 19:33:18 -0800
Reply-to: bugs@xxxxxxxxxxx

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

Here's a patch for the dev branch.  This one should probably be applied
soon...but it's still untested.

-jason

Index: client/packhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/packhand.c,v
retrieving revision 1.447
diff -u -r1.447 packhand.c
--- client/packhand.c   15 Dec 2004 00:49:23 -0000      1.447
+++ client/packhand.c   15 Dec 2004 03:32:44 -0000
@@ -2614,6 +2614,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.208
diff -u -r1.208 capstr.c
--- common/capstr.c     13 Dec 2004 16:20:53 -0000      1.208
+++ common/capstr.c     15 Dec 2004 03:32:46 -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.13"
+#define CAPABILITY "+Freeciv.Devel.2004.Dec.14"
 
 void init_our_capability(void)
 {
Index: common/game.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/game.h,v
retrieving revision 1.164
diff -u -r1.164 game.h
--- common/game.h       7 Dec 2004 18:39:06 -0000       1.164
+++ common/game.h       15 Dec 2004 03:32:47 -0000
@@ -220,6 +220,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.75
diff -u -r1.75 packets.def
--- common/packets.def  13 Dec 2004 16:20:53 -0000      1.75
+++ common/packets.def  15 Dec 2004 03:32:47 -0000
@@ -989,6 +989,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      15 Dec 2004 03:32:47 -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
+auotupgrade_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      15 Dec 2004 03:32:47 -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
+auotupgrade_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   15 Dec 2004 03:32:47 -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
+auotupgrade_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   15 Dec 2004 03:32:47 -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
+auotupgrade_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.215
diff -u -r1.215 ruleset.c
--- server/ruleset.c    8 Dec 2004 16:53:53 -0000       1.215
+++ server/ruleset.c    15 Dec 2004 03:32:48 -0000
@@ -2755,6 +2755,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) {
@@ -3189,7 +3192,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.313
diff -u -r1.313 unittools.c
--- server/unittools.c  9 Dec 2004 16:38:35 -0000       1.313
+++ server/unittools.c  15 Dec 2004 03:32:49 -0000
@@ -235,9 +235,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]