Complete.Org: Mailing Lists: Archives: freeciv-dev: July 2004:
[Freeciv-Dev] Re: (PR#8754) effects patch
Home

[Freeciv-Dev] Re: (PR#8754) effects patch

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: vasc@xxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#8754) effects patch
From: "Jason Dorje Short" <jdorje@xxxxxxxxxxx>
Date: Tue, 13 Jul 2004 00:39:34 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=8754 >

In this code:

+    resistance = 100 - get_improvement_type(improvement)->sabotage;
+    if (get_city_bonus(pcity, EFT_SPY_RESISTANT)) {
+      resistance = 50;
+    }
+    if (resistance > 0) {
+/*      if (myrand(100) < resistance) { */
        if (myrand (2) == 1) {

I think there is a big bug.  Setting resistance to 50 will make some 
buildings more vulnerable to sabotage.  I think the correct code should 
be more like

   vulnerability = get_improvement_type(improvement)->sabotage;
   if (...) {
     vulnerability /= 2;
   }
   if (myrand(100) >= vulnerability) {
     /* Sabotage fails; diplomat caught. */
   }

the current code is buggy IMO because if the diplomat is caught there 
will never be an incident.  This seems to be the opposite of what should 
happen.  But the effects patch shouldn't fix this.

jason




[Prev in Thread] Current Thread [Next in Thread]