Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2004:
[Freeciv-Dev] (PR#9630) Bug: disband_all_units() should check F_UNDISBAN
Home

[Freeciv-Dev] (PR#9630) Bug: disband_all_units() should check F_UNDISBAN

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: marko.lindqvist@xxxxxxxxxxx
Subject: [Freeciv-Dev] (PR#9630) Bug: disband_all_units() should check F_UNDISBANDABLE
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 12 Sep 2004 19:54:56 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=9630 >

> [marko.lindqvist@xxxxxxxxxxx - Sat Aug 07 12:28:17 2004]:
> 
> 
>   disband_all_units() should check if given unittype is undisbandable 
> and return immediately if it is (with proper message text of course).

This patch should fix it.  It's hard to test since I can't figure out
how to get disband_all_units to be called!  There is no such option on
the units dialog (f2) and the improvements dialog (f5) doesn't show
units, even when I change the gold upkeep.

>   One may argue that there is more fundamental problem in the way 
> disband_all_units() just counts number of unit disband requests it sends 
> and believes that this count is equal to number of units actually 
> disbanded (ie it believes that disband is always successful). Bug 
> concerning F_UNDISBANDABLE is just one symptom of this.

Yes.  However this isn't really fixable.

jason

Index: client/repodlgs_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/repodlgs_common.c,v
retrieving revision 1.13
diff -u -r1.13 repodlgs_common.c
--- client/repodlgs_common.c    4 Sep 2004 19:28:19 -0000       1.13
+++ client/repodlgs_common.c    13 Sep 2004 02:54:56 -0000
@@ -350,10 +350,17 @@
   int count = 0;
 
   if (!can_client_issue_orders()) {
+    /* TRANS: Obscure observer error. */
     my_snprintf(message, message_sz, _("You cannot disband units."));
     return;
   }
 
+  if (unit_type_flag(type, F_UNDISBANDABLE)) {
+    my_snprintf(message, message_sz, _("%s cannot be disbanded."),
+               unit_name(type));
+    return;
+  }
+
   city_list_iterate(game.player_ptr->cities, pcity) {
     /* Only supported units are disbanded.  Units with no homecity have no
      * cost and are not disbanded. */

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#9630) Bug: disband_all_units() should check F_UNDISBANDABLE, Jason Short <=