Author: sveinung
Date: Mon Oct 17 09:46:14 2016
New Revision: 34158

URL: http://svn.gna.org/viewcvs/freeciv?rev=34158&view=rev
Log:
Spy action performers: split act id from result.

Separate action id from action result by using action_id_has_result() to
check an action's result rather than checking its action id.

See patch #7831

Modified:
    trunk/server/diplomats.c

Modified: trunk/server/diplomats.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/diplomats.c?rev=34158&r1=34157&r2=34158&view=diff
==============================================================================
--- trunk/server/diplomats.c    (original)
+++ trunk/server/diplomats.c    Mon Oct 17 09:46:14 2016
@@ -628,7 +628,7 @@
     return FALSE;
   }
 
-  if (action_id == ACTION_SPY_STEAL_TECH) {
+  if (action_id_has_result(action_id, ACTION_SPY_STEAL_TECH)) {
     /* Can't choose target. Will steal a random tech. */
     technology = A_UNSET;
   }
@@ -637,7 +637,8 @@
    * "At Spy's Discretion" (A_UNSET) or a future tech (A_FUTURE). */
   if (technology == A_NONE
       || (technology != A_FUTURE
-          && !(technology == A_UNSET && action_id == ACTION_SPY_STEAL_TECH)
+          && !(technology == A_UNSET
+               && action_id_has_result(action_id, ACTION_SPY_STEAL_TECH))
           && !valid_advance_by_number(technology))) {
     return FALSE;
   }
@@ -695,7 +696,7 @@
   } else {
     /* Determine difficulty. */
     count = 1;
-    if (action_id == ACTION_SPY_TARGETED_STEAL_TECH) {
+    if (action_id_has_result(action_id, ACTION_SPY_TARGETED_STEAL_TECH)) {
       /* Targeted steal tech is more difficult. */
       count++;
     }
@@ -995,7 +996,7 @@
   log_debug("sabotage: count of improvements: %d", count);
 
   /* Determine the target (-1 is production). */
-  if (action_id == ACTION_SPY_SABOTAGE_CITY) {
+  if (action_id_has_result(action_id, ACTION_SPY_SABOTAGE_CITY)) {
     /*
      * Pick random:
      * 50/50 chance to pick production or some improvement.


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

Reply via email to