Author: sveinung
Date: Thu Aug 20 15:42:05 2015
New Revision: 29611

URL: http://svn.gna.org/viewcvs/freeciv?rev=29611&view=rev
Log:
Explain if no tgt tile city center blocks action

See patch #6259

Modified:
    trunk/server/unithand.c

Modified: trunk/server/unithand.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/unithand.c?rev=29611&r1=29610&r2=29611&view=diff
==============================================================================
--- trunk/server/unithand.c     (original)
+++ trunk/server/unithand.c     Thu Aug 20 15:42:05 2015
@@ -92,6 +92,8 @@
   ANEK_LOW_MP,
   /* Explanation: can't be done to city centers. */
   ANEK_IS_CITY_CENTER,
+  /* Explanation: can't be done to non city centers. */
+  ANEK_IS_NOT_CITY_CENTER,
   /* Explanation: the action is disabled in this scenario. */
   ANEK_SCENARIO_DISABLED,
   /* Explanation not detected. */
@@ -796,6 +798,13 @@
                                              CITYT_CENTER,
                                              TRUE)) {
     expl->kind = ANEK_IS_CITY_CENTER;
+  } else if (tgt_player
+             && (target_tile && !tile_city(target_tile))
+             && !utype_may_act_tgt_city_tile(unit_type(punit),
+                                             action_id,
+                                             CITYT_CENTER,
+                                             FALSE)) {
+    expl->kind = ANEK_IS_NOT_CITY_CENTER;
   } else if ((game.scenario.prevent_new_cities
               && utype_can_do_action(unit_type(punit), ACTION_FOUND_CITY))
              && (action_id == ACTION_FOUND_CITY
@@ -870,6 +879,10 @@
   case ANEK_IS_CITY_CENTER:
     notify_player(pplayer, unit_tile(punit), E_BAD_COMMAND, ftc_server,
                   _("This unit cannot act against city centers."));
+    break;
+  case ANEK_IS_NOT_CITY_CENTER:
+    notify_player(pplayer, unit_tile(punit), E_BAD_COMMAND, ftc_server,
+                  _("This unit cannot act against non city centers."));
     break;
   case ANEK_SCENARIO_DISABLED:
     notify_player(pplayer, unit_tile(punit), E_BAD_COMMAND, ftc_server,
@@ -1144,6 +1157,13 @@
     notify_player(pplayer, unit_tile(actor),
                   event, ftc_server,
                   _("Your %s can't do %s to city centers."),
+                  unit_name_translation(actor),
+                  gen_action_translated_name(stopped_action));
+    break;
+  case ANEK_IS_NOT_CITY_CENTER:
+    notify_player(pplayer, unit_tile(actor),
+                  event, ftc_server,
+                  _("Your %s can only do %s to city centers."),
                   unit_name_translation(actor),
                   gen_action_translated_name(stopped_action));
     break;


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

Reply via email to