Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2001:
[Freeciv-Dev] Re: [PATCH] city_map_iterate cleanup
Home

[Freeciv-Dev] Re: [PATCH] city_map_iterate cleanup

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: "Ross W. Wetmore" <rwetmore@xxxxxxxxxxxx>, freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: [PATCH] city_map_iterate cleanup
From: Jason Dorje Short <jshort@xxxxxxxxxxxxx>
Date: Wed, 22 Aug 2001 18:33:16 -0400

"Ross W. Wetmore" wrote:
> 
> PLEASE don't use normal user variables in iteration macros. Even with
> the proliferation of weird and wonderful uniqueness prefixes and
> suffixes this is very bad coding form.

I thought that's exactly what I did...?

What's wrong with the following?

#define map_city_radius_iterate(city_x, city_y, x_itr,
y_itr)                 \
{                                                                            
\
  int _city_x = (city_x), _city_y =
(city_y);                                 \
  city_map_iterate(_city_x_itr, _city_y_itr)
{                                \
    int x_itr = _city_x + _city_x_itr -
CITY_MAP_SIZE/2;                      \
    int y_itr = _city_y + _city_y_itr -
CITY_MAP_SIZE/2;                      \
    if (!normalize_map_pos(&x_itr, &y_itr)) continue;
 

#define
map_city_radius_iterate_end                                           \
  }
city_map_iterate_end;                                                    
\
}


jason


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