Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2004:
[Freeciv-Dev] (PR#9823) change "return" to "return-and-recover"
Home

[Freeciv-Dev] (PR#9823) change "return" to "return-and-recover"

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#9823) change "return" to "return-and-recover"
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 26 Aug 2004 13:37:10 -0700
Reply-to: rt@xxxxxxxxxxx

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

The return-to-nearest-city functionality in the client (shift-G) was 
originally designed by Arnstein as return-and-recover.  This patch 
changes it to do that.

(As seen in PR#9662.)

jason

? new
? orig
? common/packets_gen.o.FYtf4u
Index: client/control.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/control.c,v
retrieving revision 1.139
diff -u -r1.139 control.c
--- client/control.c    2 Aug 2004 16:59:14 -0000       1.139
+++ client/control.c    10 Aug 2004 17:43:49 -0000
@@ -692,7 +692,7 @@
   }
 
   if ((path = path_to_nearest_allied_city(punit))) {
-    send_goto_path(punit, path);
+    send_goto_path(punit, path, ACTIVITY_SENTRY);
     pf_destroy_path(path);
   }
 }
Index: client/goto.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/goto.c,v
retrieving revision 1.70
diff -u -r1.70 goto.c
--- client/goto.c       21 Jun 2004 15:14:43 -0000      1.70
+++ client/goto.c       10 Aug 2004 17:43:49 -0000
@@ -515,7 +515,8 @@
   Send a path as a goto or patrol route to the server.
 **************************************************************************/
 static void send_path_orders(struct unit *punit, struct pf_path *path,
-                            bool repeat, bool vigilant)
+                            bool repeat, bool vigilant,
+                            enum unit_activity final_activity)
 {
   struct packet_unit_orders p;
   int i, old_x, old_y;
@@ -555,6 +556,13 @@
     old_y = new_y;
   }
 
+  if (final_activity != ACTIVITY_LAST) {
+    p.orders[i] = ORDER_ACTIVITY;
+    p.dir[i] = -1;
+    p.activity[i] = final_activity;
+    p.length++;
+  }
+
   p.dest_x = old_x;
   p.dest_y = old_y;
 
@@ -564,9 +572,10 @@
 /**************************************************************************
   Send an arbitrary goto path for the unit to the server.
 **************************************************************************/
-void send_goto_path(struct unit *punit, struct pf_path *path)
+void send_goto_path(struct unit *punit, struct pf_path *path,
+                   enum unit_activity final_activity)
 {
-  send_path_orders(punit, path, FALSE, FALSE);
+  send_path_orders(punit, path, FALSE, FALSE, final_activity);
 }
 
 /**************************************************************************
@@ -602,7 +611,7 @@
   pf_destroy_map(map);
   pf_destroy_path(return_path);
 
-  send_path_orders(punit, path, TRUE, TRUE);
+  send_path_orders(punit, path, TRUE, TRUE, ACTIVITY_LAST);
 
   pf_destroy_path(path);
 }
@@ -624,7 +633,7 @@
     path = pft_concat(path, goto_map.parts[i].path);
   }
 
-  send_goto_path(punit, path);
+  send_goto_path(punit, path, ACTIVITY_LAST);
   pf_destroy_path(path);
 }
 
Index: client/goto.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/goto.h,v
retrieving revision 1.13
diff -u -r1.13 goto.h
--- client/goto.h       21 Jun 2004 15:14:43 -0000      1.13
+++ client/goto.h       10 Aug 2004 17:43:49 -0000
@@ -33,7 +33,8 @@
 bool is_endpoint(int x, int y);
 
 void request_orders_cleared(struct unit *punit);
-void send_goto_path(struct unit *punit, struct pf_path *path);
+void send_goto_path(struct unit *punit, struct pf_path *path,
+                   enum unit_activity final_activity);
 void send_patrol_route(struct unit *punit);
 void send_goto_route(struct unit *punit);
 

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