Author: sveinung
Date: Wed Oct  7 14:52:25 2015
New Revision: 30023

URL: http://svn.gna.org/viewcvs/freeciv?rev=30023&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:
    trunk/server/diplomats.c
    trunk/server/unithand.c

Modified: trunk/server/diplomats.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/diplomats.c?rev=30023&r1=30022&r2=30023&view=diff
==============================================================================
--- trunk/server/diplomats.c    (original)
+++ trunk/server/diplomats.c    Wed Oct  7 14:52:25 2015
@@ -583,7 +583,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.)
 
@@ -626,12 +626,17 @@
   if (!pplayer || !pdiplomat || !unit_alive(pdiplomat->id)) {
     return FALSE;
   }
+
+  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 FALSE;
   }
@@ -678,7 +683,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: trunk/server/unithand.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/unithand.c?rev=30023&r1=30022&r2=30023&view=diff
==============================================================================
--- trunk/server/unithand.c     (original)
+++ trunk/server/unithand.c     Wed Oct  7 14:52:25 2015
@@ -1601,9 +1601,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