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

As I was testing several related bugs (PR#29982, PR#39339, PR#39430):
   "goto_get_turns: Assertion unit_is_in_focus(punit) failed"

I found that hitting escape caused the list of focused units to disappear.
Clicking anywhere on the map restores the list.

The simple explanation, in client/control.c key_cancel_action(),
     set_hover_state(NULL, HOVER_NONE, ACTIVITY_LAST, ORDER_LAST);
     update_unit_info_label(hover_units);

set_hover_state() has just set hover_units to NULL.  This should actually be
get_units_in_focus(), as they are still in focus.

===

Further checking shows that this is one of only two places that hover_units
is actually used.

In fact, every other call to update_unit_info_label() is passing
get_units_in_focus() or the equivalent pfocus_units.  This is the only
exception -- and it's wrong!

(Ignoring the problem that gui-mui still only handles a single unit.)

Obviously, the assert() requires all goto units are in pfocus_units.

There's no explanation for why hover_units exist.  It is always either NULL
or identical to pfocus_units.  There's no code that changes hover_units to
ever make it any different from pfocus_units.

Does anybody remember?  Otherwise, I'm getting rid of it.



_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to