Complete.Org: Mailing Lists: Archives: freeciv-dev: December 2002:
[Freeciv-Dev] (PR#2602) blinking unit out-of-sync
Home

[Freeciv-Dev] (PR#2602) blinking unit out-of-sync

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients:;
Subject: [Freeciv-Dev] (PR#2602) blinking unit out-of-sync
From: "Jason Short via RT" <rt@xxxxxxxxxxxxxx>
Date: Tue, 17 Dec 2002 19:55:57 -0800
Reply-to: rt@xxxxxxxxxxxxxx

When you switch the focus unit, the is_shown flag isn't reset.  This
means the next blink of the unit will toggle based on whether the
previous unit was shown rather than the new focus unit.  When this
happens it is slightly confusing since you don't know which unit you've
controlled for up to a second (two blink intervals).

This is easily corrected by checking for focus_unit changes and
resetting is_shown when it happens.  This leads to slightly better
behavior.

Even better behavior could be achieved, but it would take more
complicated changes (which may be GUI-specific).  IMO:

- The blink interval should be reset when unit focus changes, so the
next blink happens immediately.

- When unit focus changes to a unit on the current canvas, we should set
is_shown to TRUE so the unit immediately blinks away.

- When focus changes to a unit on a different canvas (i.e. we recenter
the canvas), we should set is_shown to FALSE so the unit doesn't blink
away for half a second.

jason


Index: client/control.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/control.c,v
retrieving revision 1.88
diff -u -r1.88 control.c
--- client/control.c    2002/12/11 10:39:41     1.88
+++ client/control.c    2002/12/18 03:50:58
@@ -345,9 +345,15 @@
 void blink_active_unit(void)
 {
   static bool is_shown;
+  static struct unit *pblinking_unit;
   struct unit *punit;
 
   if((punit=get_unit_in_focus())) {
+    if (punit != pblinking_unit) {
+      /* When the focus unit changes, we reset the is_shown flag. */
+      pblinking_unit = punit;
+      is_shown = TRUE;
+    }
     if(is_shown) {
       set_focus_unit_hidden_state(TRUE);
       refresh_tile_mapcanvas(punit->x, punit->y, TRUE);

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#2602) blinking unit out-of-sync, Jason Short via RT <=