Complete.Org: Mailing Lists: Archives: freeciv-dev: December 2004:
[Freeciv-Dev] (PR#11299) 2.0 and 2.0.99-devel aren't compatible
Home

[Freeciv-Dev] (PR#11299) 2.0 and 2.0.99-devel aren't compatible

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#11299) 2.0 and 2.0.99-devel aren't compatible
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 2 Dec 2004 11:18:58 -0800
Reply-to: rt@xxxxxxxxxxx

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

This patch adds a manditory capability to 2.0.99.

-jason

? diff
Index: client/connectdlg_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/connectdlg_common.c,v
retrieving revision 1.27
diff -u -r1.27 connectdlg_common.c
--- client/connectdlg_common.c  16 Nov 2004 18:09:46 -0000      1.27
+++ client/connectdlg_common.c  2 Dec 2004 19:17:06 -0000
@@ -413,36 +413,34 @@
 *****************************************************************/ 
 void send_client_wants_hack(const char *filename)
 {
-  if (has_capability("new_hack", aconnection.capability)) {
-    if (filename[0] != '\0') {
-      struct packet_single_want_hack_req req;
-      struct section_file file;
-
-      if (!is_filename_safe(filename)) {
-       return;
-      }
-
-      /* get the full filename path */
-      interpret_tilde(challenge_fullname, sizeof(challenge_fullname),
-         "~/.freeciv/");
-      make_dir(challenge_fullname);
-
-      sz_strlcat(challenge_fullname, filename);
-
-      /* generate an authentication token */ 
-      randomize_string(req.token, sizeof(req.token));
-
-      section_file_init(&file);
-      secfile_insert_str(&file, req.token, "challenge.token");
-      if (!section_file_save(&file, challenge_fullname, 0)) {
-       freelog(LOG_ERROR, "Couldn't write token to temporary file: %s",
-           challenge_fullname);
-      }
-      section_file_free(&file);
+  if (filename[0] != '\0') {
+    struct packet_single_want_hack_req req;
+    struct section_file file;
 
-      /* tell the server what we put into the file */ 
-      send_packet_single_want_hack_req(&aconnection, &req);
+    if (!is_filename_safe(filename)) {
+      return;
     }
+
+    /* get the full filename path */
+    interpret_tilde(challenge_fullname, sizeof(challenge_fullname),
+                   "~/.freeciv/");
+    make_dir(challenge_fullname);
+
+    sz_strlcat(challenge_fullname, filename);
+
+    /* generate an authentication token */ 
+    randomize_string(req.token, sizeof(req.token));
+
+    section_file_init(&file);
+    secfile_insert_str(&file, req.token, "challenge.token");
+    if (!section_file_save(&file, challenge_fullname, 0)) {
+      freelog(LOG_ERROR, "Couldn't write token to temporary file: %s",
+             challenge_fullname);
+    }
+    section_file_free(&file);
+
+    /* tell the server what we put into the file */ 
+    send_packet_single_want_hack_req(&aconnection, &req);
   }
 }
 
@@ -451,15 +449,13 @@
 *****************************************************************/ 
 void handle_single_want_hack_reply(bool you_have_hack)
 {
-  if (has_capability("new_hack", aconnection.capability)) {
-    /* remove challenge file */
-    if (challenge_fullname[0] != '\0') {
-      if (remove(challenge_fullname) == -1) {
-       freelog(LOG_ERROR, "Couldn't remove temporary file: %s",
-           challenge_fullname);
-      }
-      challenge_fullname[0] = '\0';
+  /* remove challenge file */
+  if (challenge_fullname[0] != '\0') {
+    if (remove(challenge_fullname) == -1) {
+      freelog(LOG_ERROR, "Couldn't remove temporary file: %s",
+             challenge_fullname);
     }
+    challenge_fullname[0] = '\0';
   }
 
   if (you_have_hack) {
Index: client/packhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/packhand.c,v
retrieving revision 1.429
diff -u -r1.429 packhand.c
--- client/packhand.c   2 Dec 2004 10:14:53 -0000       1.429
+++ client/packhand.c   2 Dec 2004 19:17:07 -0000
@@ -1719,18 +1719,18 @@
   Handles a conn_ping_info packet from the server.  This packet contains
   ping times for each connection.
 **************************************************************************/
-void handle_conn_ping_info(struct packet_conn_ping_info *packet)
+void handle_conn_ping_info(int connections, int *conn_id, float *ping_time)
 {
   int i;
 
-  for (i = 0; i < packet->connections; i++) {
-    struct connection *pconn = find_conn_by_id(packet->conn_id[i]);
+  for (i = 0; i < connections; i++) {
+    struct connection *pconn = find_conn_by_id(conn_id[i]);
 
     if (!pconn) {
       continue;
     }
 
-    pconn->ping_time = packet->ping_time[i];
+    pconn->ping_time = ping_time[i];
     freelog(LOG_DEBUG, "conn-id=%d, ping=%fs", pconn->id,
            pconn->ping_time);
   }
@@ -2646,49 +2646,15 @@
   int i;
 
   specialist_type_iterate(sp) {
+    int *bonus = game.rgame.specialists[sp].bonus;
+
     sz_strlcpy(game.rgame.specialists[sp].name, packet->specialist_name[sp]);
-    if (has_capability("short_spec", aconnection.capability)) {
-      sz_strlcpy(game.rgame.specialists[sp].short_name,
-                packet->specialist_short_name[sp]);
-    } else {
-      switch (sp) {
-      case SP_ELVIS:
-       sz_strlcpy(game.rgame.specialists[sp].short_name, N_("?Elvis:E"));
-       break;
-      case SP_TAXMAN:
-       sz_strlcpy(game.rgame.specialists[sp].short_name, N_("?Taxman:T"));
-       break;
-      case SP_SCIENTIST:
-       sz_strlcpy(game.rgame.specialists[sp].short_name,
-                  N_("?Scientist:S"));
-       break;
-      }
-    }
+    sz_strlcpy(game.rgame.specialists[sp].short_name,
+              packet->specialist_short_name[sp]);
     game.rgame.specialists[sp].min_size = packet->specialist_min_size[sp];
-    if (has_capability("spec_multi", aconnection.capability)) {
-      int *bonus = game.rgame.specialists[sp].bonus;
-
-      output_type_iterate(o) {
-       bonus[o] = packet->specialist_bonus[sp * O_COUNT + o];
-      } output_type_iterate_end;
-    } else {
-      /* This is included for compatability. */
-      int bonus = packet->specialist_bonus_old[sp];
-
-      memset(game.rgame.specialists[sp].bonus, 0,
-            O_COUNT * sizeof(*game.rgame.specialists[sp].bonus));
-      switch (sp) {
-      case SP_ELVIS:
-       game.rgame.specialists[sp].bonus[O_LUXURY] = bonus;
-       break;
-      case SP_SCIENTIST:
-       game.rgame.specialists[sp].bonus[O_SCIENCE] = bonus;
-       break;
-      case SP_TAXMAN:
-       game.rgame.specialists[sp].bonus[O_GOLD] = bonus;
-       break;
-      }
-    }
+    output_type_iterate(o) {
+      bonus[o] = packet->specialist_bonus[sp * O_COUNT + o];
+    } output_type_iterate_end;
   } specialist_type_iterate_end;
   tilespec_setup_specialist_types();
 
Index: common/capstr.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/capstr.c,v
retrieving revision 1.197
diff -u -r1.197 capstr.c
--- common/capstr.c     30 Nov 2004 06:54:06 -0000      1.197
+++ common/capstr.c     2 Dec 2004 19:17:07 -0000
@@ -73,23 +73,7 @@
  * are not directly related to the capability strings discussed here.)
  */
 
-/* +2.0 is the capability string for the 2.0.x release(s).
- *
- * "connecting" means the unused "connecting" field of the unit_info packet
- * is present.
- *
- * "conn_ping_info" means the packet_conn_ping_info uses MAX_NUM_CONNECTIONS
- * not MAX_NUM_PLAYERS.
- *
- * "username_info" means that the username is sent in the player_info packet
- *
- * "new_hack" means a new-style hack-request method
- *
- * "spec_multi" means specialists may provide more than one type of output.
- * Note that actually using this feature with an unsupported client will
- * break it.
- *
- * "short_spec" means that specialists have short names in the ruleset
+/* +Freeciv.Devel.YYYY.MMM.DD is the base capability string.
  *
  *   - No new manditory capabilities can be added to the release branch; doing
  *     so would break network capability of supposedly "compatible" releases.
@@ -98,8 +82,7 @@
  *     as long as possible.  We want to maintain network compatibility with
  *     the stable branch for as long as possible.
  */
-#define CAPABILITY "+2.0 connecting conn_ping_info username_info new_hack " \
-                   "spec_multi short_spec"
+#define CAPABILITY "+Freeciv.Devel.2004.Dec.2"
 
 void init_our_capability(void)
 {
Index: common/packets.def
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/packets.def,v
retrieving revision 1.61
diff -u -r1.61 packets.def
--- common/packets.def  30 Nov 2004 06:54:06 -0000      1.61
+++ common/packets.def  2 Dec 2004 19:17:07 -0000
@@ -533,7 +533,7 @@
 PACKET_PLAYER_INFO=39; is-info,sc
   PLAYER playerno; key 
   STRING name[MAX_LEN_NAME];
-  STRING username[MAX_LEN_NAME]; add-cap(username_info)
+  STRING username[MAX_LEN_NAME];
 
   BOOL is_male;
   GOVERNMENT government;
@@ -610,7 +610,6 @@
 
   UINT8 veteran;
   BOOL ai, paradropped;
-  BOOL connecting; remove-cap(connecting)
   BOOL transported, done_moving;
 
   UNIT_TYPE type;
@@ -853,14 +852,9 @@
 
 # Information about the ping times of the connections.
 PACKET_CONN_PING_INFO=87; sc,lsend
-  # "Old" values
-  UINT8 old_connections; remove-cap(conn_ping_info)
-  CONNECTION old_conn_id[MAX_NUM_PLAYERS:connections]; 
remove-cap(conn_ping_info)
-  float1000000(float) old_ping_time[MAX_NUM_PLAYERS:connections]; 
remove-cap(conn_ping_info)
-
-  UINT8 connections; add-cap(conn_ping_info)
-  CONNECTION conn_id[MAX_NUM_CONNECTIONS:connections]; add-cap(conn_ping_info)
-  float1000000(float) ping_time[MAX_NUM_CONNECTIONS:connections]; 
add-cap(conn_ping_info)
+  UINT8 connections;
+  CONNECTION conn_id[MAX_NUM_CONNECTIONS:connections];
+  float1000000(float) ping_time[MAX_NUM_CONNECTIONS:connections];
 end
 
 PACKET_CONN_PING=88;sc
@@ -972,10 +966,9 @@
 
 PACKET_RULESET_GAME=97;sc,lsend
   STRING specialist_name[SP_COUNT][MAX_LEN_NAME];
-  STRING specialist_short_name[SP_COUNT][MAX_LEN_NAME]; add-cap(short_spec)
+  STRING specialist_short_name[SP_COUNT][MAX_LEN_NAME];
   UINT8 specialist_min_size[SP_COUNT];
-  UINT8 specialist_bonus_old[SP_COUNT]; remove-cap(spec_multi)
-  UINT8 specialist_bonus[SP_COUNT * O_MAX]; add-cap(spec_multi)
+  UINT8 specialist_bonus[SP_COUNT * O_MAX];
   BOOL changable_tax;
   UINT8 forced_science;
   UINT8 forced_luxury;
@@ -1257,8 +1250,7 @@
  Below are the packets that control single-player mode.  
 *********************************************************/
 PACKET_SINGLE_WANT_HACK_REQ=108;cs,handle-per-conn,no-handle
- UINT32 old_token; remove-cap(new_hack)
- STRING token[MAX_LEN_NAME]; add-cap(new_hack)
+ STRING token[MAX_LEN_NAME];
 end
 
 PACKET_SINGLE_WANT_HACK_REPLY=109;sc,dsend
Index: server/gamehand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/gamehand.c,v
retrieving revision 1.145
diff -u -r1.145 gamehand.c
--- server/gamehand.c   16 Nov 2004 18:09:47 -0000      1.145
+++ server/gamehand.c   2 Dec 2004 19:17:07 -0000
@@ -446,10 +446,6 @@
 **************************************************************************/
 const char *new_challenge_filename(struct connection *pc)
 {
-  if (!has_capability("new_hack", pc->capability)) {
-    return "";
-  }
-
   gen_challenge_filename(pc);
   return get_challenge_filename(pc);
 }
@@ -467,11 +463,6 @@
   char *token = NULL;
   bool you_have_hack = FALSE;
 
-  if (!has_capability("new_hack", pc->capability)) {
-    dsend_packet_single_want_hack_reply(pc, FALSE);
-    return ;
-  }
-
   if (section_file_load_nodup(&file, get_challenge_fullname(pc))) {
     token = secfile_lookup_str_default(&file, NULL, "challenge.token");
     you_have_hack = (token && strcmp(token, packet->token) == 0);
Index: server/ruleset.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/ruleset.c,v
retrieving revision 1.206
diff -u -r1.206 ruleset.c
--- server/ruleset.c    2 Dec 2004 10:14:54 -0000       1.206
+++ server/ruleset.c    2 Dec 2004 19:17:08 -0000
@@ -3155,7 +3155,6 @@
 
   specialist_type_iterate(sp) {
     int *bonus = game.rgame.specialists[sp].bonus;
-    int max_bonus = 0;
 
     sz_strlcpy(misc_p.specialist_name[sp], game.rgame.specialists[sp].name);
     sz_strlcpy(misc_p.specialist_short_name[sp],
@@ -3164,11 +3163,7 @@
 
     output_type_iterate(o) {
       misc_p.specialist_bonus[sp * O_COUNT + o] = bonus[o];
-      max_bonus = MAX(max_bonus, bonus[0]);
     } output_type_iterate_end;
-
-    /* This is included for compatability. */
-    misc_p.specialist_bonus_old[sp] = max_bonus;
   } specialist_type_iterate_end;
   misc_p.changable_tax = game.rgame.changable_tax;
   misc_p.forced_science = game.rgame.forced_science;
Index: server/sernet.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/sernet.c,v
retrieving revision 1.129
diff -u -r1.129 sernet.c
--- server/sernet.c     25 Nov 2004 05:39:59 -0000      1.129
+++ server/sernet.c     2 Dec 2004 19:17:08 -0000
@@ -967,7 +967,6 @@
   } conn_list_iterate_end;
 
   packet.connections = i;
-  packet.old_connections = MIN(i, MAX_NUM_PLAYERS);
 
   i = 0;
   conn_list_iterate(game.game_connections, pconn) {
@@ -977,10 +976,6 @@
     assert(i < ARRAY_SIZE(packet.conn_id));
     packet.conn_id[i] = pconn->id;
     packet.ping_time[i] = pconn->ping_time;
-    if (i < packet.old_connections) {
-      packet.old_conn_id[i] = pconn->id;
-      packet.old_ping_time[i] = pconn->ping_time;
-    }
     i++;
   } conn_list_iterate_end;
   lsend_packet_conn_ping_info(&game.est_connections, &packet);
Index: server/unittools.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/unittools.c,v
retrieving revision 1.310
diff -u -r1.310 unittools.c
--- server/unittools.c  31 Oct 2004 22:32:33 -0000      1.310
+++ server/unittools.c  2 Dec 2004 19:17:09 -0000
@@ -1798,7 +1798,6 @@
   }
   packet->activity_target = punit->activity_target;
   packet->paradropped = punit->paradropped;
-  packet->connecting = FALSE;
   packet->done_moving = punit->done_moving;
   if (punit->transported_by == -1) {
     packet->transported = FALSE;

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