Author: jtn
Date: Mon Jun 13 10:10:52 2016
New Revision: 32845

URL: http://svn.gna.org/viewcvs/freeciv?rev=32845&view=rev
Log:
Make it a hard requirement that the 'Home City' action can't be done by
unit types with the 'NoHome' flag, to preserve the semantics that such
units never have a home city.

See gna bug #24747.

Modified:
    trunk/server/rssanity.c

Modified: trunk/server/rssanity.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/rssanity.c?rev=32845&r1=32844&r2=32845&view=diff
==============================================================================
--- trunk/server/rssanity.c     (original)
+++ trunk/server/rssanity.c     Mon Jun 13 10:10:52 2016
@@ -1172,6 +1172,23 @@
         requirement_vector_append(&enabler->actor_reqs, req);
       }
     }
+
+    if (action == ACTION_HOME_CITY) {
+      /* Why this is a hard requirement: Preserve semantics of NoHome
+       * flag. Need to replace other uses in game engine before this can
+       * be demoted to a regular unit flag. */
+
+      struct requirement req
+          = req_from_values(VUT_UTFLAG, REQ_RANGE_LOCAL,
+                            FALSE, FALSE, TRUE, UTYF_NOHOME);
+
+      if (!is_req_in_vec(&req, &enabler->actor_reqs)) {
+        log_debug("Autorequiring that %s can't be done to NoHome units.",
+                  action_get_rule_name(action));
+
+        requirement_vector_append(&enabler->actor_reqs, req);
+      }
+    }
   } action_enablers_iterate_end;
 
   return ok;


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

Reply via email to