Author: cazfi
Date: Mon Dec 15 03:19:06 2014
New Revision: 27308

URL: http://svn.gna.org/viewcvs/freeciv?rev=27308&view=rev
Log:
Added support for Worker Tasks of activity Transform, as well as to 
transforming variants
of Irrigation and Mining.

See patch #5550

Modified:
    trunk/client/gui-gtk-3.0/citydlg.c
    trunk/client/packhand.c
    trunk/client/tilespec.c
    trunk/fc_version
    trunk/server/citytools.c
    trunk/server/unithand.c

Modified: trunk/client/gui-gtk-3.0/citydlg.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-3.0/citydlg.c?rev=27308&r1=27307&r2=27308&view=diff
==============================================================================
--- trunk/client/gui-gtk-3.0/citydlg.c  (original)
+++ trunk/client/gui-gtk-3.0/citydlg.c  Mon Dec 15 03:19:06 2014
@@ -2632,27 +2632,41 @@
   if (act == ACTIVITY_IDLE) {
     task.tile_id = -1;
     task.activity = ACTIVITY_IDLE;
-    task.tgt = 0;
+    task.tgt = -1;
     task.want = 0;
   } else {
     enum extra_cause cause = activity_to_extra_cause(act);
     struct extra_type *tgt;
 
-    fc_assert(cause != EC_NONE);
-
-    tgt = next_extra_for_tile(ptile, cause, city_owner(pcity), NULL);
-
-    if (tgt != NULL) {
-      task.tile_id = ptile->index;
-      task.activity = act;
+    if (cause != EC_NONE) {
+      tgt = next_extra_for_tile(ptile, cause, city_owner(pcity), NULL);
+    } else {
+      tgt = NULL;
+    }
+
+    if (tgt == NULL) {
+      struct terrain *pterr = tile_terrain(ptile);
+
+      if ((act != ACTIVITY_TRANSFORM
+           || pterr->transform_result == NULL || pterr->transform_result == 
pterr)
+          && (act != ACTIVITY_IRRIGATE
+              || pterr->irrigation_result == NULL || pterr->irrigation_result 
== pterr)
+          && (act != ACTIVITY_MINE
+              || pterr->mining_result == NULL || pterr->mining_result == 
pterr)) {
+        /* No extra to order */
+        output_window_append(ftc_client, _("There's no suitable extra to 
order."));
+
+        return;
+      }
+
+      task.tgt = -1;
+    } else {
       task.tgt = extra_index(tgt);
-      task.want = 1;
-    } else {
-      /* No extra to order */
-      output_window_append(ftc_client, _("There's no suitable extra to 
order."));
-
-      return;
-    }
+    }
+
+    task.tile_id = ptile->index;
+    task.activity = act;
+    task.want = 1;
   }
 
   send_packet_worker_task(&client.conn, &task);
@@ -2693,6 +2707,9 @@
     choice_dialog_add(shl, _("Road"),
                       G_CALLBACK(set_city_workertask),
                       GINT_TO_POINTER(ACTIVITY_GEN_ROAD), NULL);
+    choice_dialog_add(shl, _("Transform"),
+                      G_CALLBACK(set_city_workertask),
+                      GINT_TO_POINTER(ACTIVITY_TRANSFORM), NULL);
 
     choice_dialog_add(shl, GTK_STOCK_CANCEL, 0, 0, NULL);
     choice_dialog_end(shl);

Modified: trunk/client/packhand.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/packhand.c?rev=27308&r1=27307&r2=27308&view=diff
==============================================================================
--- trunk/client/packhand.c     (original)
+++ trunk/client/packhand.c     Mon Dec 15 03:19:06 2014
@@ -1113,7 +1113,11 @@
     pcity->task_req.ptile = NULL;
   }
   pcity->task_req.act = packet->activity;
-  pcity->task_req.tgt = extra_by_number(packet->tgt);
+  if (packet->tgt >= 0) {
+    pcity->task_req.tgt = extra_by_number(packet->tgt);
+  } else {
+    pcity->task_req.tgt = NULL;
+  }
   pcity->task_req.want = packet->want;
 
   refresh_city_dialog(pcity);

Modified: trunk/client/tilespec.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/tilespec.c?rev=27308&r1=27307&r2=27308&view=diff
==============================================================================
--- trunk/client/tilespec.c     (original)
+++ trunk/client/tilespec.c     Mon Dec 15 03:19:06 2014
@@ -5321,6 +5321,9 @@
         case ACTIVITY_GEN_ROAD:
           
ADD_SPRITE_SIMPLE(t->sprites.extras[extra_index(citymode->task_req.tgt)].activity);
           break;
+        case ACTIVITY_TRANSFORM:
+          ADD_SPRITE_SIMPLE(t->sprites.unit.transform);
+          break;
         default:
           break;
         }

Modified: trunk/fc_version
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/fc_version?rev=27308&r1=27307&r2=27308&view=diff
==============================================================================
--- trunk/fc_version    (original)
+++ trunk/fc_version    Mon Dec 15 03:19:06 2014
@@ -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-2.6-2014.Dec.05"
+NETWORK_CAPSTRING_MANDATORY="+Freeciv.Devel-2.6-2014.Dec.15"
 NETWORK_CAPSTRING_OPTIONAL=""
 
 FREECIV_DISTRIBUTOR=""

Modified: trunk/server/citytools.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/citytools.c?rev=27308&r1=27307&r2=27308&view=diff
==============================================================================
--- trunk/server/citytools.c    (original)
+++ trunk/server/citytools.c    Mon Dec 15 03:19:06 2014
@@ -3057,7 +3057,7 @@
   }
   packet.activity = pcity->task_req.act;
   if (pcity->task_req.tgt == NULL) {
-    packet.tgt = 0;
+    packet.tgt = -1;
   } else {
     packet.tgt = extra_number(pcity->task_req.tgt);
   }

Modified: trunk/server/unithand.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/unithand.c?rev=27308&r1=27307&r2=27308&view=diff
==============================================================================
--- trunk/server/unithand.c     (original)
+++ trunk/server/unithand.c     Mon Dec 15 03:19:06 2014
@@ -2783,7 +2783,11 @@
     pcity->task_req.ptile = NULL;
   }
   pcity->task_req.act = packet->activity;
-  pcity->task_req.tgt = extra_by_number(packet->tgt);
+  if (packet->tgt >= 0) {
+    pcity->task_req.tgt = extra_by_number(packet->tgt);
+  } else {
+    pcity->task_req.tgt = NULL;
+  }
   pcity->task_req.want = packet->want;
 
   lsend_packet_worker_task(pplayer->connections, packet);


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

Reply via email to