Author: sveinung
Date: Wed Aug 12 12:28:51 2015
New Revision: 29468

URL: http://svn.gna.org/viewcvs/freeciv?rev=29468&view=rev
Log:
orders system: replace ORDER_TRADE_ROUTE with ORDER_PERFORM_ACTION

See patch #6216

Modified:
    trunk/common/unit.h
    trunk/fc_version
    trunk/server/savecompat.c
    trunk/server/savegame.c
    trunk/server/savegame2.c
    trunk/server/savegame3.c
    trunk/server/unithand.c
    trunk/server/unittools.c

Modified: trunk/common/unit.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/unit.h?rev=29468&r1=29467&r2=29468&view=diff
==============================================================================
--- trunk/common/unit.h (original)
+++ trunk/common/unit.h Wed Aug 12 12:28:51 2015
@@ -38,7 +38,7 @@
   ORDER_BUILD_CITY = 3,
   ORDER_DISBAND = 4,
   ORDER_OLD_BUILD_WONDER = 5,
-  ORDER_TRADE_ROUTE = 6,
+  ORDER_OLD_TRADE_ROUTE = 6,
   ORDER_HOMECITY = 7,
   ORDER_ACTION_MOVE = 8,
   ORDER_PERFORM_ACTION = 9,

Modified: trunk/fc_version
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/fc_version?rev=29468&r1=29467&r2=29468&view=diff
==============================================================================
--- trunk/fc_version    (original)
+++ trunk/fc_version    Wed Aug 12 12:28:51 2015
@@ -54,7 +54,7 @@
 #   - Avoid adding a new mandatory capability to the development branch for
 #     as long as possible.  We want to maintain network compatibility with
 #     the stable branch for as long as possible.
-NETWORK_CAPSTRING_MANDATORY="+Freeciv.Devel-3.0-2015.Aug.11b"
+NETWORK_CAPSTRING_MANDATORY="+Freeciv.Devel-3.0-2015.Aug.12"
 NETWORK_CAPSTRING_OPTIONAL=""
 
 FREECIV_DISTRIBUTOR=""

Modified: trunk/server/savecompat.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/savecompat.c?rev=29468&r1=29467&r2=29468&view=diff
==============================================================================
--- trunk/server/savecompat.c   (original)
+++ trunk/server/savecompat.c   Wed Aug 12 12:28:51 2015
@@ -1067,7 +1067,7 @@
   case ORDER_OLD_BUILD_WONDER:
     /* Maps one to one with each other. */
     return ACTION_HELP_WONDER;
-  case ORDER_TRADE_ROUTE:
+  case ORDER_OLD_TRADE_ROUTE:
     /* Maps one to one with each other. */
     return ACTION_TRADE_ROUTE;
   case ORDER_MOVE:

Modified: trunk/server/savegame.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/savegame.c?rev=29468&r1=29467&r2=29468&view=diff
==============================================================================
--- trunk/server/savegame.c     (original)
+++ trunk/server/savegame.c     Wed Aug 12 12:28:51 2015
@@ -301,7 +301,7 @@
     return ORDER_OLD_BUILD_WONDER;
   case 't':
   case 'T':
-    return ORDER_TRADE_ROUTE;
+    return ORDER_OLD_TRADE_ROUTE;
   case 'h':
   case 'H':
     return ORDER_HOMECITY;

Modified: trunk/server/savegame2.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/savegame2.c?rev=29468&r1=29467&r2=29468&view=diff
==============================================================================
--- trunk/server/savegame2.c    (original)
+++ trunk/server/savegame2.c    Wed Aug 12 12:28:51 2015
@@ -582,7 +582,7 @@
     return ORDER_OLD_BUILD_WONDER;
   case 't':
   case 'T':
-    return ORDER_TRADE_ROUTE;
+    return ORDER_OLD_TRADE_ROUTE;
   case 'h':
   case 'H':
     return ORDER_HOMECITY;

Modified: trunk/server/savegame3.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/savegame3.c?rev=29468&r1=29467&r2=29468&view=diff
==============================================================================
--- trunk/server/savegame3.c    (original)
+++ trunk/server/savegame3.c    Wed Aug 12 12:28:51 2015
@@ -724,7 +724,15 @@
 #endif /* FREECIV_DEV_SAVE_COMPAT */
   case 't':
   case 'T':
-    return ORDER_TRADE_ROUTE;
+#ifdef FREECIV_DEV_SAVE_COMPAT
+    /* Will be upgraded with sg_order_to_action(). */
+    return ORDER_OLD_TRADE_ROUTE;
+#else /* FREECIV_DEV_SAVE_COMPAT */
+    /* This order isn't supposed to show up in version 3 save games. */
+    log_error("Corrupt save game: trade route ordered the old way.");
+
+    return ORDER_LAST;
+#endif /* FREECIV_DEV_SAVE_COMPAT */
   case 'h':
   case 'H':
     return ORDER_HOMECITY;
@@ -756,8 +764,6 @@
     return 'b';
   case ORDER_DISBAND:
     return 'd';
-  case ORDER_TRADE_ROUTE:
-    return 't';
   case ORDER_HOMECITY:
     return 'h';
   case ORDER_ACTION_MOVE:
@@ -765,6 +771,7 @@
   case ORDER_PERFORM_ACTION:
     return 'p';
   case ORDER_OLD_BUILD_WONDER:
+  case ORDER_OLD_TRADE_ROUTE:
   case ORDER_LAST:
     break;
   }
@@ -5369,10 +5376,10 @@
         case ORDER_FULL_MP:
         case ORDER_BUILD_CITY:
         case ORDER_DISBAND:
-        case ORDER_TRADE_ROUTE:
         case ORDER_HOMECITY:
         case ORDER_ACTION_MOVE:
         case ORDER_OLD_BUILD_WONDER:
+        case ORDER_OLD_TRADE_ROUTE:
         case ORDER_LAST:
           break;
         }

Modified: trunk/server/unithand.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/unithand.c?rev=29468&r1=29467&r2=29468&view=diff
==============================================================================
--- trunk/server/unithand.c     (original)
+++ trunk/server/unithand.c     Wed Aug 12 12:28:51 2015
@@ -3687,10 +3687,10 @@
     case ORDER_FULL_MP:
     case ORDER_BUILD_CITY:
     case ORDER_DISBAND:
-    case ORDER_TRADE_ROUTE:
     case ORDER_HOMECITY:
       break;
     case ORDER_OLD_BUILD_WONDER:
+    case ORDER_OLD_TRADE_ROUTE:
       /* This order has been replaced with ORDER_PERFORM_ACTION and the
        * action it performs. */
       log_error("handle_unit_orders(): outdated client. "

Modified: trunk/server/unittools.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/unittools.c?rev=29468&r1=29467&r2=29468&view=diff
==============================================================================
--- trunk/server/unittools.c    (original)
+++ trunk/server/unittools.c    Wed Aug 12 12:28:51 2015
@@ -3735,8 +3735,6 @@
     } else {
       return ACTION_FOUND_CITY;
     }
-  case ORDER_TRADE_ROUTE:
-    return ACTION_TRADE_ROUTE;
   case ORDER_MOVE:
   case ORDER_ACTION_MOVE:
   case ORDER_FULL_MP:
@@ -3745,6 +3743,7 @@
   case ORDER_HOMECITY:
   case ORDER_PERFORM_ACTION:
   case ORDER_OLD_BUILD_WONDER:
+  case ORDER_OLD_TRADE_ROUTE:
   case ORDER_LAST:
     /* Not action enabler controlled. */
     break;
@@ -3854,7 +3853,7 @@
       break;
     case ORDER_BUILD_CITY:
     case ORDER_OLD_BUILD_WONDER:
-    case ORDER_TRADE_ROUTE:
+    case ORDER_OLD_TRADE_ROUTE:
       if (should_wait_for_mp(punit, order_to_action(punit, order.order))) {
         log_debug("  stopping. Not enough move points this turn");
         return TRUE;
@@ -4074,33 +4073,6 @@
         return TRUE;
       }
       break;
-    case ORDER_TRADE_ROUTE:
-      log_debug("  orders: establishing trade route.");
-      dst_tile = unit_tile(punit);
-
-      fc_assert_ret_val_msg(dst_tile, FALSE, "No tile for ordered unit");
-
-      if (tile_city(dst_tile) == NULL) {
-        cancel_orders(punit, "  trade route order with no city");
-        notify_player(pplayer, unit_tile(punit), E_UNIT_ORDERS, ftc_server,
-                      _("Orders for %s aborted since they "
-                        "give a location without a city."),
-                      unit_link(punit));
-        return TRUE;
-      }
-
-      handle_unit_do_action(pplayer,
-                            unitid, tile_city(dst_tile)->id,
-                            0, "", ACTION_TRADE_ROUTE);
-      if (player_unit_by_number(pplayer, unitid)) {
-        cancel_orders(punit, "  no trade route city");
-        notify_player(pplayer, unit_tile(punit), E_UNIT_ORDERS, ftc_server,
-                      _("Attempt to establish trade route for %s failed."),
-                      unit_link(punit));
-        return TRUE;
-      } else {
-       return FALSE;
-      }
     case ORDER_PERFORM_ACTION:
       log_debug("  orders: doing action %d", order.action);
 
@@ -4229,6 +4201,7 @@
 
       break;
     case ORDER_OLD_BUILD_WONDER:
+    case ORDER_OLD_TRADE_ROUTE:
     case ORDER_LAST:
       cancel_orders(punit, "  client sent invalid order!");
       notify_player(pplayer, unit_tile(punit), E_UNIT_ORDERS, ftc_server,


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to