Complete.Org: Mailing Lists: Archives: freeciv-dev: July 2006:
[Freeciv-Dev] (PR#19032) Patch to fix backwards diplomat_success_vs_defe
Home

[Freeciv-Dev] (PR#19032) Patch to fix backwards diplomat_success_vs_defe

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#19032) Patch to fix backwards diplomat_success_vs_defender()
From: "Peter Lunicks" <plunicks@xxxxxxxxx>
Date: Sun, 30 Jul 2006 08:29:13 -0700
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=19032 >

This transaction appears to have no content
Patch to fix diplomat_success_vs_defender() in diplomats.c.
According to source code documentation (comments),
diplomat_success_vs_defender returns TRUE if the "attacker" succeeds.
However, this function was erroneously checking if the *defender* was a
SUPER_SPY rather than the attacker. (The calling function, e.g.
diplomat_infiltrate_tile(), checks if the defender is SUPER_SPY, so
diplomat_success_vs_defender() does not need to.)
Also, the 'return myrand(100) > chance;' at the bottom of the function was
reversed. It *should* be '<', since the 'chance' is the calculated chance
that the attacker succeeds (chance is increased if attacker is veteren, for
example).

Patch works against revision 12162 or earlier/later.

Peter Lunicks
Patch to fix diplomat_success_vs_defender() in diplomats.c.
According to source code documentation (comments), diplomat_success_vs_defender returns TRUE if the "attacker" succeeds.
However, this function was erroneously checking if the *defender* was a SUPER_SPY rather than the attacker. (The calling function, e.g. diplomat_infiltrate_tile(), checks if the defender is SUPER_SPY, so diplomat_success_vs_defender() does not need to.)
Also, the 'return myrand(100) > chance;' at the bottom of the function was reversed. It *should* be '<', since the 'chance' is the calculated chance that the attacker succeeds (chance is increased if attacker is veteren, for example).

Patch works against revision 12162 or earlier/later.

Peter Lunicks

Attachment: diplomat_success_vs_defender-fix.patch
Description: Binary data


[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#19032) Patch to fix backwards diplomat_success_vs_defender(), Peter Lunicks <=