diff -Nur -X/home/thue/freeciv-dev/freeciv/diff_ignore freeciv/common/game.c workdir/common/game.c --- freeciv/common/game.c Tue May 23 16:22:27 2000 +++ workdir/common/game.c Tue May 23 16:23:30 2000 @@ -658,7 +658,7 @@ /************************************************************************** -If called from server use the wrapper void server_remove_unit(punit); +If in the server use wipe_unit(). **************************************************************************/ void game_remove_unit(int unit_id) { diff -Nur -X/home/thue/freeciv-dev/freeciv/diff_ignore freeciv/server/unitfunc.c workdir/server/unitfunc.c --- freeciv/server/unitfunc.c Tue May 23 16:22:36 2000 +++ workdir/server/unitfunc.c Tue May 23 16:26:34 2000 @@ -1314,7 +1314,6 @@ /* This should usually only happen for heli units, but if any other units get 0 hp somehow, catch them too. --dwp */ - send_remove_unit(0, punit->id); notify_player_ex(pplayer, punit->x, punit->y, E_UNIT_LOST, _("Game: Your %s has run out of hit points."), unit_name(punit->type)); @@ -1375,7 +1374,6 @@ } } if(punit->fuel<=0) { - send_remove_unit(0, punit->id); notify_player_ex(pplayer, punit->x, punit->y, E_UNIT_LOST, _("Game: Your %s has run out of fuel."), unit_name(punit->type)); @@ -1738,26 +1736,6 @@ send_unit_info(0, punit); } - -/************************************************************************** - Removes the unit from the game, and notifies the clients. - TODO: Find out if the homecity is refreshed and resend when this happends - otherwise (refresh_city(homecity) + send_city(homecity)) -**************************************************************************/ -void send_remove_unit(struct player *pplayer, int unit_id) -{ - int o; - - struct packet_generic_integer packet; - - packet.value=unit_id; - - for(o=0; ox, punit->y); + struct city *phomecity = find_city_by_id(punit->homecity); + + remove_unit_sight_points(punit); + + packet.value = punit->id; + /* FIXME: maybe we should only send to those players who can see the unit, + as the client automatically removes any units in a fogged square, and + the send_unit_info() only sends units who are in non-fogged square. + Leaving for now. */ + for (o=0; oid); + + if (phomecity) { + city_refresh(phomecity); + send_city_info(get_player(phomecity->owner), phomecity); + } + if (pcity && pcity != phomecity) { + city_refresh(pcity); + send_city_info(get_player(pcity->owner), pcity); + } +} /************************************************************************** this is a highlevel routine @@ -2393,14 +2404,12 @@ n_if_vowel(get_unit_type(pcargo->type)->name[0]), get_unit_type(pcargo->type)->name, get_unit_type(punit->type)->name); - send_remove_unit(0, pcargo->id); server_remove_unit(pcargo); capacity++; } } unit_list_iterate_end; } - send_remove_unit(0, punit->id); server_remove_unit(punit); } @@ -2463,8 +2472,7 @@ get_unit_type(punit->type)->name, get_nation_name_plural(destroyer->nation)); - send_remove_unit(0, punit->id); - server_remove_unit(punit); + wipe_unit(punit); } else { notify_player_ex(pplayer, punit->x, punit->y, E_UNIT_LOST, @@ -2485,8 +2493,7 @@ n_if_vowel(get_unit_type(punit2->type)->name[0]), get_unit_type(punit2->type)->name, get_nation_name_plural(destroyer->nation)); - send_remove_unit(0, punit2->id); - server_remove_unit(punit2); + wipe_unit_spec_safe(punit2, NULL, 0); } unit_list_iterate_end; } diff -Nur -X/home/thue/freeciv-dev/freeciv/diff_ignore freeciv/server/unitfunc.h workdir/server/unitfunc.h --- freeciv/server/unitfunc.h Tue May 23 16:22:36 2000 +++ workdir/server/unitfunc.h Tue May 23 16:23:30 2000 @@ -47,7 +47,6 @@ void create_unit_full(struct player *pplayer, int x, int y, Unit_Type_id type, int make_veteran, int homecity_id, int moves_left, int hp_left); -void send_remove_unit(struct player *pplayer, int unit_id); void wipe_unit(struct unit *punit); void wipe_unit_safe(struct unit *punit, struct genlist_iterator *iter); void wipe_unit_spec_safe(struct unit *punit, struct genlist_iterator *iter, diff -Nur -X/home/thue/freeciv-dev/freeciv/diff_ignore freeciv/server/unithand.c workdir/server/unithand.c --- freeciv/server/unithand.c Tue May 23 16:22:36 2000 +++ workdir/server/unithand.c Tue May 23 16:23:30 2000 @@ -425,7 +425,6 @@ return; } - send_remove_unit(0, req->unit_id); if (terrain_control.may_road) { map_set_special(punit->x, punit->y, S_ROAD); if (player_knows_techs_with_flag(pplayer, TF_RAILROAD)) @@ -434,7 +433,7 @@ send_tile_info(0, punit->x, punit->y); create_city(pplayer, punit->x, punit->y, name); - server_remove_unit(punit); + wipe_unit(punit); } /************************************************************************** @@ -1324,26 +1323,4 @@ if (punit) do_paradrop(punit, req->x, req->y); -} - -/************************************************************************** -We remove the unit and see if it's disapperance have affected the homecity -and the city it was in. -**************************************************************************/ -void server_remove_unit(struct unit *punit) -{ - struct city *pcity = map_get_city(punit->x, punit->y); - struct city *phomecity = find_city_by_id(punit->homecity); - - remove_unit_sight_points(punit); - game_remove_unit(punit->id); - - if (phomecity) { - city_refresh(phomecity); - send_city_info(get_player(phomecity->owner), phomecity); - } - if (pcity && pcity != phomecity) { - city_refresh(pcity); - send_city_info(get_player(pcity->owner), pcity); - } } diff -Nur -X/home/thue/freeciv-dev/freeciv/diff_ignore freeciv/server/unithand.h workdir/server/unithand.h --- freeciv/server/unithand.h Tue May 23 16:22:36 2000 +++ workdir/server/unithand.h Tue May 23 16:23:30 2000 @@ -16,7 +16,6 @@ #include "packets.h" #include "unit.h" -void server_remove_unit(struct unit *punit); void handle_unit_goto_tile(struct player *pplayer, struct packet_unit_request *req); void handle_unit_connect(struct player *pplayer,