Summary: Illness popup in client is inaccurate -- doesn't
show risk from trade
                 Project: Freeciv
            Submitted by: jtn
            Submitted on: Friday 19/02/10 at 00:03
                Category: rulesets
                Severity: 3 - Normal
                Priority: 5 - Normal
                  Status: None
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
                 Release: 2.2.0-RC1
         Discussion Lock: Any
        Operating System: None
         Planned Release: 



In the Gtk client, I'm getting a different number in "Plague Risk" in the
city dialog to the total shown in the popup when I click on that risk.

For instance I have a city where the dialog claims a risk of 10.2, but the
popup says:

+9.0 : Risk from over crowdness
+0.0 : Risk from trade
+0.1 : Risk from pollution
==== : Adds up to
 9.1 : Total chance for a plague

The difference between the two is that the city dialog,
gui-gtk-2.0/citydlg.c:city_dialog_update_information(), used the cached value
in the city structure (which comes from the server, I think?), whereas
get_city_dialog_illness_text(), which is used for the popup, works it out
from scratch (calling city_illness()) on the client.

In my setup these are on the same machine built from the same codebase. (The
patch for bug #15373 is applied locally, but I don't think that's
significant, see analysis below.)

I think the problem is that the calculation in get_trade_illness() depends on
"turn_plague", which is not included in
PACKET_CITY_INFO/PACKET_CITY_SHORT_INFO, so the client always sees it as -1
(never); thus, I don't think the displayed "Risk from trade" can ever be
non-zero, even if the real contribution is.

I tested this by hacking the server to always treat trade risk as zero but
keeping the client unmodified; the two numbers then agreed (and were the same
as the previous popup calculation). Also, the trade route endpoints of the
city in question do have a turn_plague that will cause a penalty.

The obvious fix is to add turn_plague to
PACKET_CITY_INFO/PACKET_CITY_SHORT_INFO, but presuambly that needs doing
carefully if it's possible at all. Perhaps it can be done with capabilities?
I haven't yet investigated what's possible here.

If it can be added in a backwards compatible way, then new clients can cope
with old servers by either refusing to display a popup at all or by
displaying incomplete information in the popup (no total).


Reply to this item at:


  Message sent via/by Gna!

Freeciv-dev mailing list

Reply via email to