Complete.Org: Mailing Lists: Archives: freeciv-dev: July 2005:
[Freeciv-Dev] (PR#13499) clean up autosettlers in the client
Home

[Freeciv-Dev] (PR#13499) clean up autosettlers in the client

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: jdorje@xxxxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] (PR#13499) clean up autosettlers in the client
From: "Egor Vyscrebentsov" <evyscr@xxxxxxxxx>
Date: Wed, 27 Jul 2005 01:58:15 -0700
Reply-to: bugs@xxxxxxxxxxx

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

> [jdorje - Wed Jul 20 19:24:56 2005]:
> 
> - It's no longer possible for the client to request military units to
> autoattack (as I said this autoattack has been disabled so this just
> gets the unit stuck in an unusable state).

Attached is a patch that fix gui-xaw part of removing auto-attack.

Thanks, evyscr.

PS gui-mui has key_unit_auto_attack() calls too.
Index: client/gui-xaw/actions.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/actions.c,v
retrieving revision 1.28
diff -u -r1.28 actions.c
--- client/gui-xaw/actions.c    29 May 2005 10:40:44 -0000      1.28
+++ client/gui-xaw/actions.c    27 Jul 2005 08:36:38 -0000
@@ -353,43 +353,43 @@
 }
 
 /****************************************************************************
-  Invoked when the key binding for orders->auto_attack is pressed.
+  Invoked when the key binding for orders->auto_explore is pressed.
 ****************************************************************************/
-static void xaw_key_unit_auto_attack(Widget w, XEvent *event,
-                                    String *argv, Cardinal *argc)
+static void xaw_key_unit_auto_explore(Widget w, XEvent *event, String *argv,
+                                     Cardinal *argc)
 {
-  if (can_client_issue_orders()
-      && is_menu_item_active(MENU_ORDER, MENU_ORDER_AUTO_ATTACK)) {
-    key_unit_auto_attack();
-  }
+  if(is_menu_item_active(MENU_ORDER, MENU_ORDER_AUTO_EXPLORE))
+    key_unit_auto_explore();
 }
 
-static void xaw_key_unit_auto_attack_or_settle(Widget w, XEvent *event, String 
*argv, Cardinal *argc)
+/****************************************************************************
+  Invoked when the key binding for orders->auto_settle is pressed.
+****************************************************************************/
+static void xaw_key_unit_auto_settle(Widget w, XEvent *event, String *argv,
+                                    Cardinal *argc)
+{
+  if(is_menu_item_active(MENU_ORDER, MENU_ORDER_AUTO_SETTLER))
+    key_unit_auto_settle();
+}
+
+/****************************************************************************
+  Invoked when the key binding for auto-settle or auto-attack is pressed.
+  Since there is no more auto-attack this function is just like another
+  way of calling key_unit_auto_settle.
+****************************************************************************/
+static void xaw_key_unit_auto_attack_or_settle(Widget w, XEvent *event,
+                                              String *argv, Cardinal *argc)
 {
   struct unit *punit = get_unit_in_focus();
-  if(punit) {
+  if (punit) {
+    /* Since there is no more auto-attack, do nothing if unit nas no settler 
flag */
     if (unit_flag(punit, F_SETTLERS)) {
-      if(is_menu_item_active(MENU_ORDER, MENU_ORDER_AUTO_SETTLER))
+      if (is_menu_item_active(MENU_ORDER, MENU_ORDER_AUTO_SETTLER))
        key_unit_auto_settle();
-    } else {
-      if(is_menu_item_active(MENU_ORDER, MENU_ORDER_AUTO_ATTACK))
-       key_unit_auto_attack();
     }
   }
 }
 
-static void xaw_key_unit_auto_explore(Widget w, XEvent *event, String *argv, 
Cardinal *argc)
-{
-  if(is_menu_item_active(MENU_ORDER, MENU_ORDER_AUTO_EXPLORE))
-    key_unit_auto_explore();
-}
-
-static void xaw_key_unit_auto_settle(Widget w, XEvent *event, String *argv, 
Cardinal *argc)
-{
-  if(is_menu_item_active(MENU_ORDER, MENU_ORDER_AUTO_SETTLER))
-    key_unit_auto_settle();
-}
-
 static void xaw_key_unit_build_city(Widget w, XEvent *event, String *argv, 
Cardinal *argc)
 {
   if(is_menu_item_active(MENU_ORDER, MENU_ORDER_BUILD_CITY))
@@ -778,7 +778,6 @@
   { "key-open-wonders", xaw_key_open_wonders },
   { "key-open-worklists", xaw_key_open_worklists },
   { "key-unit-airbase", xaw_key_unit_airbase },
-  { "key-unit-auto-attack", xaw_key_unit_auto_attack },
   { "key-unit-auto-attack-or-settle", xaw_key_unit_auto_attack_or_settle },
   { "key-unit-auto-explore", xaw_key_unit_auto_explore },
   { "key-unit-auto-settle", xaw_key_unit_auto_settle },
Index: client/gui-xaw/menu.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/menu.c,v
retrieving revision 1.82
diff -u -r1.82 menu.c
--- client/gui-xaw/menu.c       9 Jul 2005 17:46:08 -0000       1.82
+++ client/gui-xaw/menu.c       27 Jul 2005 08:36:38 -0000
@@ -715,9 +715,6 @@
   case MENU_ORDER_AUTO_SETTLER:
     key_unit_auto_settle();
     break;
-  case MENU_ORDER_AUTO_ATTACK:
-    key_unit_auto_attack();
-    break;
   case MENU_ORDER_AUTO_EXPLORE:
     key_unit_auto_explore();
     break;

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