Author: sveinung Date: Mon Jun 22 16:27:13 2015 New Revision: 29176 URL: http://svn.gna.org/viewcvs/freeciv?rev=29176&view=rev Log: Rewrite super spy vs super spy for clarity.
See patch #6111 Modified: branches/S2_6/server/diplomats.c Modified: branches/S2_6/server/diplomats.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/server/diplomats.c?rev=29176&r1=29175&r2=29176&view=diff ============================================================================== --- branches/S2_6/server/diplomats.c (original) +++ branches/S2_6/server/diplomats.c Mon Jun 22 16:27:13 2015 @@ -1210,8 +1210,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. **************************************************************************/ @@ -1221,11 +1221,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. */ @@ -1311,12 +1314,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