Author: jtn
Date: Tue Nov 17 09:56:47 2015
New Revision: 30652

URL: http://svn.gna.org/viewcvs/freeciv?rev=30652&view=rev
Log:
Increase unit move_rate fields in network protocol to UINT16, to fix a
regression in range when using an increased move_fragments resolution.

(Also, fix generate_packets.py to allow comments on lines defining types.)

Limitation reported by Michal Mazurek (akfaew@gna).

See gna bug #24074.

Modified:
    branches/S2_6/common/generate_packets.py
    branches/S2_6/common/packets.def
    branches/S2_6/fc_version

Modified: branches/S2_6/common/generate_packets.py
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/common/generate_packets.py?rev=30652&r1=30651&r2=30652&view=diff
==============================================================================
--- branches/S2_6/common/generate_packets.py    (original)
+++ branches/S2_6/common/generate_packets.py    Tue Nov 17 09:56:47 2015
@@ -1612,8 +1612,8 @@
     content=open(input_name).read()
     content=strip_c_comment(content)
     lines=content.split("\n")
-    lines=map(lambda x: re.sub("#.*$","",x),lines)
-    lines=map(lambda x: re.sub("//.*$","",x),lines)
+    lines=map(lambda x: re.sub("\s*#.*$","",x),lines)
+    lines=map(lambda x: re.sub("\s*//.*$","",x),lines)
     lines=filter(lambda x:not re.search("^\s*$",x),lines)
     lines2=[]
     types=[]

Modified: branches/S2_6/common/packets.def
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/common/packets.def?rev=30652&r1=30651&r2=30652&view=diff
==============================================================================
--- branches/S2_6/common/packets.def    (original)
+++ branches/S2_6/common/packets.def    Tue Nov 17 09:56:47 2015
@@ -297,6 +297,7 @@
 type GOLD               = UINT32
 type HP                 = UINT8
 type PERCENT            = UINT8
+type MOVEFRAGS          = UINT16  # units of TERRAIN_CONTROL.move_fragments
 type PHASE              = SINT16
 type TURN               = SINT16
 type XYSIZE             = UINT16
@@ -890,7 +891,8 @@
 
   UNIT_TYPE type;
   UNIT transported_by; /* Only valid if transported is set. */
-  UINT8 movesleft, hp, fuel;
+  MOVEFRAGS movesleft;
+  UINT8 hp, fuel;
   /* UINT16 size for activity_count assumed in checks in ruleset.c */
   UINT16 activity_count, changed_from_count;
   TILE goto_tile;
@@ -1269,7 +1271,7 @@
   UINT8 pop_cost;
   UINT8 attack_strength;
   UINT8 defense_strength;
-  UINT8 move_rate;
+  MOVEFRAGS move_rate;
   TECH tech_requirement;
   UINT8 impr_requirement;
   GOVERNMENT gov_requirement;
@@ -1286,13 +1288,13 @@
   UINT8 upkeep[O_LAST]; # normal upkeep cost (food, gold, shields)
 
   UINT8 paratroopers_range;  # max range of paratroopers, F_PARATROOPERS
-  UINT8 paratroopers_mr_req;
-  UINT8 paratroopers_mr_sub;
+  UINT8 paratroopers_mr_req; # whole move points, not MOVEFRAGS
+  UINT8 paratroopers_mr_sub; # whole move points, not MOVEFRAGS
 
   UINT8 veteran_levels;
   STRING veteran_name[MAX_VET_LEVELS:veteran_levels][MAX_LEN_NAME];
   UINT16 power_fact[MAX_VET_LEVELS:veteran_levels];
-  UINT8 move_bonus[MAX_VET_LEVELS:veteran_levels];
+  MOVEFRAGS move_bonus[MAX_VET_LEVELS:veteran_levels];
 
   UINT8 bombard_rate;
   UINT8 city_size;
@@ -1331,7 +1333,7 @@
   UINT8 veteran_levels;
   STRING veteran_name[MAX_VET_LEVELS:veteran_levels][MAX_LEN_NAME];
   UINT16 power_fact[MAX_VET_LEVELS:veteran_levels];
-  UINT8 move_bonus[MAX_VET_LEVELS:veteran_levels];
+  MOVEFRAGS move_bonus[MAX_VET_LEVELS:veteran_levels];
 
   UINT8 background_red;
   UINT8 background_green;
@@ -1398,8 +1400,8 @@
   UINT8 land_channel_requirement_pct; /* # adjacent ocean tiles for channel */
   UINT8 lake_max_size;                /* bodies of water up to this size are 
freshwater */
   UINT8 min_start_native_area;
-  UINT8 move_fragments;
-  UINT8 igter_cost;
+  MOVEFRAGS move_fragments;
+  MOVEFRAGS igter_cost;
   BOOL pythagorean_diagonal;
   STRING gui_type_base0[MAX_LEN_NAME];
   STRING gui_type_base1[MAX_LEN_NAME];
@@ -1557,7 +1559,7 @@
   UINT8 id;
   STRING name[MAX_LEN_NAME];
   STRING rule_name[MAX_LEN_NAME];
-  UINT8 min_speed;
+  MOVEFRAGS min_speed;
   UINT8 hp_loss_pct;
   UINT8 hut_behavior;
   BV_UCLASS_FLAGS flags;
@@ -1608,7 +1610,7 @@
   UINT8 id;
   UINT8 first_reqs_count;
   REQUIREMENT first_reqs[MAX_NUM_REQS:first_reqs_count];
-  SINT8 move_cost;
+  SINT8 move_cost; # not MOVEFRAGS because -1 is valid
   MOVE_MODE move_mode;
   UINT16 tile_incr_const[O_LAST];
   UINT16 tile_incr[O_LAST];
@@ -1990,7 +1992,7 @@
   UNIT_TYPE utype;
   PLAYER owner;
   CITY homecity;
-  UINT8 moves_left;
+  MOVEFRAGS moves_left;
   UINT8 hp;
   UINT8 veteran;
   UINT8 fuel;

Modified: branches/S2_6/fc_version
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/fc_version?rev=30652&r1=30651&r2=30652&view=diff
==============================================================================
--- branches/S2_6/fc_version    (original)
+++ branches/S2_6/fc_version    Tue Nov 17 09:56:47 2015
@@ -54,7 +54,7 @@
 #   - Avoid adding a new mandatory capability to the development branch for
 #     as long as possible.  We want to maintain network compatibility with
 #     the stable branch for as long as possible.
-NETWORK_CAPSTRING_MANDATORY="+Freeciv.Devel-2.6-2015.Oct.31"
+NETWORK_CAPSTRING_MANDATORY="+Freeciv.Devel-2.6-2015.Nov.15"
 NETWORK_CAPSTRING_OPTIONAL=""
 
 FREECIV_DISTRIBUTOR=""


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

Reply via email to