Complete.Org: Mailing Lists: Archives: freeciv-dev: October 2001:
[Freeciv-Dev] [PATCH] "focus hack" removal (PR#1030)
Home

[Freeciv-Dev] [PATCH] "focus hack" removal (PR#1030)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Cc: bugs@xxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] [PATCH] "focus hack" removal (PR#1030)
From: jdorje@xxxxxxxxxxxxxxxxxxxxx
Date: Thu, 25 Oct 2001 18:16:14 -0700 (PDT)

The very small attached patch removes the "focus hack" from do_move_unit()
in client/control.c.  This allows a check_map_pos patch (proposed
separately) to work cleanly.

The focus hack changes the position of the unit so that it is not drawn in
refresh_tile_mapcanvas below.  (The unit is in focus, of course, since it's
being moved.)  Later in refresh_tile_mapcanvas, a check is done to see if
the unit in focus is on the current square, and if so it's drawn.  Since the
unit has been moved, it will not be found on the current square but since
the coordinates of the unit are invalid a call to map_get_tile for those
coordinates is not "clean".  Under alternate topologies the behavior may
become unpredictable.

It does not appear as though this hack is needed; it is very old and I see
no problems with drawing when it is removed.  If it is to be kept, there are
several ways it could be handled.  An is_normal_map_pos check could be done
before the map_get_tile call, or the unit could be removed from focus
entirely (which would solve the problem but may have side effects).

A comment is left in place of the hack; if there are problems it should be
easy enough to fix.  (I also wouldn't mind if the comment were removed, if
that's preferred.)

jason
Index: client/control.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/control.c,v
retrieving revision 1.62
diff -u -r1.62 control.c
--- client/control.c    2001/10/18 15:12:46     1.62
+++ client/control.c    2001/10/26 01:05:43
@@ -1030,8 +1030,9 @@
   was_teleported=!is_tiles_adjacent(punit->x, punit->y, pinfo->x, pinfo->y);
   x=punit->x;
   y=punit->y;
-  punit->x=-1;  /* focus hack - if we're moving the unit in focus, it wont
-                * be redrawn on top of the city */
+  /* We used to have a "focus hack" here that moved the unit to be at a
+   * different position so that it wouldn't be drawn below.  This didn't
+   * seem to be necessary, so it's been removed. */
 
   unit_list_unlink(&map_get_tile(x, y)->units, punit);
 

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] [PATCH] "focus hack" removal (PR#1030), jdorje <=