Author: sveinung
Date: Sat Aug 22 22:36:57 2015
New Revision: 29648

URL: http://svn.gna.org/viewcvs/freeciv?rev=29648&view=rev
Log:
Explain if claimed tgt tile blocks action

See patch #6267

Modified:
    trunk/server/unithand.c

Modified: trunk/server/unithand.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/unithand.c?rev=29648&r1=29647&r2=29648&view=diff
==============================================================================
--- trunk/server/unithand.c     (original)
+++ trunk/server/unithand.c     Sat Aug 22 22:36:57 2015
@@ -94,6 +94,8 @@
   ANEK_IS_CITY_CENTER,
   /* Explanation: can't be done to non city centers. */
   ANEK_IS_NOT_CITY_CENTER,
+  /* Explanation: can't be done to claimed target tiles. */
+  ANEK_TGT_IS_CLAIMED,
   /* Explanation: the action is disabled in this scenario. */
   ANEK_SCENARIO_DISABLED,
   /* Explanation not detected. */
@@ -805,6 +807,12 @@
                                              CITYT_CENTER,
                                              FALSE)) {
     expl->kind = ANEK_IS_NOT_CITY_CENTER;
+  } else if ((target_tile && tile_owner(target_tile) != NULL)
+             && !utype_may_act_tgt_city_tile(unit_type(punit),
+                                             action_id,
+                                             CITYT_CLAIMED,
+                                             TRUE)) {
+    expl->kind = ANEK_TGT_IS_CLAIMED;
   } else if ((game.scenario.prevent_new_cities
               && utype_can_do_action(unit_type(punit), ACTION_FOUND_CITY))
              && (action_id == ACTION_FOUND_CITY
@@ -883,6 +891,10 @@
   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_TGT_IS_CLAIMED:
+    notify_player(pplayer, unit_tile(punit), E_BAD_COMMAND, ftc_server,
+                  _("This unit cannot act against claimed tiles."));
     break;
   case ANEK_SCENARIO_DISABLED:
     notify_player(pplayer, unit_tile(punit), E_BAD_COMMAND, ftc_server,
@@ -1164,6 +1176,13 @@
     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;
+  case ANEK_TGT_IS_CLAIMED:
+    notify_player(pplayer, unit_tile(actor),
+                  event, ftc_server,
+                  _("Your %s can't do %s to claimed tiles."),
                   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