[Freeciv-Dev] (PR#2439) city iterator cleanup
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: |
undisclosed-recipients:; |
Subject: |
[Freeciv-Dev] (PR#2439) city iterator cleanup |
From: |
"Jason Short via RT" <rt@xxxxxxxxxxxxxx> |
Date: |
Thu, 28 Nov 2002 10:28:11 -0800 |
Reply-to: |
rt@xxxxxxxxxxxxxx |
This patch was suggested by Per:
It removes city_radius_iterate. This macro is not used, probably
shouldn't ever be used, and cannot be used because there is no
city_radius_iterate_end.
It redefines map_city_radius_iterate to use city_map_checked_iterate. I
also change the parameter names, and add a comment on this iterator.
jason
Index: common/city.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/city.h,v
retrieving revision 1.118
diff -u -r1.118 city.h
--- common/city.h 2002/11/25 19:18:09 1.118
+++ common/city.h 2002/11/28 18:25:52
@@ -128,30 +128,14 @@
} city_map_iterate_outwards_end \
}
-/* Iterate a city radius: (dx,dy) centered on (0,0) */
-#define city_radius_iterate(dx, dy) \
- for (dy = -(int)(CITY_MAP_SIZE/2); dy<(int)(CITY_MAP_SIZE/2); dy++) \
- for (dx = -(int)(CITY_MAP_SIZE/2); dx<(int)(CITY_MAP_SIZE/2); dx++) \
- if (! ((dx == -(int)(CITY_MAP_SIZE/2) || dx == (int)(CITY_MAP_SIZE/2))
&& \
- (dy == -(int)(CITY_MAP_SIZE/2) || dy == (int)(CITY_MAP_SIZE/2))) )
-
-
-#define map_city_radius_iterate(city_x, city_y, x_itr, y_itr) \
+/* Does the same thing as city_map_checked_iterate, but keeps the city
+ * coordinates hidden. */
+#define map_city_radius_iterate(city_x, city_y, map_x, map_y) \
{ \
- int x_itr, y_itr; \
- int MCMI_x, MCMI_y; \
- for (MCMI_x = 0; MCMI_x < CITY_MAP_SIZE; MCMI_x++) { \
- for (MCMI_y = 0; MCMI_y < CITY_MAP_SIZE; MCMI_y++) { \
- if (! ((MCMI_x == 0 || MCMI_x == (CITY_MAP_SIZE-1)) \
- && (MCMI_y == 0 || MCMI_y == (CITY_MAP_SIZE-1))) ) { \
- if(!base_city_map_to_map(&x_itr, &y_itr, city_x, \
- city_y, MCMI_x, MCMI_y)) \
- continue;
+ city_map_checked_iterate(city_x, city_y, _cx, _cy, map_x, map_y) {
#define map_city_radius_iterate_end \
- } \
- } \
- } \
+ } city_map_checked_iterate_end; \
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] (PR#2439) city iterator cleanup,
Jason Short via RT <=
|
|