Author: sveinung
Date: Fri Aug  7 17:33:06 2015
New Revision: 29382

URL: http://svn.gna.org/viewcvs/freeciv?rev=29382&view=rev
Log:
orders system: support the Found City action

See patch #6177

Modified:
    trunk/server/unithand.c
    trunk/server/unittools.c

Modified: trunk/server/unithand.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/unithand.c?rev=29382&r1=29381&r2=29382&view=diff
==============================================================================
--- trunk/server/unithand.c     (original)
+++ trunk/server/unithand.c     Fri Aug  7 17:33:06 2015
@@ -3588,6 +3588,17 @@
       break;
     case ORDER_PERFORM_ACTION:
       switch ((enum gen_action) packet->action[i]) {
+      case ACTION_FOUND_CITY:
+        if (is_valid_dir(packet->dir[i])) {
+          /* Actor must be on the target tile. */
+          log_error("handle_unit_orders() can't do %s to a neighbor tile. "
+                    "Sent in order number %d from %s to unit number %d.",
+                    action_get_rule_name(packet->action[i]), i,
+                    player_name(pplayer), packet->unit_id);
+
+          return;
+        }
+        break;
       case ACTION_NUKE:
       case ACTION_CAPTURE_UNITS:
       case ACTION_BOMBARD:

Modified: trunk/server/unittools.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/unittools.c?rev=29382&r1=29381&r2=29382&view=diff
==============================================================================
--- trunk/server/unittools.c    (original)
+++ trunk/server/unittools.c    Fri Aug  7 17:33:06 2015
@@ -3792,6 +3792,7 @@
   struct tile *dst_tile;
   action_probability prob;
   bool performed;
+  const char *name;
   bool res, last_order;
   int unitid = punit->id;
   struct player *pplayer = unit_owner(punit);
@@ -4181,10 +4182,19 @@
         return TRUE;
       }
 
+      if (order.action == ACTION_FOUND_CITY) {
+        /* This action needs a name. */
+        name = city_name_suggestion(pplayer, unit_tile(punit));
+      } else {
+        /* This action doesn't need a name. */
+        name = "";
+      }
+
       performed = unit_perform_action(pplayer,
                                       unitid,
                                       dst_tile->index,
-                                      0, "", order.action);
+                                      0, name,
+                                      order.action);
 
       if (!player_unit_by_number(pplayer, unitid)) {
         /* The unit "died" while performing the action. */


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

Reply via email to