Author: sveinung
Date: Fri Dec 12 13:44:26 2014
New Revision: 27263

URL: http://svn.gna.org/viewcvs/freeciv?rev=27263&view=rev
Log:
Make the "can't establish an embassy when you already got one"-rule permanent.

I don't think it will move it to the ruleset for 2.6. It should therefore live
in is_action_possible() in stead of action_enabler_append_hard().

See patch #5532

Modified:
    trunk/common/actions.c

Modified: trunk/common/actions.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/actions.c?rev=27263&r1=27262&r2=27263&view=diff
==============================================================================
--- trunk/common/actions.c      (original)
+++ trunk/common/actions.c      Fri Dec 12 13:44:26 2014
@@ -373,12 +373,6 @@
 **************************************************************************/
 void action_enabler_append_hard(struct action_enabler *enabler)
 {
-  if (enabler->action == ACTION_ESTABLISH_EMBASSY) {
-    requirement_vector_append(&enabler->actor_reqs,
-                              req_from_str("DiplRel", "Local", FALSE,
-                                           FALSE, "Has real embassy"));
-  }
-
   if (enabler->action != ACTION_TRADE_ROUTE
       && enabler->action != ACTION_MARKETPLACE
       && enabler->action != ACTION_HELP_WONDER) {
@@ -480,6 +474,18 @@
      * controlled by action enablers assumes that the acting player can see
      * the target unit. */
     if (!can_player_see_unit(actor_player, target_unit)) {
+      return FALSE;
+    }
+  }
+
+  if (wanted_action == ACTION_ESTABLISH_EMBASSY) {
+    /* Why this is a hard requirement: There is currently no point in
+     * establishing an embassy when a real embassy already exists.
+     * (Possible exception: crazy hack using the Lua callback
+     * action_started_callback() to make establish embassy do something
+     * else even if the UI still call the action Establish Embassy) */
+    /* Info leak: The actor player known who he has a real embassy to. */
+    if (player_has_real_embassy(actor_player, target_player)) {
       return FALSE;
     }
   }


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

Reply via email to