Complete.Org: Mailing Lists: Archives: freeciv-dev: January 2003:
[Freeciv-Dev] (PR#2824) [Fwd: PATCH: Minor cleanup of city struct]
Home

[Freeciv-Dev] (PR#2824) [Fwd: PATCH: Minor cleanup of city struct]

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients:;
Subject: [Freeciv-Dev] (PR#2824) [Fwd: PATCH: Minor cleanup of city struct]
From: "Jason Short via RT" <rt@xxxxxxxxxxxxxx>
Date: Tue, 14 Jan 2003 20:29:17 -0800
Reply-to: rt@xxxxxxxxxxxxxx



-------- Original Message --------
Subject: [Freeciv-Dev] PATCH: Minor cleanup of city struct
Date: Wed, 15 Jan 2003 00:26:10 +0200
From: Joona Kiiski <zamar@xxxxxxxxxxxxxxxxxxxx>
To: freeciv-dev@xxxxxxxxxxx

Attached is a patch which removes one totally unused variable from city 
struct.

It was used years ago to save compatibility between 1.11.4 and 1.11.5-dev.

Unfortunately, you can't do this without capability... But there is no
other way.

-- 
Joona Kiiski <joona.kiiski@xxxxxx>


diff -Nur -Xfreeciv-orig/diff_ignore freeciv-orig/client/packhand.c 
freeciv-city-cleanup/client/packhand.c
--- freeciv-orig/client/packhand.c      2003-01-11 20:33:16.000000000 +0200
+++ freeciv-city-cleanup/client/packhand.c      2003-01-14 23:17:47.000000000 
+0200
@@ -419,7 +419,6 @@
   pcity->airlift=packet->airlift;
 
   pcity->turn_last_built=packet->turn_last_built;
-  pcity->turn_changed_target=packet->turn_changed_target;
   pcity->turn_founded = packet->turn_founded;
   pcity->changed_from_id=packet->changed_from_id;
   pcity->changed_from_is_unit=packet->changed_from_is_unit;
diff -Nur -Xfreeciv-orig/diff_ignore freeciv-orig/common/capstr.c 
freeciv-city-cleanup/common/capstr.c
--- freeciv-orig/common/capstr.c        2003-01-11 20:33:43.000000000 +0200
+++ freeciv-city-cleanup/common/capstr.c        2003-01-14 23:47:52.000000000 
+0200
@@ -74,7 +74,7 @@
  * are not directly related to the capability strings discussed here.)
  */
 
-#define CAPABILITY "+1.14.0 conn_info +occupied team tech_impr_gfx"
+#define CAPABILITY "+1.14.0 conn_info +occupied team tech_impr_gfx 
city_struct_minor_cleanup"
   
 /* "+1.14.0" is protocol for 1.14.0 release.
  *
@@ -88,6 +88,9 @@
  *
  * "tech_impr_gfx" is support for loading of ruleset-specified
  * technology and city improvement icons.
+ *
+ * "city_struct_minor_cleanup" just removes one unused variable from the
+ * city struct, but anyway affects network traffic.
  */
 
 void init_our_capability(void)
diff -Nur -Xfreeciv-orig/diff_ignore freeciv-orig/common/city.c 
freeciv-city-cleanup/common/city.c
--- freeciv-orig/common/city.c  2003-01-11 20:33:43.000000000 +0200
+++ freeciv-city-cleanup/common/city.c  2003-01-14 23:19:52.000000000 +0200
@@ -1238,14 +1238,6 @@
 
   if (apply_it) {
     pcity->shield_stock = shield_stock_after_adjustment;
-
-    if (new_class != orig_class) {
-      /* This is buggy; the interval between turns is not constant. */
-      pcity->turn_changed_target = game.year; 
-    } else {
-      /* Pretend we have changed nothing */
-      pcity->turn_changed_target = GAME_START_YEAR;
-    }
   }
 
   return shield_stock_after_adjustment;
diff -Nur -Xfreeciv-orig/diff_ignore freeciv-orig/common/city.h 
freeciv-city-cleanup/common/city.h
--- freeciv-orig/common/city.h  2003-01-11 20:33:43.000000000 +0200
+++ freeciv-city-cleanup/common/city.h  2003-01-14 23:18:14.000000000 +0200
@@ -265,7 +265,6 @@
   bool did_buy;
   bool did_sell, is_updated;
   int turn_last_built;       /* The last year in which something was built */
-  int turn_changed_target;    /* Suffer shield loss at most once per turn */
   int changed_from_id;       /* If changed this turn, what changed from (id) */
   bool changed_from_is_unit;   /* If changed this turn, what changed from 
(unit?) */
   int disbanded_shields;      /* If you disband unit in a city. Count them */
diff -Nur -Xfreeciv-orig/diff_ignore freeciv-orig/common/packets.c 
freeciv-city-cleanup/common/packets.c
--- freeciv-orig/common/packets.c       2003-01-11 20:33:46.000000000 +0200
+++ freeciv-city-cleanup/common/packets.c       2003-01-14 23:57:36.000000000 
+0200
@@ -1322,9 +1322,15 @@
   dio_put_uint16(&dout, req->shield_stock);
   dio_put_uint16(&dout, req->pollution);
   dio_put_uint8(&dout, req->currently_building);
-
+  
   dio_put_sint16(&dout, req->turn_last_built);
-  dio_put_sint16(&dout, req->turn_changed_target);
+  /* After new release, just remove this block! */
+  if (has_capability("city_struct_minor_cleanup", pc->capability)) {
+    /* nothing */
+  } else {
+    int dummy = 0;
+    dio_put_sint16(&dout, dummy);
+  }
   dio_put_uint8(&dout, req->changed_from_id);
   dio_put_uint16(&dout, req->before_change_shields);
 
@@ -1406,7 +1412,13 @@
   dio_get_uint8(&din, &packet->currently_building);
 
   dio_get_sint16(&din, &packet->turn_last_built);
-  dio_get_sint16(&din, &packet->turn_changed_target);
+  /* After new release, just remove this block! */
+  if (has_capability("city_struct_minor_cleanup", pc->capability)) {
+    /* nothing */
+  } else {
+    int dummy;
+    dio_get_sint16(&din, &dummy);
+  }
   dio_get_uint8(&din, &packet->changed_from_id);
   dio_get_uint16(&din, &packet->before_change_shields);
 
diff -Nur -Xfreeciv-orig/diff_ignore freeciv-orig/common/packets.h 
freeciv-city-cleanup/common/packets.h
--- freeciv-orig/common/packets.h       2003-01-11 20:33:46.000000000 +0200
+++ freeciv-city-cleanup/common/packets.h       2003-01-14 23:18:42.000000000 
+0200
@@ -352,7 +352,6 @@
   int currently_building;
 
   int turn_last_built;
-  int turn_changed_target;
   int changed_from_id;
   bool changed_from_is_unit;
   int before_change_shields;
diff -Nur -Xfreeciv-orig/diff_ignore freeciv-orig/server/citytools.c 
freeciv-city-cleanup/server/citytools.c
--- freeciv-orig/server/citytools.c     2003-01-11 20:34:15.000000000 +0200
+++ freeciv-city-cleanup/server/citytools.c     2003-01-14 23:20:18.000000000 
+0200
@@ -1029,7 +1029,6 @@
     update_all_effects();
   }
   pcity->turn_last_built = game.year;
-  pcity->turn_changed_target = game.year;
   pcity->changed_from_id = 0;
   pcity->changed_from_is_unit = FALSE;
   pcity->before_change_shields = 0;
@@ -1636,7 +1635,6 @@
   packet->currently_building=pcity->currently_building;
 
   packet->turn_last_built=pcity->turn_last_built;
-  packet->turn_changed_target=pcity->turn_changed_target;
   packet->turn_founded = pcity->turn_founded;
   packet->changed_from_id=pcity->changed_from_id;
   packet->changed_from_is_unit=pcity->changed_from_is_unit;
diff -Nur -Xfreeciv-orig/diff_ignore freeciv-orig/server/savegame.c 
freeciv-city-cleanup/server/savegame.c
--- freeciv-orig/server/savegame.c      2003-01-11 20:34:18.000000000 +0200
+++ freeciv-city-cleanup/server/savegame.c      2003-01-14 23:20:58.000000000 
+0200
@@ -771,9 +771,6 @@
     pcity->turn_last_built=
       secfile_lookup_int_default(file, GAME_START_YEAR,
                                 "player%d.c%d.turn_last_built", plrno, i);
-    pcity->turn_changed_target=
-      secfile_lookup_int_default(file, GAME_START_YEAR,
-                                "player%d.c%d.turn_changed_target", plrno, i);
     pcity->changed_from_id=
       secfile_lookup_int_default(file, pcity->currently_building,
                                 "player%d.c%d.changed_from_id", plrno, i);
@@ -1450,8 +1447,6 @@
                       plrno, i);
     secfile_insert_int(file, pcity->turn_last_built,
                       "player%d.c%d.turn_last_built", plrno, i);
-    secfile_insert_int(file, pcity->turn_changed_target,
-                      "player%d.c%d.turn_changed_target", plrno, i);
     secfile_insert_int(file, pcity->changed_from_id,
                       "player%d.c%d.changed_from_id", plrno, i);
     secfile_insert_bool(file, pcity->changed_from_is_unit,


[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#2824) [Fwd: PATCH: Minor cleanup of city struct], Jason Short via RT <=