Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2004:
[Freeciv-Dev] Re: (PR#9662) activities as orders
Home

[Freeciv-Dev] Re: (PR#9662) activities as orders

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] Re: (PR#9662) activities as orders
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 10 Aug 2004 10:46:58 -0700
Reply-to: rt@xxxxxxxxxxx

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

Jason Short wrote:
> <URL: http://rt.freeciv.org/Ticket/Display.html?id=9662 >
> 
> This patch allows orders to include some activities.
> 
> This is basically the server part of the connect-as-orders patch 
> (PR#7282), with connect left unchanged and some other simple activities 
> added in.  It's pretty straightforward but not that easy to test without 
> adding lots of code elsewhere.
> 
> It's also much like the activities part of Arnstein's extended-orders 
> patch (PR#6941?).
> 
> The only thing I'm not sure of is backwards-compatability of savegames.

There is a problem with backwards-compatability of savegames.  I guess 
this problem is in the connect-orders patch too...

This patch lets you test the functionality a little bit.  It changes the 
"return to nearest city" command (shift-G) to sentry the unit at the end 
of the return.

I think the order of the orders execution could be changed a bit.  Some 
activities we can do immediately after moving.  There's no reason to 
wait until we have full MP to sentry the unit.  And for settlers on 
connect we certainly don't want to wait an extra turn before building a 
road, since that makes the road take longer.  So the loop should go 
through one time more, and break out only if the order requires some MP. 
  But this should probably be a separate patch.

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]