<URL: http://bugs.freeciv.org/Ticket/Display.html?id=15854 >

On 09/09/07, Marko Lindqvist wrote:
> On 05/09/07, Pepeto _  wrote:
> >
> > It occurs when the server wake up an unit (which was sentried) whereas
> > you are selecting a destination for an other unit.
>
>  Patch

 Ok, it *is* possible to add focus units when goto is active. Replaced
assert() with hover cancel. This is all that S2_1 needs. For trunk we
may consider adding new goto_map for additional units in focus (if
they are allowed to ignore already set waypoints, this should not be
hard)


 - ML

diff -Nurd -X.diff_ignore freeciv/client/control.c freeciv/client/control.c
--- freeciv/client/control.c	2007-09-02 05:15:11.000000000 +0300
+++ freeciv/client/control.c	2007-09-09 02:45:11.000000000 +0300
@@ -255,6 +255,8 @@
 **************************************************************************/
 void set_unit_focus(struct unit *punit)
 {
+  bool focus_changed = FALSE;
+
   if (punit && game.player_ptr && punit->owner != game.player_ptr) {
     /* Callers should make sure this never happens. */
     return;
@@ -266,6 +268,7 @@
   if (!(get_num_units_in_focus() == 1
 	&& punit == unit_list_get(get_units_in_focus(), 0))) {
     store_focus();
+    focus_changed = TRUE;
   }
 
   /* Redraw the old focus unit (to fix blinking or remove the selection
@@ -302,6 +305,10 @@
     }
   }
 
+  if (focus_changed) {
+    set_hover_state(NULL, HOVER_NONE, ACTIVITY_LAST, ORDER_LAST);
+  }
+
   update_unit_info_label(pfocus_units);
   update_menus();
 }
@@ -322,6 +329,12 @@
     return;
   }
 
+  if (hover_state != HOVER_NONE) {
+    /* Can't continue with current goto if set of focus units
+     * change. Cancel it. */
+    set_hover_state(NULL, HOVER_NONE, ACTIVITY_LAST, ORDER_LAST);
+  }
+
   unit_list_append(pfocus_units, punit);
   punit->focus_status = FOCUS_AVAIL;
   refresh_unit_mapcanvas(punit, punit->tile, TRUE, FALSE);
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to