Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2004:
[Freeciv-Dev] (PR#9839) cut down capstring
Home

[Freeciv-Dev] (PR#9839) cut down capstring

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#9839) cut down capstring
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 27 Aug 2004 11:54:16 -0700
Reply-to: rt@xxxxxxxxxxx

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

This patch cuts down the capstring, which is becoming very long (there's 
a limit on the capstring length; we're surely coming close but I didn't 
check the exact length).

Unfortunately it's very hard to guarantee that this patch is correct.  I 
removed all add-cap and remove-cap tags from packets.def.  The 
remove-cap tags have their objects removed; they must also be removed 
from the source.  I searched for has_capability checks in server and 
client but didn't find any.

It may come as a surprise that this patch causes packets_gen to become 
5000 lines smaller.

jason

? diff
Index: common/capstr.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/capstr.c,v
retrieving revision 1.180
diff -u -r1.180 capstr.c
--- common/capstr.c     27 Aug 2004 17:36:53 -0000      1.180
+++ common/capstr.c     27 Aug 2004 18:01:02 -0000
@@ -73,80 +73,9 @@
  * are not directly related to the capability strings discussed here.)
  */
 
-#define CAPABILITY "+1.14.delta +last_turns_shield_surplus veteran +orders " \
-                   "+starter +union +iso_maps +big_map_size +orders2client " \
-                   "+change_production +tilespec1 +no_earth +trans " \
-                   "+want_hack invasions bombard +killstack2 spec +spec2 " \
-                   "+city_map startunits +turn_last_built +happyborders " \
-                   "+connid +love2 +ocean_num +govclean +orders3 +rev_fin"
+#define CAPABILITY "+CVS.Aug.2004"
 
-/* "+1.14.delta" is the new delta protocol for 1.14.0-dev.
- *
- * "last_turns_shield_surplus" means the surplus from the previous turn is
- * tracked by the server and sent to the client.  This information is used
- * in determining penalties when switching production.
- *
- * "orders" means client orders is used for client-side goto and patrol.
- *
- * "veteran" means the extended veteran system.
- *
- * "starter" means the Starter terrain flag is supported.
- *
- * "union" is team research ability
- *
- * "iso_maps" means iso-maps are supported by both server and client!
- *
- * "big_map_size" means [xy]size info is sent as UINT16 
- *
- * "orders2client" means that the server sends back the orders to the client.
- *
- * "change_production" is the E_CITY_PRODUCTION_CHANGED event.
- *
- * "tilespec1" means changed graphic strings in terrain.ruleset.
- *
- * "no_earth" means that the map.is_earth value is gone; replaced by
- * ptile->spec_sprite
- *
- * "trans" means that the transported_by field is sent to the client.
- *
- * "want_hack" means that the client is capable of asking for hack properly.
- * 
- * "invasions" means ground units moving from ocean to land now lose all
- * their movement; changable by ruleset option.
- * 
- * "killstack2" means ruleset option to ignore unit killstack effect, and now
- * it's a boolean.
- *
- * "bombard" means units support the bombard ability.
- * 
- * "spec" is configurable specialists
- *
- * "spec2" is semi-configurable specialists in an array
- *
- * "city_map" means the city_map is sent as an array instead of a bitfield.
- *
- * "startunits" means the initial units are stored as a server string var.
- *
- * "turn_last_built" means that turn_last_built is stored as a turn
- * 
- * "happyborders" means that units may not cause unhappiness inside
- * our own borders.
- * 
- * "connid" adds the connection id of whoever sends a message to the 
- * info sent to clients.
- * 
- * "love" means that we show the AI love for you in the client
- * "love2" includes a bugfix
- *
- * "ocean_num" means that the oceans are numbered by negative numbers
- * which are stored in ptile->continent and sent to client.
- * 
- * "govclean" removes corruption|waste_modifier
- *
- * "orders3" provides some additional orders that can be given
- *
- * "rev_fin" means the revolution_finishes value replaces the revolution
- * value.
+/* "CVS.Aug.2004" is the protocol as of August 2004
  */
 
 void init_our_capability(void)
Index: common/packets.def
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/packets.def,v
retrieving revision 1.43
diff -u -r1.43 packets.def
--- common/packets.def  27 Aug 2004 17:36:53 -0000      1.43
+++ common/packets.def  27 Aug 2004 18:01:03 -0000
@@ -545,7 +545,7 @@
   GOLD gold;
   PERCENT tax, science,luxury;
 
-  UINT16 bulbs_last_turn; add-cap(union)
+  UINT16 bulbs_last_turn;
   UINT32 bulbs_researched;
   UINT32 techs_researched;
   UINT8 researching;
@@ -604,8 +604,7 @@
   COORD x,y;
   CITY homecity;
 
-  UINT8 veteran; add-cap(veteran)
-  BOOL veteran_old; remove-cap(veteran)
+  UINT8 veteran;
   BOOL ai, paradropped, connecting, transported, done_moving;
 
   UNIT_TYPE type;
@@ -630,8 +629,7 @@
   COORD x,y;
   UNIT_TYPE type;
 
-  UINT8 veteran; add-cap(veteran)
-  BOOL veteran_old; remove-cap(veteran)
+  UINT8 veteran;
   BOOL occupied, goes_out_of_sight, transported;
 
   UINT8 hp, activity;
@@ -956,11 +954,11 @@
   UINT8 paratroopers_mr_req;
   UINT8 paratroopers_mr_sub;
 
-  STRING veteran_name[MAX_VET_LEVELS][MAX_LEN_NAME]; add-cap(veteran)
-  FLOAT power_fact[MAX_VET_LEVELS]; add-cap(veteran)
-  UINT8 move_bonus[MAX_VET_LEVELS]; add-cap(veteran)
+  STRING veteran_name[MAX_VET_LEVELS][MAX_LEN_NAME];
+  FLOAT power_fact[MAX_VET_LEVELS];
+  UINT8 move_bonus[MAX_VET_LEVELS];
 
-  UINT8 bombard_rate; add-cap(bombard)
+  UINT8 bombard_rate;
 
   STRING helptext[MAX_LEN_PACKET];
 
@@ -972,10 +970,10 @@
   STRING specialist_name[SP_COUNT][MAX_LEN_NAME];
   UINT8 specialist_min_size[SP_COUNT];
   UINT8 specialist_bonus[SP_COUNT];
-  BOOL changable_tax; add-cap(spec)
-  UINT8 forced_science; add-cap(spec)
-  UINT8 forced_luxury; add-cap(spec)
-  UINT8 forced_gold; add-cap(spec)
+  BOOL changable_tax;
+  UINT8 forced_science;
+  UINT8 forced_luxury;
+  UINT8 forced_gold;
   UINT8 min_city_center_food;
   UINT8 min_city_center_shield;
   UINT8 min_city_center_trade;
@@ -994,9 +992,9 @@
 
   BOOL killstack;
 
-  UINT8 trireme_loss_chance[MAX_VET_LEVELS]; add-cap(veteran)
-  UINT8 work_veteran_chance[MAX_VET_LEVELS]; add-cap(veteran)
-  UINT8 veteran_chance[MAX_VET_LEVELS]; add-cap(veteran)
+  UINT8 trireme_loss_chance[MAX_VET_LEVELS];
+  UINT8 work_veteran_chance[MAX_VET_LEVELS];
+  UINT8 veteran_chance[MAX_VET_LEVELS];
 end
 
 PACKET_RULESET_GOVERNMENT_RULER_TITLE=98;sc,lsend
@@ -1244,7 +1242,7 @@
   UINT8 style_count;
   UINT8 borders;
   BOOL happyborders;
-  BOOL slow_invasions; add-cap(slow_invasions)
+  BOOL slow_invasions;
 
   STRING team_name[MAX_NUM_TEAMS][MAX_LEN_NAME];
 end
Index: server/unittools.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/unittools.c,v
retrieving revision 1.300
diff -u -r1.300 unittools.c
--- server/unittools.c  26 Aug 2004 18:37:53 -0000      1.300
+++ server/unittools.c  27 Aug 2004 18:01:04 -0000
@@ -1810,7 +1810,6 @@
   packet->y = punit->y;
   packet->homecity = punit->homecity;
   packet->veteran = punit->veteran;
-  packet->veteran_old = (punit->veteran > 0);
   packet->type = punit->type;
   packet->movesleft = punit->moves_left;
   packet->hp = punit->hp;

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#9839) cut down capstring, Jason Short <=