Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2000:
[Freeciv-Dev] Re: patch: fix for the city rename update problem
Home

[Freeciv-Dev] Re: patch: fix for the city rename update problem

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: patch: fix for the city rename update problem
From: David Pfitzner <dwp@xxxxxxxxxxxxxx>
Date: Thu, 21 Sep 2000 14:43:00 +1100 (EST)

sebauer@xxxxxxxxxxx (Sebastian Bauer) wrote:

> The attached patch solves a problem which happened at least with the
> mui client if a city is renamed. The map wasn't updated so there
> was still the old name visible. The attached patch should fix it
> (and also if production changes)
> 
> I changed something in non mui parts, that's why I send it to the
> ML first.

> +++ freeciv-mod/client/packhand.c     Wed Sep 20 20:16:07 2000
> @@ -229,6 +229,7 @@
>    int i, x, y, city_is_new;
>    struct city *pcity;
>    int popup;
> +  int update_descriptions=0;
>  
>    pcity=find_city_by_id(packet->id);
>  
> @@ -254,6 +255,14 @@
>    }
>    else {
>      city_is_new=0;
> +    if (strcmp(pcity->name,packet->name)) {
> +      update_descriptions = 1 && draw_city_names;
> +    }
> +    if ((pcity->is_building_unit != packet->is_building_unit) ||
> +     (pcity->currently_building != packet->currently_building)) {
> +      update_descriptions |= 1 && draw_city_productions;
> +    }

Ew - that "1 &&" and "|=" seems to me a very confusing way to write 
this!  After all update_descriptions is really just being used as
a boolean?  

Eg, I'd prefer 
  if (draw_city_names && <condition>)) {
    update_descriptions = 1;
  }
  if (draw_city_productions && <condition>)) {
    update_descriptions = 1;
  }

(Of couse there are of other ways to write this, I just really dislike
the particular one you have chosen! :-)
           
-- David



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