Author: cazfi
Date: Thu Apr 16 20:14:58 2015
New Revision: 28793

URL: http://svn.gna.org/viewcvs/freeciv?rev=28793&view=rev
Log:
unit_activity_astr() returns extra specific string for ACTIVITY_IRRIGATE and 
ACTIVITY_MINE when
they are used for building an extra.

Reported by Jacob Nevins <jtn>

See bug #23313

Modified:
    branches/S2_6/common/unit.c

Modified: branches/S2_6/common/unit.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/common/unit.c?rev=28793&r1=28792&r2=28793&view=diff
==============================================================================
--- branches/S2_6/common/unit.c (original)
+++ branches/S2_6/common/unit.c Thu Apr 16 20:14:58 2015
@@ -1375,8 +1375,6 @@
   case ACTIVITY_FALLOUT:
   case ACTIVITY_OLD_ROAD:
   case ACTIVITY_OLD_RAILROAD:
-  case ACTIVITY_MINE:
-  case ACTIVITY_IRRIGATE:
   case ACTIVITY_TRANSFORM:
   case ACTIVITY_FORTIFYING:
   case ACTIVITY_FORTIFIED:
@@ -1388,6 +1386,15 @@
   case ACTIVITY_CONVERT:
     astr_add_line(astr, "%s", get_activity_text(punit->activity));
     return;
+  case ACTIVITY_MINE:
+  case ACTIVITY_IRRIGATE:
+    if (punit->activity_target == NULL) {
+      astr_add_line(astr, "%s", get_activity_text(punit->activity));
+    } else {
+      astr_add_line(astr, "Building %s",
+                    extra_name_translation(punit->activity_target));
+    }
+    return;
   case ACTIVITY_PILLAGE:
     if (punit->activity_target != NULL) {
       bv_extras pset;
@@ -1401,22 +1408,12 @@
     }
     return;
   case ACTIVITY_BASE:
-    {
-      struct base_type *pbase;
-
-      pbase = extra_base_get(punit->activity_target);
-      astr_add_line(astr, "%s: %s", get_activity_text(punit->activity),
-                    base_name_translation(pbase));
-    }
+    astr_add_line(astr, "%s: %s", get_activity_text(punit->activity),
+                  extra_name_translation(punit->activity_target));
     return;
   case ACTIVITY_GEN_ROAD:
-    {
-      struct road_type *proad;
-
-      proad = extra_road_get(punit->activity_target);
-      astr_add_line(astr, "%s: %s", get_activity_text(punit->activity),
-                    road_name_translation(proad));
-    }
+    astr_add_line(astr, "%s: %s", get_activity_text(punit->activity),
+                  extra_name_translation(punit->activity_target));
     return;
   case ACTIVITY_UNKNOWN:
   case ACTIVITY_PATROL_UNUSED:


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

Reply via email to