[Freeciv-Dev] (PR#10871) cannot activate unit
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://rt.freeciv.org/Ticket/Display.html?id=10871 >
> [chrisk - Wed Nov 10 11:12:19 2004]:
>
> On Sun, Nov 07, 2004 at 02:24:38PM -0800, Vasco Alexandre da Silva
> Costa wrote:
> > I digged a bit into it. It seems it only tries to search for
> > sentried or idle units. Perhaps this should be changed?
>
> Hhm. Fortify has no effects inside cities. I usually do this with my
> units.
>
> The button could show fortified units inside cities. It shouldn't wake
> up any fortified units outside of cities, though.
This patch always centers on the closest unit with moves left.
But it only focuses and wakes up units that are idle or sentried.
Index: client/gui-gtk-2.0/repodlgs.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/repodlgs.c,v
retrieving revision 1.66
diff -u -u -r1.66 repodlgs.c
--- client/gui-gtk-2.0/repodlgs.c 12 Nov 2004 19:46:31 -0000 1.66
+++ client/gui-gtk-2.0/repodlgs.c 12 Nov 2004 23:46:32 -0000
@@ -1080,9 +1080,10 @@
best_candidate = NULL;
unit_list_iterate(game.player_ptr->units, punit) {
if (punit->type == type) {
- if (punit->focus_status==FOCUS_AVAIL && (punit->activity==ACTIVITY_IDLE
- || punit->activity==ACTIVITY_SENTRY)
- && punit->moves_left > 0 && !punit->ai.control) {
+ if (punit->focus_status==FOCUS_AVAIL
+ && punit->moves_left > 0
+ && !punit->done_moving
+ && !punit->ai.control) {
int d;
d=sq_map_distance(punit->tile, ptile);
if(d<best_dist) {
@@ -1128,8 +1129,13 @@
ptile = get_center_tile_mapcanvas();
if ((punit = find_nearest_unit(ut1, ptile))) {
- if (can_unit_do_activity(punit, ACTIVITY_IDLE)) {
- set_unit_focus_and_select(punit);
+ center_tile_mapcanvas(punit->tile);
+
+ if (punit->activity == ACTIVITY_IDLE
+ || punit->activity == ACTIVITY_SENTRY) {
+ if (can_unit_do_activity(punit, ACTIVITY_IDLE)) {
+ set_unit_focus_and_select(punit);
+ }
}
}
} else {
|
|