diff -Nur -X/mnt/data/freeciv-dev/freeciv/diff_ignore freeciv/client/control.c codeciv/client/control.c --- freeciv/client/control.c Fri Aug 17 10:46:35 2001 +++ codeciv/client/control.c Fri Aug 17 11:16:13 2001 @@ -1046,13 +1046,18 @@ !tile_visible_and_not_on_border_mapcanvas(pinfo->x, pinfo->y)) center_tile_mapcanvas(pinfo->x, pinfo->y); - if(!pinfo->carried && !was_teleported) { - int dx=pinfo->x - x; - if(dx>1) dx=-1; - else if(dx<-1) - dx=1; - if(smooth_move_units) - move_unit_map_canvas(punit, x, y, dx, pinfo->y - punit->y); + if (!pinfo->carried && !was_teleported + && real_map_distance(x, y, pinfo->x, pinfo->y) == 1) { + if (smooth_move_units + && (tile_visible_mapcanvas(x, y) + || tile_visible_mapcanvas(pinfo->x, pinfo->y))) { + if (punit == get_unit_in_focus() && hover_state != HOVER_NONE) { + set_hover_state(NULL, HOVER_NONE); + update_unit_info_label(punit); + } + /*play_sound(UNIT_MOVE);*/ + move_unit_map_canvas(punit, x, y, pinfo->x, punit->y); + } refresh_tile_mapcanvas(x, y, 1); } diff -Nur -X/mnt/data/freeciv-dev/freeciv/diff_ignore freeciv/client/gui-gtk/mapview.c codeciv/client/gui-gtk/mapview.c --- freeciv/client/gui-gtk/mapview.c Fri Aug 17 10:46:38 2001 +++ codeciv/client/gui-gtk/mapview.c Fri Aug 17 11:13:51 2001 @@ -700,9 +700,8 @@ } } - /************************************************************************** -Animates punit's "smooth" move from (x0,y0) to (x0+dx,y0+dy). +Animates punit's "smooth" move from (x0,y0) to (dest_x, dest_y). Note: Works only for adjacent-square moves. (Tiles need not be square.) FIXME: The unit flickers while it is moved because we first undraw the unit @@ -710,28 +709,17 @@ where we draw the complete scene onto, and then draw it onto the screen in one go. **************************************************************************/ -void move_unit_map_canvas(struct unit *punit, int x0, int y0, int dx, int dy) +void move_unit_map_canvas(struct unit *punit, int x0, int y0, int dest_x, int dest_y) { static struct timer *anim_timer = NULL; - int dest_x, dest_y; - - /* only works for adjacent-square moves */ - if ((dx < -1) || (dx > 1) || (dy < -1) || (dy > 1) || - ((dx == 0) && (dy == 0))) { - return; - } - - if (punit == get_unit_in_focus() && hover_state != HOVER_NONE) { - set_hover_state(NULL, HOVER_NONE); - update_unit_info_label(punit); - } + int dy = dest_y - y0; + int dx = dest_x - x0; + if(dx > 1) dx = -1; + else if(dx < -1) dx = 1; - dest_x = map_adjust_x(x0+dx); - dest_y = map_adjust_y(y0+dy); + assert(is_tiles_adjacent(x0, y0, dest_x, dest_y)); - if (player_can_see_unit(game.player_ptr, punit) && - (tile_visible_mapcanvas(x0, y0) || - tile_visible_mapcanvas(dest_x, dest_y))) { + if (player_can_see_unit(game.player_ptr, punit)) { int i, steps; int start_x, start_y; int this_x, this_y; diff -Nur -X/mnt/data/freeciv-dev/freeciv/diff_ignore freeciv/client/include/mapview_g.h codeciv/client/include/mapview_g.h --- freeciv/client/include/mapview_g.h Fri Aug 17 10:46:50 2001 +++ codeciv/client/include/mapview_g.h Fri Aug 17 11:04:44 2001 @@ -40,7 +40,7 @@ void put_cross_overlay_tile(int x,int y); void put_city_workers(struct city *pcity, int color); -void move_unit_map_canvas(struct unit *punit, int x0, int y0, int x1, int y1); +void move_unit_map_canvas(struct unit *punit, int x0, int y0, int dest_x, int dest_y); void decrease_unit_hp_smooth(struct unit *punit0, int hp0, struct unit *punit1, int hp1); void put_nuke_mushroom_pixmaps(int x, int y);