Complete.Org: Mailing Lists: Archives: freeciv-dev: April 2004:
[Freeciv-Dev] inexplicable generate_packets error
Home

[Freeciv-Dev] inexplicable generate_packets error

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] inexplicable generate_packets error
From: Jason Dorje Short <jdorje@xxxxxxxxxxxx>
Date: Mon, 26 Apr 2004 13:25:34 -0400

When I apply the attached patch and run generate_packets, it gives an error:

./generate_packets.py
Traceback (most recent call last):
  File "./generate_packets.py", line 1628, in ?
    main()
  File "./generate_packets.py", line 1441, in main
    output_c.write(p.get_variants())
  File "./generate_packets.py", line 1162, in get_variants
    result=result+v.get_send()
  File "./generate_packets.py", line 705, in get_send
    body=self.get_delta_send_body()
  File "./generate_packets.py", line 759, in get_delta_send_body
    body=body+field.get_cmp_wrapper(i)
  File "./generate_packets.py", line 304, in get_cmp_wrapper
    cmp=self.get_cmp()
  File "./generate_packets.py", line 285, in get_cmp
    return '''
KeyError: 'array_size_o'

Raimar?

jason
Index: common/packets.def
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/packets.def,v
retrieving revision 1.21
diff -u -r1.21 packets.def
--- common/packets.def  24 Apr 2004 17:32:47 -0000      1.21
+++ common/packets.def  26 Apr 2004 17:25:07 -0000
@@ -149,7 +149,8 @@
 
 # typedefs for arrays/structs
 type MEMORY            = memory(unsigned char)
-type STRING            = string(char)
+type ASCII             = ascii_string(char)
+type TEXT              = text_string(char)
 type BIT_STRING                = bit_string(char)
 type CITY_MAP          = city_map(char)
 type WORKLIST          = worklist(struct worklist)
@@ -235,29 +236,29 @@
 # This packet is the first real (freeciv specific) packet send by the
 # client. The player hasn't been accepted yet.
 PACKET_SERVER_JOIN_REQ=4; cs, dsend,no-delta,no-handle
-  STRING username[MAX_LEN_NAME];
-  STRING capability[MAX_LEN_CAPSTR];
-  STRING version_label[MAX_LEN_NAME];
+  TEXT username[MAX_LEN_NAME];
+  ASCII capability[MAX_LEN_CAPSTR];
+  ASCII version_label[MAX_LEN_NAME];
   UINT32 major_version, minor_version, patch_version;
 end
 
 # ... and the server replies.
 PACKET_SERVER_JOIN_REPLY=5; sc,no-delta
   BOOL you_can_join;
-  STRING message[MAX_LEN_MSG];
-  STRING capability[MAX_LEN_CAPSTR];
-  STRING challenge_file[MAX_LEN_PATH];
+  TEXT message[MAX_LEN_MSG];
+  ASCII capability[MAX_LEN_CAPSTR];
+  ASCII challenge_file[MAX_LEN_PATH];
   # clients conn id as known in server
   CONNECTION conn_id;
 end
 
 PACKET_AUTHENTICATION_REQ=6;sc,handle-per-conn,dsend
   AUTH_TYPE type;
-  STRING message[MAX_LEN_MSG]; /* explain to the client if there's a problem */
+  TEXT message[MAX_LEN_MSG]; /* explain to the client if there's a problem */
 end
 
 PACKET_AUTHENTICATION_REPLY=7;cs,no-handle
-  STRING password[MAX_LEN_NAME];
+  TEXT password[MAX_LEN_NAME];
 end
 
 
@@ -272,7 +273,7 @@
 PACKET_NATION_SELECT_REQ=10;cs,dsend
   NATION nation_no;
   BOOL is_male;
-  STRING name[MAX_LEN_NAME];
+  TEXT name[MAX_LEN_NAME];
   UINT8 city_style;
 end
 
@@ -311,7 +312,7 @@
   SPECIAL special;
   PLAYER owner;
   CONTINENT continent;
-  STRING spec_sprite[MAX_LEN_NAME];
+  ASCII spec_sprite[MAX_LEN_NAME];
 end
 
 PACKET_GAME_INFO=15; is-info,sc
@@ -357,13 +358,13 @@
 /************** Chat/event packets **********************/
 
 PACKET_CHAT_MSG=18;sc, pre-send, post-recv,lsend
-  STRING message[MAX_LEN_MSG];
+  TEXT message[MAX_LEN_MSG];
   COORD x, y;
   EVENT event;
 end
 
 PACKET_CHAT_MSG_REQ=19;cs,handle-per-conn,dsend
-  STRING message[MAX_LEN_MSG];
+  TEXT message[MAX_LEN_MSG];
 end
 
 /************** City packets **********************/
@@ -376,7 +377,7 @@
   CITY id; key
   PLAYER owner;
   COORD x,y;
-  STRING name[MAX_LEN_NAME];
+  TEXT name[MAX_LEN_NAME];
   UINT8 size;
 
   UINT8 ppl_happy[5], ppl_content[5], ppl_unhappy[5], ppl_angry[5];
@@ -421,7 +422,7 @@
   PLAYER owner;
   COORD x;
   COORD y;
-  STRING name[MAX_LEN_NAME];
+  TEXT name[MAX_LEN_NAME];
   UINT8 size;
   BOOL happy;
   BOOL unhappy;
@@ -468,7 +469,7 @@
 
 PACKET_CITY_RENAME=30;cs,dsend
   CITY city_id;
-  STRING name[MAX_LEN_NAME];
+  TEXT name[MAX_LEN_NAME];
 end
 
 PACKET_CITY_OPTIONS_REQ=31;cs,dsend
@@ -501,7 +502,7 @@
 
 PACKET_CITY_NAME_SUGGESTION_INFO=36;sc,dsend,lsend
   UNIT unit_id;
-  STRING name[MAX_LEN_NAME];
+  TEXT name[MAX_LEN_NAME];
 end
 
 PACKET_CITY_SABOTAGE_LIST=37;sc,lsend
@@ -518,7 +519,7 @@
 
 PACKET_PLAYER_INFO=39; is-info,sc
   PLAYER playerno; key 
-  STRING name[MAX_LEN_NAME];
+  TEXT name[MAX_LEN_NAME];
   BOOL is_male;
   GOVERNMENT government;
   UINT32 embassy;
@@ -648,7 +649,7 @@
 
 PACKET_UNIT_BUILD_CITY=53;cs,dsend
   UNIT unit_id;
-  STRING name[MAX_LEN_NAME];
+  TEXT name[MAX_LEN_NAME];
 end
 
 PACKET_UNIT_DISBAND=54;cs,dsend
@@ -813,7 +814,7 @@
 /**************  Report packets **********************/
 
 PACKET_PAGE_MSG=84;sc,lsend
-  STRING message[MAX_LEN_MSG];
+  TEXT message[MAX_LEN_MSG];
   EVENT event;
 end
 
@@ -836,9 +837,9 @@
   BOOL observer;
   PLAYER player_num;
   CMDLEVEL access_level;
-  STRING username[MAX_LEN_NAME];
-  STRING addr[MAX_LEN_ADDR];
-  STRING capability[MAX_LEN_CAPSTR];
+  TEXT username[MAX_LEN_NAME];
+  ASCII addr[MAX_LEN_ADDR];
+  ASCII capability[MAX_LEN_CAPSTR];
 end
 
 # Information about the ping times of the connections.
@@ -912,13 +913,13 @@
 
 PACKET_RULESET_UNIT=96;sc,lsend
   UNIT_TYPE id;
-  STRING name[MAX_LEN_NAME];
-  STRING graphic_str[MAX_LEN_NAME];
-  STRING graphic_alt[MAX_LEN_NAME];
-  STRING sound_move[MAX_LEN_NAME];
-  STRING sound_move_alt[MAX_LEN_NAME];
-  STRING sound_fight[MAX_LEN_NAME];
-  STRING sound_fight_alt[MAX_LEN_NAME];
+  ASCII name[MAX_LEN_NAME];
+  ASCII graphic_str[MAX_LEN_NAME];
+  ASCII graphic_alt[MAX_LEN_NAME];
+  ASCII sound_move[MAX_LEN_NAME];
+  ASCII sound_move_alt[MAX_LEN_NAME];
+  ASCII sound_fight[MAX_LEN_NAME];
+  ASCII sound_fight_alt[MAX_LEN_NAME];
   UINT8 move_type;
   UINT16 build_cost;
   UINT8 pop_cost;
@@ -943,13 +944,13 @@
   UINT8 paratroopers_mr_req;
   UINT8 paratroopers_mr_sub;
 
-  STRING veteran_name[MAX_VET_LEVELS][MAX_LEN_NAME]; add-cap(veteran)
+  ASCII 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)
 
   UINT8 bombard_rate; add-cap(bombard)
 
-  STRING helptext[MAX_LEN_PACKET];
+  ASCII helptext[MAX_LEN_PACKET];
 
   bitvector(bv_flags) flags;
   bitvector(bv_roles) roles;
@@ -982,8 +983,8 @@
   GOVERNMENT gov;
   UINT8 id;
   NATION nation;
-  STRING male_title[MAX_LEN_NAME];
-  STRING female_title[MAX_LEN_NAME];
+  ASCII male_title[MAX_LEN_NAME];
+  ASCII female_title[MAX_LEN_NAME];
 end
 
 PACKET_RULESET_TECH=99;sc,lsend
@@ -991,10 +992,10 @@
   TECH req[2];
   TECH root_req;
   UINT32 flags, preset_cost, num_reqs;
-  STRING name[MAX_LEN_NAME];
-  STRING helptext[MAX_LEN_PACKET];
-  STRING graphic_str[MAX_LEN_NAME];
-  STRING graphic_alt[MAX_LEN_NAME];
+  ASCII name[MAX_LEN_NAME];
+  ASCII helptext[MAX_LEN_PACKET];
+  ASCII graphic_str[MAX_LEN_NAME];
+  ASCII graphic_alt[MAX_LEN_NAME];
 end
 
 PACKET_RULESET_GOVERNMENT=100;sc,lsend
@@ -1054,10 +1055,10 @@
       
   UINT8 num_ruler_titles;
        
-  STRING name[MAX_LEN_NAME];
-  STRING graphic_str[MAX_LEN_NAME];
-  STRING graphic_alt[MAX_LEN_NAME];
-  STRING helptext[MAX_LEN_PACKET];
+  ASCII name[MAX_LEN_NAME];
+  ASCII graphic_str[MAX_LEN_NAME];
+  ASCII graphic_alt[MAX_LEN_NAME];
+  ASCII helptext[MAX_LEN_PACKET];
 end
 
 PACKET_RULESET_TERRAIN_CONTROL=101;sc,lsend
@@ -1073,7 +1074,7 @@
 
   UINT16 river_defense_bonus;           /* % added to defense if Civ2 river */
   UINT16 river_trade_incr;              /* added to trade if Civ2 river */
-  STRING river_help_text[MAX_LEN_PACKET]; # help for Civ2-style rivers
+  ASCII river_help_text[MAX_LEN_PACKET]; # help for Civ2-style rivers
 
   UINT16 fortress_defense_bonus;        /* % added to defense if fortress */
   UINT16 road_superhighway_trade_bonus;  # % added to trade if road/s-highway
@@ -1092,37 +1093,37 @@
 PACKET_RULESET_NATION=102;sc,lsend
   NATION id;
 
-  STRING name[MAX_LEN_NAME];
-  STRING name_plural[MAX_LEN_NAME];
-  STRING graphic_str[MAX_LEN_NAME];
-  STRING graphic_alt[MAX_LEN_NAME];
-  STRING class[MAX_LEN_NAME];
-  STRING legend[MAX_LEN_MSG];
+  TEXT name[MAX_LEN_NAME];
+  TEXT name_plural[MAX_LEN_NAME];
+  ASCII graphic_str[MAX_LEN_NAME];
+  ASCII graphic_alt[MAX_LEN_NAME];
+  ASCII class[MAX_LEN_NAME];
+  ASCII legend[MAX_LEN_MSG];
 
   UINT8 city_style;
   TECH_LIST init_techs[MAX_NUM_TECH_LIST];
 
   UINT8 leader_count;
-  STRING leader_name[MAX_NUM_LEADERS:leader_count][MAX_LEN_NAME];
+  TEXT leader_name[MAX_NUM_LEADERS:leader_count][MAX_LEN_NAME];
   BOOL leader_sex[MAX_NUM_LEADERS:leader_count];
 end
 
 PACKET_RULESET_CITY=103;sc,lsend
   UINT8 style_id; 
   UINT8 techreq;
-  STRING name[MAX_LEN_NAME];
-  STRING citizens_graphic[MAX_LEN_NAME];
-  STRING citizens_graphic_alt[MAX_LEN_NAME];
-  STRING graphic[MAX_LEN_NAME];
-  STRING graphic_alt[MAX_LEN_NAME];
+  ASCII name[MAX_LEN_NAME];
+  ASCII citizens_graphic[MAX_LEN_NAME];
+  ASCII citizens_graphic_alt[MAX_LEN_NAME];
+  ASCII graphic[MAX_LEN_NAME];
+  ASCII graphic_alt[MAX_LEN_NAME];
   SINT8 replaced_by;
 end
 
 PACKET_RULESET_BUILDING=104;sc,lsend
   IMPROVEMENT id;
-  STRING name[MAX_LEN_NAME];
-  STRING graphic_str[MAX_LEN_NAME];
-  STRING graphic_alt[MAX_LEN_NAME];
+  ASCII name[MAX_LEN_NAME];
+  ASCII graphic_str[MAX_LEN_NAME];
+  ASCII graphic_alt[MAX_LEN_NAME];
   TECH tech_req, obsolete_by;
   IMPROVEMENT bldg_req;
   BOOL is_wonder;
@@ -1130,9 +1131,9 @@
   UINT16 build_cost;
   UINT8 upkeep, sabotage;
   UINT8 variant;               /* FIXME: remove when gen-impr obsoletes */
-  STRING soundtag[MAX_LEN_NAME];
-  STRING soundtag_alt[MAX_LEN_NAME];
-  STRING helptext[MAX_LEN_PACKET];
+  ASCII soundtag[MAX_LEN_NAME];
+  ASCII soundtag_alt[MAX_LEN_NAME];
+  ASCII helptext[MAX_LEN_PACKET];
   UINT8 terr_gate_count;
   TERRAIN terr_gate[255:terr_gate_count];
   UINT8 spec_gate_count;
@@ -1150,9 +1151,9 @@
 
   bitvector(bv_terrain_flags) flags;
 
-  STRING terrain_name[MAX_LEN_NAME];
-  STRING graphic_str[MAX_LEN_NAME];
-  STRING graphic_alt[MAX_LEN_NAME];
+  ASCII terrain_name[MAX_LEN_NAME];
+  ASCII graphic_str[MAX_LEN_NAME];
+  ASCII graphic_alt[MAX_LEN_NAME];
 
   UINT8 movement_cost;
   UINT8 defense_bonus;
@@ -1161,19 +1162,19 @@
   UINT8 shield;
   UINT8 trade;
 
-  STRING special_1_name[MAX_LEN_NAME];
+  ASCII special_1_name[MAX_LEN_NAME];
   UINT8 food_special_1;
   UINT8 shield_special_1;
   UINT8 trade_special_1;
-  STRING graphic_str_special_1[MAX_LEN_NAME];
-  STRING graphic_alt_special_1[MAX_LEN_NAME];
+  ASCII graphic_str_special_1[MAX_LEN_NAME];
+  ASCII graphic_alt_special_1[MAX_LEN_NAME];
 
-  STRING special_2_name[MAX_LEN_NAME];
+  ASCII special_2_name[MAX_LEN_NAME];
   UINT8 food_special_2;
   UINT8 shield_special_2;
   UINT8 trade_special_2;
-  STRING graphic_str_special_2[MAX_LEN_NAME];
-  STRING graphic_alt_special_2[MAX_LEN_NAME];
+  ASCII graphic_str_special_2[MAX_LEN_NAME];
+  ASCII graphic_alt_special_2[MAX_LEN_NAME];
 
   UINT8 road_trade_incr;
   UINT8 road_time;
@@ -1189,7 +1190,7 @@
   TERRAIN transform_result;
   UINT8 transform_time;
   
-  STRING helptext[MAX_LEN_PACKET];
+  ASCII helptext[MAX_LEN_PACKET];
 end
 
 /*********************************************************
@@ -1222,7 +1223,7 @@
   UINT8 borders;
   BOOL slow_invasions; add-cap(slow_invasions)
 
-  STRING team_name[MAX_NUM_TEAMS][MAX_LEN_NAME];
+  TEXT team_name[MAX_NUM_TEAMS][MAX_LEN_NAME];
 end
 
 
@@ -1242,11 +1243,11 @@
 
 PACKET_SINGLE_PLAYERLIST_REPLY=111;sc
   UINT8 nplayers;
-  STRING load_filename[MAX_LEN_PACKET];
-  STRING name[MAX_NUM_PLAYERS:nplayers][MAX_LEN_NAME]; 
-  STRING username[MAX_NUM_PLAYERS:nplayers][MAX_LEN_NAME]; 
-  STRING nation_name[MAX_NUM_PLAYERS:nplayers][MAX_LEN_NAME]; 
-  STRING nation_flag[MAX_NUM_PLAYERS:nplayers][MAX_LEN_NAME]; 
+  ASCII load_filename[MAX_LEN_PACKET];
+  TEXT name[MAX_NUM_PLAYERS:nplayers][MAX_LEN_NAME]; 
+  TEXT username[MAX_NUM_PLAYERS:nplayers][MAX_LEN_NAME]; 
+  TEXT nation_name[MAX_NUM_PLAYERS:nplayers][MAX_LEN_NAME]; 
+  ASCII nation_flag[MAX_NUM_PLAYERS:nplayers][MAX_LEN_NAME]; 
   BOOL is_alive[MAX_NUM_PLAYERS:nplayers];
   BOOL is_ai[MAX_NUM_PLAYERS:nplayers];
 end
@@ -1254,14 +1255,14 @@
 PACKET_OPTIONS_SETTABLE_CONTROL=112;sc,handle-via-packet
   UINT16 nids;
   UINT8 ncategories;
-  STRING category_names[256:ncategories][MAX_LEN_NAME];
+  ASCII category_names[256:ncategories][MAX_LEN_NAME];
 end
 
 PACKET_OPTIONS_SETTABLE=113;sc
   UINT16 id;
-  STRING name[MAX_LEN_NAME];
-  STRING short_help[MAX_LEN_PACKET];
-  STRING extra_help[MAX_LEN_PACKET];
+  ASCII name[MAX_LEN_NAME];
+  ASCII short_help[MAX_LEN_PACKET];
+  ASCII extra_help[MAX_LEN_PACKET];
   SSET_TYPE type;
 
   SINT32 val;                                  /* value for bool or int */
@@ -1269,8 +1270,8 @@
   SINT32 min;                                  /* min value for int */
   SINT32 max;                                  /* max value for int */
 
-  STRING strval[MAX_LEN_PACKET];               /* space for string */
-  STRING default_strval[MAX_LEN_PACKET];       /* space for string */
+  ASCII strval[MAX_LEN_PACKET];                        /* space for string */
+  ASCII default_strval[MAX_LEN_PACKET];                /* space for string */
 
   UINT8 category;                              /* which category this is in */
 end

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