Author: sveinung
Date: Fri Aug  1 12:03:05 2014
New Revision: 25762

URL: http://svn.gna.org/viewcvs/freeciv?rev=25762&view=rev
Log:
Fix spy stealing of future techs and of techs chosen by the spy

The renumbering of A_UNSET and A_FUTURE in r25394 broke stealing future techs
and letting the spy choose what tech to steal. This was caused by the argument
validation in diplomat_get_tech() assuming that A_UNSET and A_FUTURE is smaller
than A_LAST.

Rewrite the validation test so it don't make assumptions about what number
A_UNSET ("At Spy's Discretion") and A_FUTURE (future tech) has.

Reviewed by pepeto <pepeto>

See bug #22400

Modified:
    trunk/server/diplomats.c

Modified: trunk/server/diplomats.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/diplomats.c?rev=25762&r1=25761&r2=25762&view=diff
==============================================================================
--- trunk/server/diplomats.c    (original)
+++ trunk/server/diplomats.c    Fri Aug  1 12:03:05 2014
@@ -508,12 +508,12 @@
     return;
   }
   
-  if (technology < 0 || technology == A_NONE || technology >= A_LAST) {
-    return;
-  }
-  
-  if (technology != A_FUTURE && technology != A_UNSET
-      && !valid_advance_by_number(technology)) {
+  /* 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
+          && !valid_advance_by_number(technology))) {
     return;
   }
 


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

Reply via email to