Author: sveinung
Date: Mon Oct  3 14:37:18 2016
New Revision: 33977

URL: http://svn.gna.org/viewcvs/freeciv?rev=33977&view=rev
Log:
Support forcing action enabler target reqs.

Introduce action_blocked_by_situation_tgt(). Don't use it yet.

See patch #7747

Modified:
    trunk/common/actions.c
    trunk/common/actions.h

Modified: trunk/common/actions.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/actions.c?rev=33977&r1=33976&r2=33977&view=diff
==============================================================================
--- trunk/common/actions.c      (original)
+++ trunk/common/actions.c      Mon Oct  3 14:37:18 2016
@@ -3007,6 +3007,23 @@
 }
 
 /**************************************************************************
+  Returns TRUE if the specified action never can be performed when the
+  situation requirement is fulfilled for the target.
+**************************************************************************/
+bool action_blocked_by_situation_tgt(struct action *action,
+                                     const struct requirement *situation)
+{
+  action_enabler_list_iterate(action_enablers_for_action(action->id),
+                              enabler) {
+    if (!does_req_contradicts_reqs(situation, &enabler->target_reqs)) {
+      return FALSE;
+    }
+  } action_enabler_list_iterate_end;
+
+  return TRUE;
+}
+
+/**************************************************************************
   Returns TRUE if the wanted action can be done to the target.
 **************************************************************************/
 static bool is_target_possible(const enum gen_action wanted_action,

Modified: trunk/common/actions.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/actions.h?rev=33977&r1=33976&r2=33977&view=diff
==============================================================================
--- trunk/common/actions.h      (original)
+++ trunk/common/actions.h      Mon Oct  3 14:37:18 2016
@@ -438,6 +438,11 @@
 #define action_id_blocked_by_situation_act(action_id, situation)          \
   action_blocked_by_situation_act(action_by_number(action_id), situation)
 
+bool action_blocked_by_situation_tgt(struct action *action,
+                                     const struct requirement *situation);
+#define action_id_blocked_by_situation_tgt(action_id, situation)          \
+  action_blocked_by_situation_tgt(action_by_number(action_id), situation)
+
 bool is_action_possible_on_city(const enum gen_action action_id,
                                 const struct player *actor_player,
                                 const struct city* target_city);


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

Reply via email to