diff -ruN -X freeciv/diff_ignore freeciv/common/connection.c freeciv.mod2/common/connection.c --- freeciv/common/connection.c Mon Sep 18 22:36:14 2000 +++ freeciv.mod2/common/connection.c Wed Jan 17 11:26:31 2001 @@ -226,28 +226,30 @@ static int add_connection_data(struct connection *pc, unsigned char *data, int len) { - if (pc && pc->used) { - struct socket_packet_buffer *buf; + struct socket_packet_buffer *buf; - buf = pc->send_buffer; + if (!pc || !pc->used) { + freelog(LOG_ERROR, "passed a NULL connection or an unused " + "connection to add_connection_data"); + return 1; + } + + buf = pc->send_buffer; - /* room for more? */ - if(buf->nsize - buf->ndata < len) { - buf->nsize += MAX_LEN_PACKET; - if (!(buf->data = fc_realloc(buf->data, buf->nsize))) { - if (close_callback) { - (*close_callback)(pc); - } - return 0; + /* room for more? */ + if (buf->nsize - buf->ndata < len) { + buf->nsize += MAX_LEN_PACKET; + if (!(buf->data = fc_realloc(buf->data, buf->nsize))) { + if (close_callback) { + (*close_callback) (pc); } + return 0; } - memcpy(buf->data + buf->ndata, data, len); - buf->ndata += len; - return 1; } + memcpy(buf->data + buf->ndata, data, len); + buf->ndata += len; return 1; } - /************************************************************************** write data to socket **************************************************************************/ diff -ruN -X freeciv/diff_ignore freeciv/common/player.h freeciv.mod2/common/player.h --- freeciv/common/player.h Wed Sep 6 23:41:16 2000 +++ freeciv.mod2/common/player.h Wed Jan 17 11:24:13 2001 @@ -152,12 +152,17 @@ int future_tech; struct player_ai ai; int is_connected; /* observers don't count */ - struct connection *current_conn; /* non-null while handling packet */ struct conn_list connections; /* will replace conn */ struct worklist worklists[MAX_NUM_WORKLISTS]; struct player_tile *private_map; unsigned int gives_shared_vision; /* bitvector those that give you shared vision */ unsigned int really_gives_vision; /* takes into account that p3 may see what p1 has via p2 */ + + /* + * SERVER ONLY: the values of the following variables are + * meaningless on the client. + */ + struct connection *current_conn; /* non-null while handling packet */ }; void player_init(struct player *plr);