[Freeciv-Dev] (PR#13575) Centering active unit
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=13575 >
> [jdorje - Wed Aug 03 19:29:17 2005]:
>
> > [chrisk - Sun Jul 31 09:42:44 2005]:
> >
> >
> > CVS 30 JUL 2005 S2 GTK2
> > Not tested for HEAD
> >
> > 1. There is no way to center the map on the active unit, with a simple
> > mouse
> > click.
> >
> > 2. If you click on the active unit as displayed in the left hand
> > status bar
> > (which is the single topmost unit displayed there), the map does not
> > center.
> > You may consider this as a bug, since clicking on other (e.g.
> > fortified) units
> > there *does* center these units on the map. I suggest to change this,
> > which
> > fixes (1.), too.
>
> This patch should do it. This could go into 2.0 also I guess.
Um, that would be this patch.
-jason
Index: client/gui-gtk-2.0/gui_main.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/gui_main.c,v
retrieving revision 1.133
diff -p -u -r1.133 gui_main.c
--- client/gui-gtk-2.0/gui_main.c 21 Jul 2005 08:17:09 -0000 1.133
+++ client/gui-gtk-2.0/gui_main.c 3 Aug 2005 19:30:15 -0000
@@ -1456,8 +1456,13 @@ static gboolean select_unit_pixmap_callb
int i = GPOINTER_TO_INT(data);
struct unit *punit;
- if (i == -1) /* unit currently selected */
+ if (i == -1) {
+ if ((punit = get_unit_in_focus())) {
+ /* Clicking on the currently selected unit will center it. */
+ center_tile_mapcanvas(punit->tile);
+ }
return TRUE;
+ }
if (unit_ids[i] == 0) /* no unit displayed at this place */
return TRUE;
|
|