Author: sveinung
Date: Wed Oct  7 14:53:18 2015
New Revision: 30026

URL: http://svn.gna.org/viewcvs/freeciv?rev=30026&view=rev
Log:
Signal untargeted steal tech by the action

If a random tech should be stolen or if the spy should go for the user
specified tech is a consequence of the action. Stop using the target tech id
to signal it. Signal it with the action in stead.

See patch #6390

Modified:
    branches/S2_6/server/diplomats.c
    branches/S2_6/server/unithand.c

Modified: branches/S2_6/server/diplomats.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/server/diplomats.c?rev=30026&r1=30025&r2=30026&view=diff
==============================================================================
--- branches/S2_6/server/diplomats.c    (original)
+++ branches/S2_6/server/diplomats.c    Wed Oct  7 14:53:18 2015
@@ -541,7 +541,7 @@
 
 /****************************************************************************
   Try to steal a technology from an enemy city.
-  If "technology" is A_UNSET, steal a random technology.
+  If action_id is ACTION_SPY_STEAL_TECH, steal a random technology.
   Otherwise, steal the technology whose ID is "technology".
   (Note: Only Spies can select what to steal.)
 
@@ -581,12 +581,17 @@
   if (!pplayer || !pdiplomat || !unit_alive(pdiplomat->id)) {
     return;
   }
+
+  if (action_id == ACTION_SPY_STEAL_TECH) {
+    /* Can't choose target. Will steal a random tech. */
+    technology = A_UNSET;
+  }
   
   /* Targeted technology should be a ruleset defined tech,
    * "At Spy's Discretion" (A_UNSET) or a future tech (A_FUTURE). */
   if (technology == A_NONE
       || (technology != A_FUTURE
-          && technology != A_UNSET
+          && !(technology == A_UNSET && action_id == ACTION_SPY_STEAL_TECH)
           && !valid_advance_by_number(technology))) {
     return;
   }
@@ -631,7 +636,8 @@
   } else {
     /* Determine difficulty. */
     count = 1;
-    if (technology != A_UNSET) {
+    if (action_id == ACTION_SPY_TARGETED_STEAL_TECH) {
+      /* Targeted steal tech is more difficult. */
       count++;
     }
     count += pcity->server.steal;

Modified: branches/S2_6/server/unithand.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/server/unithand.c?rev=30026&r1=30025&r2=30026&view=diff
==============================================================================
--- branches/S2_6/server/unithand.c     (original)
+++ branches/S2_6/server/unithand.c     Wed Oct  7 14:53:18 2015
@@ -1207,9 +1207,7 @@
     }
     break;
   case ACTION_SPY_TARGETED_STEAL_TECH:
-    if (pcity
-        /* This isn't untargeted steal tech. */
-        && value != A_UNSET) {
+    if (pcity) {
       if (is_action_enabled_unit_on_city(action_type,
                                          actor_unit, pcity)) {
         ACTION_STARTED_UNIT_CITY(action_type, actor_unit, pcity);


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

Reply via email to