[Freeciv-Dev] Re: (PR#7327) another occupied-city bug
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://rt.freeciv.org/Ticket/Display.html?id=7327 >
On Mon, Jan 26, 2004 at 02:23:21PM -0800, Jason Short wrote:
>
> <URL: http://rt.freeciv.org/Ticket/Display.html?id=7327 >
>
> When a unit in an enemy city dies the city's occupied flag is removed.
>
> This type of bug crops up because the logic of when a player can see
> into another city is not entirely clear. Simply adding a macro/function
> can_player_see_units_in_city() would be quite helpful.
>
> Another thing that causes confusion is that currently
> pcity->client.occupied is supposed to always have a valid value. This
> means when we _can_ see into the city (as in the case addressed by the
> patch) we have to update it manually. But this value is only checked in
> one place: tilespec.c. It would be easy to change this code in
> tilespec.c to:
>
> bool is_city_occupied(pcity)
> {
> if (can_player_see_units_in_city(pcity)) {
> return (unit_list_size(...) > 0);
> } else {
> return pcity->client.occupied;
> }
> }
>
> this would cut down the excessive logic in other places (like packhand,
> where it's confusing enough already) but means that the actual meaning
> of pcity->client.occupied itself becomes muddled (it doesn't always have
> an accurate value).
I don't know why this hasn't got into the tree but I have this comment
for the client.occupied field in the patch for PR#7001.
+ /*
+ * For its own cities the client will update the occupied field
+ * based on its own unit list at this position. For enemy cities
+ * the client will use the occupied flag that the server sends in
+ * the city_short_info packet.
+ */
So the client relies entirely on the server. If there is a bug the
server should be changed so that it sends the correct value in the
city_short_info packet.
Raimar
--
email: rf13@xxxxxxxxxxxxxxxxx
Tank: So what do you need? Besides a miracle.
Neo: Guns. Lots of guns.
-- From The Matrix
- [Freeciv-Dev] Re: (PR#7327) another occupied-city bug,
Raimar Falke <=
|
|