Complete.Org: Mailing Lists: Archives: freeciv-dev: April 2005:
[Freeciv-Dev] (PR#12891) some more orders
Home

[Freeciv-Dev] (PR#12891) some more orders

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#12891) some more orders
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 25 Apr 2005 13:53:53 -0700
Reply-to: bugs@xxxxxxxxxxx

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

This patch adds a few more orders.  They are only supported by the
server; there's not yet any way for the client to initiate them.  Thus
they are untested.  However this will allow future orders support in the
GUI or a warclient-like patch that already has server support built-in.

This is based almost exactly on Iuz's code in PR#7344.

-jason

Index: common/capstr.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/capstr.c,v
retrieving revision 1.235
diff -u -r1.235 capstr.c
--- common/capstr.c     23 Apr 2005 04:26:57 -0000      1.235
+++ common/capstr.c     25 Apr 2005 20:49:02 -0000
@@ -82,7 +82,7 @@
  *     as long as possible.  We want to maintain network compatibility with
  *     the stable branch for as long as possible.
  */
-#define CAPABILITY "+Freeciv.Devel.2005.Apr.23"
+#define CAPABILITY "+Freeciv.Devel.2005.Apr.25"
 
 void init_our_capability(void)
 {
Index: common/unit.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/unit.h,v
retrieving revision 1.140
diff -u -r1.140 unit.h
--- common/unit.h       20 Apr 2005 02:57:06 -0000      1.140
+++ common/unit.h       25 Apr 2005 20:49:02 -0000
@@ -37,7 +37,9 @@
 /* Changing this enum will break network compatability. */
 enum unit_orders {
   ORDER_MOVE, ORDER_ACTIVITY,
-  ORDER_FULL_MP, ORDER_BUILD_CITY, /* and plenty more for later... */
+  ORDER_FULL_MP, ORDER_BUILD_CITY, ORDER_DISBAND, ORDER_BUILD_WONDER,
+  ORDER_TRADEROUTE, ORDER_HOMECITY,
+  /* and plenty more for later... */
   ORDER_LAST
 };
 
Index: server/savegame.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/savegame.c,v
retrieving revision 1.234
diff -u -r1.234 savegame.c
--- server/savegame.c   23 Apr 2005 17:40:29 -0000      1.234
+++ server/savegame.c   25 Apr 2005 20:49:06 -0000
@@ -273,6 +273,18 @@
   case 'a':
   case 'A':
     return ORDER_ACTIVITY;
+  case 'd':
+  case 'D':
+    return ORDER_DISBAND;
+  case 'u':
+  case 'U':
+    return ORDER_BUILD_WONDER;
+  case 't':
+  case 'T':
+    return ORDER_TRADEROUTE;
+  case 'h':
+  case 'H':
+    return ORDER_HOMECITY;
   }
 
   /* This can happen if the savegame is invalid. */
@@ -293,6 +305,14 @@
     return 'a';
   case ORDER_BUILD_CITY:
     return 'b';
+  case ORDER_DISBAND:
+    return 'd';
+  case ORDER_BUILD_WONDER:
+    return 'u';
+  case ORDER_TRADEROUTE:
+    return 't';
+  case ORDER_HOMECITY:
+    return 'h';
   case ORDER_LAST:
     break;
   }
@@ -2694,6 +2714,10 @@
          break;
        case ORDER_FULL_MP:
        case ORDER_BUILD_CITY:
+       case ORDER_DISBAND:
+       case ORDER_BUILD_WONDER:
+       case ORDER_TRADEROUTE:
+       case ORDER_HOMECITY:
        case ORDER_LAST:
          break;
        }
Index: server/unithand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/unithand.c,v
retrieving revision 1.329
diff -u -r1.329 unithand.c
--- server/unithand.c   23 Apr 2005 17:40:29 -0000      1.329
+++ server/unithand.c   25 Apr 2005 20:49:07 -0000
@@ -1637,6 +1637,10 @@
       break;
     case ORDER_FULL_MP:
     case ORDER_BUILD_CITY:
+    case ORDER_DISBAND:
+    case ORDER_BUILD_WONDER:
+    case ORDER_TRADEROUTE:
+    case ORDER_HOMECITY:
       break;
     case ORDER_LAST:
       /* An invalid order.  This is handled in execute_orders. */
Index: server/unittools.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/unittools.c,v
retrieving revision 1.339
diff -u -r1.339 unittools.c
--- server/unittools.c  25 Apr 2005 19:28:22 -0000      1.339
+++ server/unittools.c  25 Apr 2005 20:49:10 -0000
@@ -3254,6 +3254,46 @@
       }
 
       break;
+    case ORDER_DISBAND:
+      freelog(LOG_DEBUG, "  orders: disbanding");
+      handle_unit_disband(pplayer, unitid);
+      return FALSE;
+    case ORDER_HOMECITY:
+      freelog(LOG_DEBUG, "  orders: changing homecity");
+      if (punit->tile->city) {
+       handle_unit_change_homecity(pplayer, unitid, punit->tile->city->id);
+      } else {
+       cancel_orders(punit, "  no homecity");
+       notify_player_ex(pplayer, punit->tile, E_UNIT_ORDERS,
+                        _("Attempt to change homecity for %s failed."),
+                        unit_name(punit->type));
+       return TRUE;
+      }
+      break;
+    case ORDER_TRADEROUTE:
+      freelog(LOG_DEBUG, "  orders: establishing trade route.");
+      handle_unit_establish_trade(pplayer, unitid);
+      if (player_find_unit_by_id(pplayer, unitid)) {
+       cancel_orders(punit, "  no trade route city");
+       notify_player_ex(pplayer, punit->tile, E_UNIT_ORDERS,
+                        _("Attempt to establish trade route for %s failed."),
+                        unit_name(punit->type));
+       return TRUE;
+      } else {
+       return FALSE;
+      }
+    case ORDER_BUILD_WONDER:
+      freelog(LOG_DEBUG, "  orders: building wonder");
+      handle_unit_help_build_wonder(pplayer, unitid);
+      if (player_find_unit_by_id(pplayer, unitid)) {
+       cancel_orders(punit, "  no wonder city");
+       notify_player_ex(pplayer, punit->tile, E_UNIT_ORDERS,
+                        _("Attempt to build wonder for %s failed."),
+                        unit_name(punit->type));
+       return TRUE;
+      } else {
+       return FALSE;
+      }
     case ORDER_LAST:
       cancel_orders(punit, "  client sent invalid order!");
       notify_player_ex(pplayer, punit->tile, E_UNIT_ORDERS,

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#12891) some more orders, Jason Short <=