[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]
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
|
|