Summary: Client assumes perfect knowledge of foreign capital
                 Project: Freeciv
            Submitted by: jtn
            Submitted on: Monday 08/30/10 at 16:42
                Category: None
                Severity: 2 - Minor
                Priority: 1 - Later
                  Status: None
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
        Operating System: None
         Planned Release: 



I think there are places in the code where the client assumes it knows where
foreign capitals are. Since it works this out via find_palace(), which
iterates over the cities known to it looking for palaces, I think it can be
inaccurate in the presence of fog-of-war.

 (I haven't tested either of these yet, so I could be wrong, but I couldn't
see any special case in the code which would keep clients apprised of capital
location regardless of FoW.)

The one consequence of this I've found is minor. In the diplomacy dialog,
foreign capitals are calculated by calling find_palace(), which returns the
first city it finds which is_capital(). However, a nation could have built a
new Palace in a city you've seen recently, but you could also think there's
still a Palace in a city you haven't seen recently; in this case the client
will choose one of the two randomly. find_palace() should probably count the
number of "capitals" and return NULL if it finds more than one.
The attached (contrived) savegame illustrates this: on my machine, when I
reloaded the save, the Burmese view of the Hungarian capital is correct, but
the Hungarian view of the Burmese capital is wrong.
(It generally seems a bit awkward that this part of the diplomacy dialog
displays potentially-stale information, whereas everything else you can see
there is guaranteed to be up-to-date if you can see it at all.)

(There's another place where find_palace() is used, in city_waste() which is
in common. It turns out that this is only ever used in the client by the CMA
at the moment, which only ever works on your empire and thus has perfect
knowledge; I think investigating a foreign city uses server-supplied values
for corruption etc. This design is skirting close to the edge of a bug, but I
don't have any suggestions for doing anything about it; the CMA presumably
needs to be able to do the calculations on the fly on the client side.)


Reply to this item at:


  Message sent via/by Gna!

Freeciv-dev mailing list

Reply via email to