Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2003:
[Freeciv-Dev] Re: (PR#3363) Fortify does not work
Home

[Freeciv-Dev] Re: (PR#3363) Fortify does not work

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: ChrisK@xxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#3363) Fortify does not work
From: "Arnstein Lindgard via RT" <rt@xxxxxxxxxxxxxx>
Date: Tue, 11 Feb 2003 08:36:13 -0800
Reply-to: rt.freeciv.org@xxxxxxxxxxxxxx

On Sun, 9 Feb 2003 07:58:04 -0800
"ChrisK@xxxxxxxx via RT" <rt@xxxxxxxxxxxxxx> wrote:

> 
> CVS 09 FEB 2003 GTK+ 1.2
> 
> In the city window, the unit popup button "fortify" does not
> fortify sentried units any more; instead, it activates them.
> Active units get still fortified with this button.

Also my bad. To fix this, I rewrote the block of code
"Wakeup Focus" in handle_unit_info() in packhand.c.

Since it's in the same block, there are two other changes:

1) When unloading a ship, client no longer focuses on each
   unit rapidly, just one.

2) There are two Local Options: 'auto_center_on_unit' and
   'wakeup_focus'. Personally I prefere to have the first one
   turned off because I dont like the constant recentering.
   But when a Sentry is awakened, and you have 'wakeup_focus'
   turned on, the map should recenter regardless of
   'auto_center_on_unit' because it's an emergency that
   you need to respond to.

Here's a patch.


Arnstein

diff -ruN -Xdiff_ignore Feb-09/client/packhand.c wakeup_focus/client/packhand.c
--- Feb-09/client/packhand.c    Wed Feb  5 05:58:27 2003
+++ wakeup_focus/client/packhand.c      Tue Feb 11 15:50:40 2003
@@ -887,12 +887,24 @@
         check_focus = TRUE;
 
       repaint_unit = TRUE;
-      if(wakeup_focus && (punit->owner==game.player_idx)
-                      && (punit->activity==ACTIVITY_SENTRY)) {
+
+      /* Wakeup Focus */
+      if(wakeup_focus && (punit->owner == game.player_idx)
+                      && (punit->activity == ACTIVITY_SENTRY)
+                      && (packet->activity == ACTIVITY_IDLE)
+                      && (!get_unit_in_focus()
+            /* only 1 wakeup focus per tile is useful */
+            || !same_pos(packet->x, packet->y,
+                get_unit_in_focus()->x, get_unit_in_focus()->y)))
+      {
         set_unit_focus(punit);
         check_focus = FALSE;    /* and keep it */
-        /* RP: focus on (each) activated unit (e.g. when unloading a ship) */
-      }
+
+        /* autocenter on Wakeup, regardless of the local
+           option "auto_center_on_unit" */
+        if (!tile_visible_and_not_on_border_mapcanvas(punit->x, punit->y))
+              center_tile_mapcanvas(punit->x, punit->y);
+      } /* end of Wakeup Focus */
 
       punit->activity=packet->activity;
       punit->activity_target=packet->activity_target;

[Prev in Thread] Current Thread [Next in Thread]