Author: sveinung
Date: Wed Aug 19 14:24:14 2015
New Revision: 29582

URL: http://svn.gna.org/viewcvs/freeciv?rev=29582&view=rev
Log:
Explain when a scenario setting forbids an action

See patch #6250

Modified:
    trunk/server/unithand.c

Modified: trunk/server/unithand.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/unithand.c?rev=29582&r1=29581&r2=29582&view=diff
==============================================================================
--- trunk/server/unithand.c     (original)
+++ trunk/server/unithand.c     Wed Aug 19 14:24:14 2015
@@ -90,6 +90,8 @@
   ANEK_FOREIGN,
   /* Explanation: not enough MP left. */
   ANEK_LOW_MP,
+  /* Explanation: the action is disabled in this scenario. */
+  ANEK_SCENARIO_DISABLED,
   /* Explanation not detected. */
   ANEK_UNKNOWN,
 };
@@ -796,6 +798,13 @@
                                                  DRO_FOREIGN,
                                                  FALSE)) {
     expl->kind = ANEK_DOMESTIC;
+  } else if ((game.scenario.prevent_new_cities
+              && utype_can_do_action(unit_type(punit), ACTION_FOUND_CITY))
+             && (action_id == ACTION_FOUND_CITY
+                 || action_id == ACTION_ANY)) {
+    /* Please add a check for any new action forbidding scenario setting
+     * above this comment. */
+    expl->kind = ANEK_SCENARIO_DISABLED;
   } else {
     expl->kind = ANEK_UNKNOWN;
   }
@@ -859,6 +868,10 @@
   case ANEK_LOW_MP:
     notify_player(pplayer, unit_tile(punit), E_BAD_COMMAND, ftc_server,
                   _("This unit has too few moves left to act."));
+    break;
+  case ANEK_SCENARIO_DISABLED:
+    notify_player(pplayer, unit_tile(punit), E_BAD_COMMAND, ftc_server,
+                  _("Can't perform any action this scenario permits."));
     break;
   case ANEK_UNKNOWN:
     notify_player(pplayer, unit_tile(punit), E_BAD_COMMAND, ftc_server,
@@ -1123,6 +1136,13 @@
                   event, ftc_server,
                   _("Your %s has too few moves left to %s."),
                   unit_name_translation(actor),
+                  gen_action_translated_name(stopped_action));
+    break;
+  case ANEK_SCENARIO_DISABLED:
+    notify_player(pplayer, unit_tile(actor),
+                  event, ftc_server,
+                  /* TRANS: Can't do Build City in this scenario. */
+                  _("Can't do %s in this scenario."),
                   gen_action_translated_name(stopped_action));
     break;
   case ANEK_UNKNOWN:


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

Reply via email to