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

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

> The client crashes every time a enemy unit moves.

 Most enemy moves are not causing focus changes...
 Still, how usable goto is if hover is often automatically canceled
when you try to setup it? I don't see better solution available soon,
so this just replaces crash with hover cancel.


 - 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 01:36:49.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,13 @@
     return;
   }
 
+  /* Can't change list of focused units when there is already
+   * set of goto lines calculated. */
+  assert(hover_state == HOVER_NONE);
+  if (hover_state != HOVER_NONE) {
+    return;
+  }
+
   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