Author: sveinung
Date: Mon Jun 22 16:10:00 2015
New Revision: 29174

URL: http://svn.gna.org/viewcvs/freeciv?rev=29174&view=rev
Log:
Rewrite super spy vs super spy for clarity.

See patch #6111

Modified:
    trunk/server/diplomats.c

Modified: trunk/server/diplomats.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/diplomats.c?rev=29174&r1=29173&r2=29174&view=diff
==============================================================================
--- trunk/server/diplomats.c    (original)
+++ trunk/server/diplomats.c    Mon Jun 22 16:10:00 2015
@@ -1229,8 +1229,8 @@
 
 /**************************************************************************
   This determines if a diplomat/spy succeeds against some defender,
-  who is also a diplomat or spy. Note: a superspy attacker always
-  succeeds, otherwise a superspy defender always wins.
+  who is also a diplomat or spy. Note: a superspy defender always
+  succeeds, otherwise a superspy attacker always wins.
 
   Return TRUE if the "attacker" succeeds.
 **************************************************************************/
@@ -1240,11 +1240,14 @@
 {
   int chance = 50; /* Base 50% chance */
 
+  if (unit_has_type_flag(pdefender, UTYF_SUPERSPY)) {
+    /* A defending UTYF_SUPERSPY will defeat every possible attacker. */
+    return FALSE;
+  }
   if (unit_has_type_flag(pattacker, UTYF_SUPERSPY)) {
+    /* An attacking UTYF_SUPERSPY will defeat every possible defender
+     * except another UTYF_SUPERSPY. */
     return TRUE;
-  }
-  if (unit_has_type_flag(pdefender, UTYF_SUPERSPY)) {
-    return FALSE;
   }
 
   /* Add or remove 25% if spy flag. */
@@ -1330,12 +1333,10 @@
         || unit_has_type_flag(punit, UTYF_SUPERSPY)) {
       /* A UTYF_SUPERSPY unit may not actually be a spy, but a superboss
        * which we cannot allow puny diplomats from getting the better
-       * of. Note that diplomat_success_vs_defender() is always TRUE
-       * if the attacker is UTYF_SUPERSPY. Hence UTYF_SUPERSPY vs UTYF_SUPERSPY
-       * in a diplomatic contest always kills the attacker. */
-
-      if (diplomat_success_vs_defender(pdiplomat, punit, ptile) 
-          && !unit_has_type_flag(punit, UTYF_SUPERSPY)) {
+       * of. UTYF_SUPERSPY vs UTYF_SUPERSPY in a diplomatic contest always
+       * kills the attacker. */
+
+      if (diplomat_success_vs_defender(pdiplomat, punit, ptile)) {
         /* Defending Spy/Diplomat dies. */
 
         /* N.B.: *_link() always returns the same pointer. */


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

Reply via email to