Index: client/civclient.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/client/civclient.c,v retrieving revision 1.127 diff -u -r1.127 civclient.c --- client/civclient.c 2002/05/03 16:35:07 1.127 +++ client/civclient.c 2002/05/16 13:07:43 @@ -557,10 +557,9 @@ popdown_all_city_dialogs(); close_all_diplomacy_dialogs(); client_remove_all_cli_conn(); - game_remove_all_players(); set_unit_focus_no_center(NULL); clear_notify_window(); - idex_init(); /* clear old data */ + game_init(); } update_menus(); } Index: client/climisc.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/client/climisc.c,v retrieving revision 1.94 diff -u -r1.94 climisc.c --- client/climisc.c 2002/04/27 03:58:36 1.94 +++ client/climisc.c 2002/05/16 13:07:44 @@ -203,7 +203,7 @@ **************************************************************************/ void client_remove_player(int plrno) { - player_free_island_imprs(get_player(plrno), max_cont_used); + game_remove_player(get_player(plrno)); game_renumber_players(plrno); } Index: common/game.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/game.c,v retrieving revision 1.139 diff -u -r1.139 game.c --- common/game.c 2002/04/30 12:52:54 1.139 +++ common/game.c 2002/05/16 13:07:45 @@ -40,6 +40,7 @@ void dealloc_id(int id); extern bool is_server; struct civ_game game; +static bool first_init_call = TRUE; /* struct player_score { @@ -695,6 +696,11 @@ game.nbarbarians = 0; game.occupychance= GAME_DEFAULT_OCCUPYCHANCE; + if (!first_init_call) { + geff_vector_free(&game.effects); + ceff_vector_free(&game.destroyed_effects); + } + geff_vector_init(&game.effects); ceff_vector_init(&game.destroyed_effects); @@ -741,11 +747,18 @@ map_init(); idex_init(); + + if (!first_init_call) { + conn_list_unlink_all(&game.all_connections); + conn_list_unlink_all(&game.est_connections); + conn_list_unlink_all(&game.game_connections); + game_remove_all_players(); + } conn_list_init(&game.all_connections); conn_list_init(&game.est_connections); conn_list_init(&game.game_connections); - + for(i=0; ieffects); + player_free_island_imprs(pplayer); unit_list_iterate(pplayer->units, punit) game_remove_unit(punit); @@ -1020,6 +1036,7 @@ for (i=oldmax+1; i<=maxcont; i++) { geff_vector_init(&plr->island_effects[i]); } + plr->max_continent = maxcont; } players_iterate_end; } Index: common/player.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/player.c,v retrieving revision 1.94 diff -u -r1.94 player.c --- common/player.c 2002/04/05 05:56:49 1.94 +++ common/player.c 2002/05/16 13:07:46 @@ -126,7 +126,7 @@ { int i; - player_free_island_imprs(plr, numcont); + player_free_island_imprs(plr); if (game.num_impr_types>0) { /* Initialise lists of improvements with island-wide equiv_range. */ if (plr->island_improv) @@ -149,7 +149,7 @@ Frees the player's list of island-range improvements and effects. ***************************************************************/ -void player_free_island_imprs(struct player *plr, int numcont) +void player_free_island_imprs(struct player *plr) { int i; @@ -159,11 +159,12 @@ } if (plr->island_effects) { - for (i=0; i<=numcont; i++) { + for (i=0; i<=plr->max_continent; i++) { geff_vector_free(&plr->island_effects[i]); } free(plr->island_effects); plr->island_effects = NULL; + plr->max_continent = 0; } } Index: common/player.h =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/player.h,v retrieving revision 1.75 diff -u -r1.75 player.h --- common/player.h 2002/03/05 19:13:44 1.75 +++ common/player.h 2002/05/16 13:07:46 @@ -190,6 +190,7 @@ [map.num_continents][game.num_impr_types] */ struct geff_vector effects; /* effects with range==Player */ struct geff_vector *island_effects; /* effects with range==Island */ + int max_continent; struct { int length; @@ -199,7 +200,7 @@ void player_init(struct player *plr); void player_init_island_imprs(struct player *plr, int numcont); -void player_free_island_imprs(struct player *plr, int numcont); +void player_free_island_imprs(struct player *plr); struct player *find_player_by_name(char *name); struct player *find_player_by_name_prefix(const char *name, enum m_pre_result *result); Index: server/plrhand.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/server/plrhand.c,v retrieving revision 1.233 diff -u -r1.233 plrhand.c --- server/plrhand.c 2002/05/07 07:40:54 1.233 +++ server/plrhand.c 2002/05/16 13:07:48 @@ -1344,7 +1344,6 @@ lsend_packet_generic_integer(&game.est_connections, PACKET_REMOVE_PLAYER, &pack); - player_free_island_imprs(pplayer, map.num_continents); game_remove_player(pplayer); game_renumber_players(pplayer->player_no); }