Complete.Org: Mailing Lists: Archives: freeciv-dev: May 2005:
[Freeciv-Dev] (PR#12935) Odd recenter when unloading all from transporte
Home

[Freeciv-Dev] (PR#12935) Odd recenter when unloading all from transporte

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: chrisk@xxxxxxxxx, john@xxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] (PR#12935) Odd recenter when unloading all from transporter
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 4 May 2005 00:07:18 -0700
Reply-to: bugs@xxxxxxxxxxx

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

> [john@xxxxxxxxxxxxxxxx - Mon May 02 21:42:35 2005]:
> 
> Here's a patch that seems to work. At least, it doesn't jump the focus
> to the
> next unit, and then back.

You've found the source of the bug, but I don't think your fix is quite
right.  You don't want to set_unit_focus(NULL) because that clears the
focus unit entirely, along with any unit commands.  If the following
set_unit_focus doesn't happen to focus the unloaded unit, then the
client will be trapped in an unfocused state (which seems to be a rather
serious problem since then there's no advance-to-next-unit command
then).  Admittedly this should never happen if the caller does their
homework right (as the gtk2 client does by desensetizing the menu for
empty transporters).

Anyway, this seems easy to fix.

-jason

Index: client/control.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/control.c,v
retrieving revision 1.171
diff -u -r1.171 control.c
--- client/control.c    29 Apr 2005 18:39:25 -0000      1.171
+++ client/control.c    4 May 2005 07:04:41 -0000
@@ -770,8 +770,6 @@
     return;
   }
 
-  request_unit_wait(punit);    /* RP: unfocus the ship */
-
   unit_list_iterate(ptile->units, pcargo) {
     if (pcargo->transported_by == punit->id) {
       request_unit_unload(pcargo);
@@ -785,8 +783,11 @@
   } unit_list_iterate_end;
 
   if (plast) {
-    /* If the above unloading failed this focus will still happen.  That's
-     * probably a feature. */
+    /* Unfocus the ship, and advance the focus to the last unloaded unit.
+     * If there is no unit unloaded (which shouldn't happen, but could if
+     * the caller doesn't check if the transporter is loaded), the we
+     * don't do anything. */
+    punit->focus_status = FOCUS_WAIT;
     set_unit_focus(plast);
   }
 }

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