diff common/packets.c common/packets.c --- common/packets.c Mon Jan 22 14:29:28 2001 +++ common/packets.c Mon Jan 22 16:55:18 2001 @@ -87,7 +87,7 @@ static unsigned char *put_bit_string(unsigned char *buffer, char *str); static unsigned char *put_city_map(unsigned char *buffer, char *str); -static unsigned char *put_tech_list(unsigned char *buffer, int *techs); +static unsigned char *put_tech_list(unsigned char *buffer, const int *techs); /* iget = iterator versions */ static void iget_uint8(struct pack_iter *piter, int *val); @@ -942,7 +942,7 @@ /************************************************************************** ... **************************************************************************/ -unsigned char *put_string(unsigned char *buffer, char *mystring) +unsigned char *put_string(unsigned char *buffer, const char *mystring) { int len = strlen(mystring) + 1; memcpy(buffer, mystring, len); @@ -1143,7 +1143,7 @@ Put list of techs, MAX_NUM_TECH_LIST entries or A_LAST terminated. Only puts up to and including terminating entry (or MAX). **************************************************************************/ -static unsigned char *put_tech_list(unsigned char *buffer, int *techs) +static unsigned char *put_tech_list(unsigned char *buffer, const int *techs) { int i; @@ -1180,13 +1180,17 @@ **************************************************************************/ /* when removing "worklist_true_ids" capability, may want to remove the 'struct connection *pc' argument (?) */ -static unsigned char *put_worklist(unsigned char *buffer, struct worklist *pwl, - struct connection *pc) +static unsigned char *put_worklist(unsigned char *buffer, + const struct worklist *pwl, + struct connection *pc, int real_wl) { int i; buffer = put_uint8(buffer, pwl->is_valid); - buffer = put_string(buffer, pwl->name); + if (real_wl) + buffer = put_string(buffer, pwl->name); + else + buffer = put_string(buffer, '\0'); for (i = 0; i < MAX_LEN_WORKLIST; i++) { /* when removing "worklist_true_ids" capability, leave only the code from the *else* clause (send untranslated values) */ @@ -1246,7 +1250,7 @@ ... **************************************************************************/ int send_packet_diplomacy_info(struct connection *pc, enum packet_type pt, - struct packet_diplomacy_info *packet) + const struct packet_diplomacy_info *packet) { unsigned char buffer[MAX_LEN_PACKET], *cptr; cptr=put_uint8(buffer+2, pt); @@ -1289,7 +1293,7 @@ ... **************************************************************************/ int send_packet_diplomat_action(struct connection *pc, - struct packet_diplomat_action *packet) + const struct packet_diplomat_action *packet) { unsigned char buffer[MAX_LEN_PACKET], *cptr; cptr=put_uint8(buffer+2, PACKET_DIPLOMAT_ACTION); @@ -1329,7 +1333,7 @@ ... **************************************************************************/ int send_packet_nuke_tile(struct connection *pc, - struct packet_nuke_tile *packet) + const struct packet_nuke_tile *packet) { unsigned char buffer[MAX_LEN_PACKET], *cptr; cptr=put_uint8(buffer+2, PACKET_NUKE_TILE); @@ -1367,7 +1371,7 @@ ... **************************************************************************/ int send_packet_unit_combat(struct connection *pc, - struct packet_unit_combat *packet) + const struct packet_unit_combat *packet) { unsigned char buffer[MAX_LEN_PACKET], *cptr; cptr=put_uint8(buffer+2, PACKET_UNIT_COMBAT); @@ -1411,7 +1415,7 @@ ... **************************************************************************/ int send_packet_unit_request(struct connection *pc, - struct packet_unit_request *packet, + const struct packet_unit_request *packet, enum packet_type req_type) { unsigned char buffer[MAX_LEN_PACKET], *cptr; @@ -1454,7 +1458,7 @@ ... **************************************************************************/ int send_packet_unit_connect(struct connection *pc, - struct packet_unit_connect *packet) + const struct packet_unit_connect *packet) { unsigned char buffer[MAX_LEN_PACKET], *cptr; cptr=put_uint8(buffer+2, PACKET_UNIT_CONNECT); @@ -1494,21 +1498,11 @@ ... **************************************************************************/ int send_packet_player_request(struct connection *pc, - struct packet_player_request *packet, + const struct packet_player_request *packet, enum packet_type req_type) { unsigned char buffer[MAX_LEN_PACKET], *cptr; - /* The following is a hack to avoid changing lots of individual - pieces of code which actually only use a part of this packet - and ignore the worklist stuff. IMO the separate uses should - use separate packets, to avoid this problem (and would also - reduce amount sent). --dwp - */ - if (req_type != PACKET_PLAYER_WORKLIST) { - packet->worklist.name[0] = '\0'; - } - cptr=put_uint8(buffer+2, req_type); cptr=put_uint8(cptr, packet->tax); cptr=put_uint8(cptr, packet->luxury); @@ -1517,7 +1511,8 @@ cptr=put_uint8(cptr, packet->tech); /* when removing "worklist_true_ids" capability, may want to remove the 'pc' argument (?) */ - cptr=put_worklist(cptr, &packet->worklist, pc); + cptr=put_worklist(cptr, &packet->worklist, pc, + req_type == PACKET_PLAYER_WORKLIST); cptr=put_uint8(cptr, packet->wl_idx); put_uint16(buffer, cptr-buffer); @@ -1557,7 +1552,7 @@ ... **************************************************************************/ int send_packet_city_request(struct connection *pc, - struct packet_city_request *packet, + const struct packet_city_request *packet, enum packet_type req_type) { unsigned char buffer[MAX_LEN_PACKET], *cptr; @@ -1571,7 +1566,7 @@ cptr=put_uint8(cptr, packet->specialist_to); /* when removing "worklist_true_ids" capability, may want to remove the 'pc' argument (?) */ - cptr=put_worklist(cptr, &packet->worklist, pc); + cptr=put_worklist(cptr, &packet->worklist, pc, 1); cptr=put_string(cptr, packet->name); put_uint16(buffer, cptr-buffer); @@ -1612,7 +1607,8 @@ /************************************************************************* ... **************************************************************************/ -int send_packet_player_info(struct connection *pc, struct packet_player_info *pinfo) +int send_packet_player_info(struct connection *pc, + const struct packet_player_info *pinfo) { unsigned char buffer[MAX_LEN_PACKET], *cptr; int i; @@ -1671,7 +1667,7 @@ for (i = 0; i < MAX_NUM_WORKLISTS; i++) { /* when removing "worklist_true_ids" capability, may want to remove the 'pc' argument (?) */ - cptr = put_worklist(cptr, &pinfo->worklists[i], pc); + cptr = put_worklist(cptr, &pinfo->worklists[i], pc, 1); } if (pc && has_capability("shared_vision", pc->capability)) { @@ -1771,7 +1767,7 @@ ... **************************************************************************/ int send_packet_conn_info(struct connection *pc, - struct packet_conn_info *pinfo) + const struct packet_conn_info *pinfo) { unsigned char buffer[MAX_LEN_PACKET], *cptr; int data; @@ -1841,7 +1837,7 @@ ... **************************************************************************/ int send_packet_game_info(struct connection *pc, - struct packet_game_info *pinfo) + const struct packet_game_info *pinfo) { unsigned char buffer[MAX_LEN_PACKET], *cptr; int i; @@ -1970,7 +1966,7 @@ ... **************************************************************************/ int send_packet_map_info(struct connection *pc, - struct packet_map_info *pinfo) + const struct packet_map_info *pinfo) { unsigned char buffer[MAX_LEN_PACKET], *cptr; @@ -2047,7 +2043,7 @@ ... **************************************************************************/ int send_packet_tile_info(struct connection *pc, - struct packet_tile_info *pinfo) + const struct packet_tile_info *pinfo) { unsigned char buffer[MAX_LEN_PACKET], *cptr; @@ -2075,8 +2071,8 @@ /************************************************************************** ... **************************************************************************/ -int send_packet_new_year(struct connection *pc, struct - packet_new_year *request) +int send_packet_new_year(struct connection *pc, + const struct packet_new_year *request) { unsigned char buffer[MAX_LEN_PACKET], *cptr; cptr=put_uint8(buffer+2, PACKET_NEW_YEAR); @@ -2131,7 +2127,7 @@ ... **************************************************************************/ int send_packet_unit_info(struct connection *pc, - struct packet_unit_info *req) + const struct packet_unit_info *req) { unsigned char buffer[MAX_LEN_PACKET], *cptr; unsigned char pack; @@ -2194,7 +2190,8 @@ /************************************************************************* ... **************************************************************************/ -int send_packet_city_info(struct connection *pc, struct packet_city_info *req) +int send_packet_city_info(struct connection *pc, + const struct packet_city_info *req) { unsigned char buffer[MAX_LEN_PACKET], *cptr; int data; @@ -2238,7 +2235,7 @@ /* when removing "worklist_true_ids" capability, may want to remove the 'pc' argument (?) */ - cptr=put_worklist(cptr, &req->worklist, pc); + cptr=put_worklist(cptr, &req->worklist, pc, 1); data=req->is_building_unit?1:0; data|=req->did_buy?2:0; @@ -2365,7 +2362,8 @@ /************************************************************************* ... **************************************************************************/ -int send_packet_short_city(struct connection *pc, struct packet_short_city *req) +int send_packet_short_city(struct connection *pc, + const struct packet_short_city *req) { unsigned char buffer[MAX_LEN_PACKET], *cptr; int i; @@ -2577,8 +2575,8 @@ /************************************************************************** ... **************************************************************************/ -int send_packet_move_unit(struct connection *pc, struct - packet_move_unit *request) +int send_packet_move_unit(struct connection *pc, + const struct packet_move_unit *request) { unsigned char buffer[MAX_LEN_PACKET], *cptr; @@ -2616,8 +2614,8 @@ /************************************************************************** ... **************************************************************************/ -int send_packet_req_join_game(struct connection *pc, struct - packet_req_join_game *request) +int send_packet_req_join_game(struct connection *pc, + const struct packet_req_join_game *request) { unsigned char buffer[MAX_LEN_PACKET], *cptr; cptr=put_uint8(buffer+2, PACKET_REQUEST_JOIN_GAME); @@ -2637,8 +2635,8 @@ ... Fills in conn.id automatically, no need to set in packet_join_game_reply. **************************************************************************/ -int send_packet_join_game_reply(struct connection *pc, struct - packet_join_game_reply *reply) +int send_packet_join_game_reply(struct connection *pc, + const struct packet_join_game_reply *reply) { unsigned char buffer[MAX_LEN_PACKET], *cptr; cptr=put_uint8(buffer+2, PACKET_JOIN_GAME_REPLY); @@ -2666,7 +2664,7 @@ ... **************************************************************************/ int send_packet_generic_message(struct connection *pc, int type, - struct packet_generic_message *packet) + const struct packet_generic_message *packet) { unsigned char buffer[MAX_LEN_PACKET], *cptr; cptr=put_uint8(buffer+2, type); @@ -2706,7 +2704,7 @@ ... **************************************************************************/ int send_packet_generic_integer(struct connection *pc, int type, - struct packet_generic_integer *packet) + const struct packet_generic_integer *packet) { unsigned char buffer[MAX_LEN_PACKET], *cptr; cptr=put_uint8(buffer+2, type); @@ -2834,7 +2832,7 @@ ... **************************************************************************/ int send_packet_alloc_nation(struct connection *pc, - struct packet_alloc_nation *packet) + const struct packet_alloc_nation *packet) { unsigned char buffer[MAX_LEN_PACKET], *cptr; cptr=put_uint8(buffer+2, PACKET_ALLOC_NATION); @@ -2873,7 +2871,7 @@ ... **************************************************************************/ int send_packet_generic_values(struct connection *pc, int type, - struct packet_generic_values *req) + const struct packet_generic_values *req) { unsigned char buffer[MAX_LEN_PACKET], *cptr; @@ -2920,7 +2918,7 @@ ... **************************************************************************/ int send_packet_ruleset_control(struct connection *pc, - struct packet_ruleset_control *packet) + const struct packet_ruleset_control *packet) { unsigned char buffer[MAX_LEN_PACKET], *cptr; @@ -3006,7 +3004,7 @@ ... **************************************************************************/ int send_packet_ruleset_unit(struct connection *pc, - struct packet_ruleset_unit *packet) + const struct packet_ruleset_unit *packet) { unsigned char buffer[MAX_LEN_PACKET], *cptr; cptr=put_uint8(buffer+2, PACKET_RULESET_UNIT); @@ -3112,7 +3110,7 @@ ... **************************************************************************/ int send_packet_ruleset_tech(struct connection *pc, - struct packet_ruleset_tech *packet) + const struct packet_ruleset_tech *packet) { unsigned char buffer[MAX_LEN_PACKET], *cptr; cptr=put_uint8(buffer+2, PACKET_RULESET_TECH); @@ -3168,7 +3166,7 @@ ... **************************************************************************/ int send_packet_ruleset_building(struct connection *pc, - struct packet_ruleset_building *packet) + const struct packet_ruleset_building *packet) { unsigned char buffer[MAX_LEN_PACKET], *cptr; struct impr_effect *eff; @@ -3286,7 +3284,7 @@ ... **************************************************************************/ int send_packet_ruleset_terrain(struct connection *pc, - struct packet_ruleset_terrain *packet) + const struct packet_ruleset_terrain *packet) { int i; unsigned char buffer[MAX_LEN_PACKET], *cptr; @@ -3399,7 +3397,7 @@ ... **************************************************************************/ int send_packet_ruleset_terrain_control(struct connection *pc, - struct terrain_misc *packet) + const struct terrain_misc *packet) { unsigned char buffer[MAX_LEN_PACKET], *cptr; cptr=put_uint8(buffer+2, PACKET_RULESET_TERRAIN_CONTROL); @@ -3496,7 +3494,7 @@ ... **************************************************************************/ int send_packet_ruleset_government(struct connection *pc, - struct packet_ruleset_government *packet) + const struct packet_ruleset_government *packet) { unsigned char buffer[MAX_LEN_PACKET], *cptr; cptr=put_uint8(buffer+2, PACKET_RULESET_GOVERNMENT); @@ -3563,8 +3561,9 @@ put_uint16(buffer, cptr-buffer); return send_connection_data(pc, buffer, cptr-buffer); } + int send_packet_ruleset_government_ruler_title(struct connection *pc, - struct packet_ruleset_government_ruler_title *packet) + const struct packet_ruleset_government_ruler_title *packet) { unsigned char buffer[MAX_LEN_PACKET], *cptr; cptr=put_uint8(buffer+2, PACKET_RULESET_GOVERNMENT_RULER_TITLE); @@ -3685,7 +3684,7 @@ ... **************************************************************************/ int send_packet_ruleset_nation(struct connection *pc, - struct packet_ruleset_nation *packet) + const struct packet_ruleset_nation *packet) { int i; unsigned char buffer[MAX_LEN_PACKET], *cptr; @@ -3744,7 +3743,7 @@ ... **************************************************************************/ int send_packet_ruleset_city(struct connection *pc, - struct packet_ruleset_city *packet) + const struct packet_ruleset_city *packet) { unsigned char buffer[MAX_LEN_PACKET], *cptr; cptr=put_uint8(buffer+2, PACKET_RULESET_CITY); @@ -3791,7 +3790,7 @@ ... **************************************************************************/ int send_packet_ruleset_game(struct connection *pc, - struct packet_ruleset_game *packet) + const struct packet_ruleset_game *packet) { unsigned char buffer[MAX_LEN_PACKET], *cptr; /* when removing "game_ruleset" capability, @@ -3862,7 +3861,7 @@ ... **************************************************************************/ int send_packet_spaceship_info(struct connection *pc, - struct packet_spaceship_info *packet) + const struct packet_spaceship_info *packet) { unsigned char buffer[MAX_LEN_PACKET], *cptr; cptr=put_uint8(buffer+2, PACKET_SPACESHIP_INFO); @@ -3941,7 +3940,7 @@ ... **************************************************************************/ int send_packet_spaceship_action(struct connection *pc, - struct packet_spaceship_action *packet) + const struct packet_spaceship_action *packet) { unsigned char buffer[MAX_LEN_PACKET], *cptr; cptr=put_uint8(buffer+2, PACKET_SPACESHIP_ACTION); @@ -3977,7 +3976,7 @@ ... **************************************************************************/ int send_packet_city_name_suggestion(struct connection *pc, - struct packet_city_name_suggestion *packet) + const struct packet_city_name_suggestion *packet) { unsigned char buffer[MAX_LEN_PACKET], *cptr; cptr=put_uint8(buffer+2, PACKET_CITY_NAME_SUGGESTION); @@ -4013,7 +4012,7 @@ ... **************************************************************************/ int send_packet_sabotage_list(struct connection *pc, - struct packet_sabotage_list *packet) + const struct packet_sabotage_list *packet) { unsigned char buffer[MAX_LEN_PACKET], *cptr; cptr = put_uint8(buffer+2, PACKET_SABOTAGE_LIST); @@ -4056,7 +4055,7 @@ Chop the route up and send the pieces one by one. **************************************************************************/ int send_packet_goto_route(struct connection *pc, - struct packet_goto_route *packet, + const struct packet_goto_route *packet, enum goto_route_type type) { int i; diff common/packets.h common/packets.h --- common/packets.h Mon Jan 22 14:29:28 2001 +++ common/packets.h Mon Jan 22 16:32:29 2001 @@ -852,111 +852,113 @@ /* These two are non-static for meta.c; others are now static --dwp */ unsigned char *put_uint16(unsigned char *buffer, int val); -unsigned char *put_string(unsigned char *buffer, char *mystring); +unsigned char *put_string(unsigned char *buffer, const char *mystring); int send_packet_diplomacy_info(struct connection *pc, enum packet_type pt, - struct packet_diplomacy_info *packet); + const struct packet_diplomacy_info *packet); struct packet_diplomacy_info * receive_packet_diplomacy_info(struct connection *pc); int send_packet_diplomat_action(struct connection *pc, - struct packet_diplomat_action *packet); + const struct packet_diplomat_action *packet); struct packet_diplomat_action * receive_packet_diplomat_action(struct connection *pc); int send_packet_nuke_tile(struct connection *pc, - struct packet_nuke_tile *packet); + const struct packet_nuke_tile *packet); struct packet_nuke_tile * receive_packet_nuke_tile(struct connection *pc); int send_packet_unit_combat(struct connection *pc, - struct packet_unit_combat *packet); + const struct packet_unit_combat *packet); struct packet_unit_combat * receive_packet_unit_combat(struct connection *pc); int send_packet_unit_connect(struct connection *pc, - struct packet_unit_connect *packet); + const struct packet_unit_connect *packet); struct packet_unit_connect * receive_packet_unit_connect(struct connection *pc); int send_packet_tile_info(struct connection *pc, - struct packet_tile_info *pinfo); + const struct packet_tile_info *pinfo); struct packet_tile_info *receive_packet_tile_info(struct connection *pc); int send_packet_map_info(struct connection *pc, - struct packet_map_info *pinfo); + const struct packet_map_info *pinfo); struct packet_map_info *receive_packet_map_info(struct connection *pc); int send_packet_game_info(struct connection *pc, - struct packet_game_info *pinfo); + const struct packet_game_info *pinfo); struct packet_game_info *receive_packet_game_info(struct connection *pc); struct packet_player_info *receive_packet_player_info(struct connection *pc); int send_packet_player_info(struct connection *pc, - struct packet_player_info *pinfo); + const struct packet_player_info *pinfo); struct packet_conn_info *receive_packet_conn_info(struct connection *pc); int send_packet_conn_info(struct connection *pc, - struct packet_conn_info *pinfo); + const struct packet_conn_info *pinfo); int send_packet_new_year(struct connection *pc, - struct packet_new_year *request); + const struct packet_new_year *request); struct packet_new_year *receive_packet_new_year(struct connection *pc); int send_packet_move_unit(struct connection *pc, - struct packet_move_unit *request); + const struct packet_move_unit *request); struct packet_move_unit *receive_packet_move_unit(struct connection *pc); int send_packet_unit_info(struct connection *pc, - struct packet_unit_info *req); + const struct packet_unit_info *req); struct packet_unit_info *receive_packet_unit_info(struct connection *pc); int send_packet_req_join_game(struct connection *pc, - struct packet_req_join_game *request); + const struct packet_req_join_game *request); struct packet_req_join_game *receive_packet_req_join_game(struct connection *pc); int send_packet_join_game_reply(struct connection *pc, - struct packet_join_game_reply *reply); + const struct packet_join_game_reply *reply); struct packet_join_game_reply *receive_packet_join_game_reply(struct connection *pc); int send_packet_alloc_nation(struct connection *pc, - struct packet_alloc_nation *packet); + const struct packet_alloc_nation *packet); struct packet_alloc_nation *receive_packet_alloc_nation(struct connection *pc); int send_packet_generic_message(struct connection *pc, int type, - struct packet_generic_message *message); + const struct packet_generic_message *message); struct packet_generic_message *receive_packet_generic_message(struct connection *pc); int send_packet_generic_integer(struct connection *pc, int type, - struct packet_generic_integer *packet); + const struct packet_generic_integer *packet); struct packet_generic_integer *receive_packet_generic_integer(struct connection *pc); -int send_packet_city_info(struct connection *pc,struct packet_city_info *req); +int send_packet_city_info(struct connection *pc, + const struct packet_city_info *req); struct packet_city_info *receive_packet_city_info(struct connection *pc); -int send_packet_short_city(struct connection *pc,struct packet_short_city *req); +int send_packet_short_city(struct connection *pc, + const struct packet_short_city *req); struct packet_short_city *receive_packet_short_city(struct connection *pc); int send_packet_city_request(struct connection *pc, - struct packet_city_request *packet, + const struct packet_city_request *packet, enum packet_type req_type); struct packet_city_request * receive_packet_city_request(struct connection *pc); int send_packet_player_request(struct connection *pc, - struct packet_player_request *packet, + const struct packet_player_request *packet, enum packet_type req_type); struct packet_player_request * receive_packet_player_request(struct connection *pc); @@ -964,7 +966,7 @@ struct packet_unit_request * receive_packet_unit_request(struct connection *pc); int send_packet_unit_request(struct connection *pc, - struct packet_unit_request *packet, + const struct packet_unit_request *packet, enum packet_type req_type); int send_packet_before_new_year(struct connection *pc); @@ -975,87 +977,88 @@ struct packet_unittype_info *receive_packet_unittype_info(struct connection *pc); int send_packet_ruleset_control(struct connection *pc, - struct packet_ruleset_control *pinfo); + const struct packet_ruleset_control *pinfo); struct packet_ruleset_control * receive_packet_ruleset_control(struct connection *pc); int send_packet_ruleset_unit(struct connection *pc, - struct packet_ruleset_unit *packet); + const struct packet_ruleset_unit *packet); struct packet_ruleset_unit * receive_packet_ruleset_unit(struct connection *pc); int send_packet_ruleset_tech(struct connection *pc, - struct packet_ruleset_tech *packet); + const struct packet_ruleset_tech *packet); struct packet_ruleset_tech * receive_packet_ruleset_tech(struct connection *pc); int send_packet_ruleset_building(struct connection *pc, - struct packet_ruleset_building *packet); + const struct packet_ruleset_building *packet); struct packet_ruleset_building * receive_packet_ruleset_building(struct connection *pc); int send_packet_ruleset_terrain(struct connection *pc, - struct packet_ruleset_terrain *packet); + const struct packet_ruleset_terrain *packet); struct packet_ruleset_terrain * receive_packet_ruleset_terrain(struct connection *pc); int send_packet_ruleset_terrain_control(struct connection *pc, - struct terrain_misc *packet); + const struct terrain_misc *packet); struct terrain_misc * receive_packet_ruleset_terrain_control(struct connection *pc); int send_packet_ruleset_government(struct connection *pc, - struct packet_ruleset_government *packet); + const struct packet_ruleset_government *packet); struct packet_ruleset_government * receive_packet_ruleset_government(struct connection *pc); int send_packet_ruleset_government_ruler_title(struct connection *pc, - struct packet_ruleset_government_ruler_title *packet); + const struct packet_ruleset_government_ruler_title *packet); struct packet_ruleset_government_ruler_title * receive_packet_ruleset_government_ruler_title(struct connection *pc); int send_packet_ruleset_nation(struct connection *pc, - struct packet_ruleset_nation *packet); + const struct packet_ruleset_nation *packet); struct packet_ruleset_nation * receive_packet_ruleset_nation(struct connection *pc); int send_packet_ruleset_city(struct connection *pc, - struct packet_ruleset_city *packet); + const struct packet_ruleset_city *packet); struct packet_ruleset_city * receive_packet_ruleset_city(struct connection *pc); int send_packet_ruleset_game(struct connection *pc, - struct packet_ruleset_game *packet); + const struct packet_ruleset_game *packet); struct packet_ruleset_game * receive_packet_ruleset_game(struct connection *pc); int send_packet_generic_values(struct connection *pc, int type, - struct packet_generic_values *req); + const struct packet_generic_values *req); struct packet_generic_values * receive_packet_generic_values(struct connection *pc); int send_packet_spaceship_info(struct connection *pc, - struct packet_spaceship_info *packet); + const struct packet_spaceship_info *packet); struct packet_spaceship_info * receive_packet_spaceship_info(struct connection *pc); int send_packet_spaceship_action(struct connection *pc, - struct packet_spaceship_action *packet); + const struct packet_spaceship_action *packet); struct packet_spaceship_action * receive_packet_spaceship_action(struct connection *pc); int send_packet_city_name_suggestion(struct connection *pc, - struct packet_city_name_suggestion *packet); + const struct packet_city_name_suggestion *packet); struct packet_city_name_suggestion * receive_packet_city_name_suggestion(struct connection *pc); int send_packet_sabotage_list(struct connection *pc, - struct packet_sabotage_list *packet); + const struct packet_sabotage_list *packet); struct packet_sabotage_list * receive_packet_sabotage_list(struct connection *pc); void *get_packet_from_connection(struct connection *pc, int *ptype, int *presult); void remove_packet_from_buffer(struct socket_packet_buffer *buffer); -int send_packet_goto_route(struct connection *pc, struct packet_goto_route *packet, +int send_packet_goto_route(struct connection *pc, + const struct packet_goto_route *packet, enum goto_route_type type); struct packet_goto_route *receive_packet_goto_route(struct connection *pc);