<URL: http://bugs.freeciv.org/Ticket/Display.html?id=39609 >
William Allen Simpson wrote: > Does anybody remember? Otherwise, I'm getting rid of it. > Going, going, gone.
Index: client/control.c =================================================================== --- client/control.c (revision 13619) +++ client/control.c (working copy) @@ -58,7 +58,6 @@ static struct unit_list *previous_focus; /* These should be set via set_hover_state() */ -struct unit_list *hover_units; enum cursor_hover_state hover_state = HOVER_NONE; struct tile *hover_tile = NULL; enum cursor_action_state action_state = CURSOR_ACTION_DEFAULT; @@ -97,7 +96,6 @@ caravan_arrival_queue = genlist_new(); diplomat_arrival_queue = genlist_new(); - hover_units = unit_list_new(); pfocus_units = unit_list_new(); previous_focus = unit_list_new(); for (i = 0; i < MAX_NUM_BATTLEGROUPS; i++) { @@ -114,7 +112,6 @@ genlist_free(caravan_arrival_queue); genlist_free(diplomat_arrival_queue); - unit_list_free(hover_units); unit_list_free(pfocus_units); unit_list_free(previous_focus); for (i = 0; i < MAX_NUM_BATTLEGROUPS; i++) { @@ -130,7 +127,10 @@ int i; unit_list_unlink(get_units_in_focus(), punit); - unit_list_unlink(hover_units, punit); + if (get_num_units_in_focus() < 1) { + set_hover_state(NULL, HOVER_NONE, ACTIVITY_LAST, ORDER_LAST); + } + update_unit_info_label(get_units_in_focus()); unit_list_unlink(previous_focus, punit); for (i = 0; i < MAX_NUM_BATTLEGROUPS; i++) { unit_list_unlink(battlegroups[i], punit); @@ -182,12 +182,6 @@ assert((punits && unit_list_size(punits) > 0) || state == HOVER_NONE); assert(state == HOVER_CONNECT || activity == ACTIVITY_LAST); assert(state == HOVER_GOTO || order == ORDER_LAST); - unit_list_unlink_all(hover_units); - if (punits) { - unit_list_iterate(punits, punit) { - unit_list_append(hover_units, punit); - } unit_list_iterate_end; - } hover_state = state; connect_activity = activity; goto_last_order = order; @@ -1824,12 +1818,12 @@ void do_map_click(struct tile *ptile, enum quickselect_type qtype) { struct city *pcity = tile_get_city(ptile); - struct unit_list *punits = hover_units; + struct unit_list *punits = get_units_in_focus(); bool maybe_goto = FALSE; bool possible = FALSE; struct tile *offender = NULL; - if (unit_list_size(punits) > 0 && hover_state != HOVER_NONE) { + if (hover_state != HOVER_NONE) { switch (hover_state) { case HOVER_NONE: die("well; shouldn't get here :)"); @@ -2043,7 +2037,7 @@ } /************************************************************************** - Finish the goto mode and let the units stored in hover_units move + Finish the goto mode and let the units stored in goto_map_list move to a given location. **************************************************************************/ void do_unit_goto(struct tile *ptile) @@ -2113,27 +2107,24 @@ **************************************************************************/ void key_cancel_action(void) { - bool popped = FALSE; - cancel_tile_hiliting(); switch (hover_state) { case HOVER_GOTO: case HOVER_PATROL: case HOVER_CONNECT: - popped = goto_pop_waypoint(); + if (!goto_pop_waypoint()) { + set_hover_state(NULL, HOVER_NONE, ACTIVITY_LAST, ORDER_LAST); + update_unit_info_label(get_units_in_focus()); + + keyboardless_goto_button_down = FALSE; + keyboardless_goto_active = FALSE; + keyboardless_goto_start_tile = NULL; + } + break; default: break; }; - - if (hover_state != HOVER_NONE && !popped) { - set_hover_state(NULL, HOVER_NONE, ACTIVITY_LAST, ORDER_LAST); - update_unit_info_label(hover_units); - - keyboardless_goto_button_down = FALSE; - keyboardless_goto_active = FALSE; - keyboardless_goto_start_tile = NULL; - } } /************************************************************************** Index: client/gui-gtk-2.0/mapctrl.c =================================================================== --- client/gui-gtk-2.0/mapctrl.c (revision 13619) +++ client/gui-gtk-2.0/mapctrl.c (working copy) @@ -411,10 +411,8 @@ handle_mouse_cursor(canvas_pos_to_tile(canvas_x, canvas_y)); /* update_unit_info_label is handled inside handle_mouse_cursor. */ } else { - struct unit_list *active_units = get_units_in_focus(); - action_state = CURSOR_ACTION_DEFAULT; - update_unit_info_label(active_units); + update_unit_info_label(get_units_in_focus()); } return TRUE; } Index: client/text.c =================================================================== --- client/text.c (revision 13619) +++ client/text.c (working copy) @@ -682,7 +682,7 @@ * GUI widgets may be confused and try to resize themselves. */ /* Line 1. Goto or activity text. */ - if (count > 0 && unit_list_size(hover_units) > 0) { + if (count > 0 && hover_state != HOVER_NONE) { int min, max; if (!goto_get_turns(&min, &max)) { Index: client/control.h =================================================================== --- client/control.h (revision 13619) +++ client/control.h (working copy) @@ -46,7 +46,6 @@ void unit_change_battlegroup(struct unit *punit, int battlegroup); void unit_register_battlegroup(struct unit *punit); -extern struct unit_list *hover_units; /* unit hover_state applies to */ extern enum cursor_hover_state hover_state; extern enum cursor_action_state action_state; extern enum unit_activity connect_activity; Index: client/gui-xaw/mapview.c =================================================================== --- client/gui-xaw/mapview.c (revision 13619) +++ client/gui-xaw/mapview.c (working copy) @@ -212,23 +212,6 @@ xaw_set_label(unit_info_label, buffer); if (unit_list_size(punitlist) > 0) { -#if 0 /* Somebody sures this hack is not needed */ - if (unit_list_size(hover_units) > 0) { - bool is_hover = FALSE; - - unit_list_iterate(hover_units, punit2) { - if (hover_unit != punit->id) { - is_hover = TRUE; - break; - } - } unit_list_iterate_end; - - if (!is_hover) { - set_hover_state(NULL, HOVER_NONE, ACTIVITY_LAST, ORDER_LAST); - } - } -#endif - switch (hover_state) { case HOVER_NONE: XUndefineCursor(display, XtWindow(map_canvas)); Index: client/gui-sdl/mapview.c =================================================================== --- client/gui-sdl/mapview.c (revision 13619) +++ client/gui-sdl/mapview.c (working copy) @@ -550,7 +550,7 @@ * GUI widgets may be confused and try to resize themselves. */ /* Line 1. Goto or activity text. */ - if (count > 0 && unit_list_size(hover_units) > 0) { + if (count > 0 && hover_state != HOVER_NONE) { int min, max; if (!goto_get_turns(&min, &max)) { Index: client/mapctrl_common.c =================================================================== --- client/mapctrl_common.c (revision 13619) +++ client/mapctrl_common.c (working copy) @@ -469,7 +469,7 @@ if (keyboardless_goto_active && hover_state == HOVER_GOTO && ptile) { do_unit_goto(ptile); set_hover_state(NULL, HOVER_NONE, ACTIVITY_LAST, ORDER_LAST); - update_unit_info_label(hover_units); + update_unit_info_label(get_units_in_focus()); } keyboardless_goto_active = FALSE; keyboardless_goto_button_down = FALSE;
_______________________________________________ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev