Author: cazfi
Date: Thu Apr 28 15:42:35 2016
New Revision: 32518

URL: http://svn.gna.org/viewcvs/freeciv?rev=32518&view=rev
Log:
Made illness rules related network protocol fields wide enough to hold their 
maximum values.

Reported by fomalhaut

See bug #24607

Modified:
    branches/S2_5/client/packhand.c
    branches/S2_5/common/packets.def
    branches/S2_5/fc_version
    branches/S2_5/server/gamehand.c

Modified: branches/S2_5/client/packhand.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/packhand.c?rev=32518&r1=32517&r2=32518&view=diff
==============================================================================
--- branches/S2_5/client/packhand.c     (original)
+++ branches/S2_5/client/packhand.c     Thu Apr 28 15:42:35 2016
@@ -1,4 +1,4 @@
-/********************************************************************** 
+/***********************************************************************
  Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -1895,11 +1895,10 @@
   bool boot_help;
   bool update_aifill_button = FALSE;
 
-
   if (game.info.aifill != pinfo->aifill) {
     update_aifill_button = TRUE;
   }
-  
+
   if (game.info.is_edit_mode != pinfo->is_edit_mode) {
     popdown_all_city_dialogs();
     /* Clears the current goto command. */
@@ -1907,6 +1906,13 @@
   }
 
   game.info = *pinfo;
+
+  if (!has_capability("illness_ranges", client.conn.capability)) {
+    /* Fill current values from the old-format values sent by older server. */
+    game.info.illness_base_factor = game.info.illness_base_factor_old;
+    game.info.illness_pollution_factor = 
game.info.illness_pollution_factor_old;
+    game.info.illness_trade_infection = game.info.illness_trade_infection_old;
+  }
 
   /* check the values! */
 #define VALIDATE(_count, _maximum, _string)                                 \

Modified: branches/S2_5/common/packets.def
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/common/packets.def?rev=32518&r1=32517&r2=32518&view=diff
==============================================================================
--- branches/S2_5/common/packets.def    (original)
+++ branches/S2_5/common/packets.def    Thu Apr 28 15:42:35 2016
@@ -461,11 +461,14 @@
   UINT8 happy_cost;
   BOOL happyborders;
   UINT32 heating;
-  UINT8 illness_base_factor;
+  UINT8 illness_base_factor_old; remove-cap(illness_ranges)
+  UINT16 illness_base_factor; add-cap(illness_ranges)
   UINT8 illness_min_size;
   BOOL illness_on;
-  UINT8 illness_pollution_factor;
-  UINT8 illness_trade_infection;
+  UINT8 illness_pollution_factor_old; remove-cap(illness_ranges)
+  UINT16 illness_pollution_factor; add-cap(illness_ranges)
+  UINT8 illness_trade_infection_old; remove-cap(illness_ranges)
+  UINT16 illness_trade_infection; add-cap(illness_ranges)
   UINT8 init_city_radius_sq;
   /* If set, editing is allowed */
   BOOL is_edit_mode;

Modified: branches/S2_5/fc_version
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/fc_version?rev=32518&r1=32517&r2=32518&view=diff
==============================================================================
--- branches/S2_5/fc_version    (original)
+++ branches/S2_5/fc_version    Thu Apr 28 15:42:35 2016
@@ -55,7 +55,7 @@
 #     as long as possible.  We want to maintain network compatibility with
 #     the stable branch for as long as possible.
 NETWORK_CAPSTRING_MANDATORY="+Freeciv-2.5-network"
-NETWORK_CAPSTRING_OPTIONAL="nationset_change tech_cost split_reports 
extended_move_rate"
+NETWORK_CAPSTRING_OPTIONAL="nationset_change tech_cost split_reports 
extended_move_rate illness_ranges"
 
 FREECIV_DISTRIBUTOR=""
 

Modified: branches/S2_5/server/gamehand.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/server/gamehand.c?rev=32518&r1=32517&r2=32518&view=diff
==============================================================================
--- branches/S2_5/server/gamehand.c     (original)
+++ branches/S2_5/server/gamehand.c     Thu Apr 28 15:42:35 2016
@@ -1,4 +1,4 @@
-/**********************************************************************
+/***********************************************************************
  Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -868,6 +868,11 @@
 
   ginfo = game.info;
 
+  /* Set values used by old clients (lacking "illness_ranges" capability). */
+  game.info.illness_base_factor_old = game.info.illness_base_factor;
+  game.info.illness_pollution_factor_old = game.info.illness_pollution_factor;
+  game.info.illness_trade_infection_old = game.info.illness_trade_infection;
+
   /* the following values are computed every
      time a packet_game_info packet is created */
 
@@ -887,8 +892,7 @@
 
   conn_list_iterate(dest, pconn) {
     send_packet_game_info(pconn, &ginfo);
-  }
-  conn_list_iterate_end;
+  } conn_list_iterate_end;
 }
 
 /**************************************************************************


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to