[Freeciv-Dev] (PR#9161) rename cartesian_adjacent_iterate
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://rt.freeciv.org/Ticket/Display.html?id=9161 >
This patch renames cartesian_adjacent_iterate as cardinal_adjc_iterate.
* Cardinal, because it iterates over the cardinal directions. See
DIR_IS_CARDINAL(). Cartesian, if it means anything at all, means
something entirely different.
* adjc, because adjc_iterate and adjc_dir_iterate use this shortened form.
I also moved the macro in map.h up next to the other *adjc*iterate macros.
jason
? common/st1D5ZmA
Index: client/packhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/packhand.c,v
retrieving revision 1.382
diff -u -r1.382 packhand.c
--- client/packhand.c 25 Jun 2004 23:35:55 -0000 1.382
+++ client/packhand.c 1 Jul 2004 18:28:15 -0000
@@ -2031,11 +2031,10 @@
/* the "furry edges" on tiles adjacent to an TILE_UNKNOWN tile are
removed here */
if (old_known == TILE_UNKNOWN && packet->known >= TILE_KNOWN_FOGGED) {
- cartesian_adjacent_iterate(x, y, x1, y1) {
+ cardinal_adjc_iterate(x, y, x1, y1) {
if (tile_get_known(x1, y1) >= TILE_KNOWN_FOGGED)
refresh_tile_mapcanvas(x1, y1, FALSE);
- }
- cartesian_adjacent_iterate_end;
+ } cardinal_adjc_iterate_end;
}
}
Index: common/map.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/map.c,v
retrieving revision 1.173
diff -u -r1.173 map.c
--- common/map.c 1 Jul 2004 18:15:52 -0000 1.173
+++ common/map.c 1 Jul 2004 18:28:16 -0000
@@ -529,11 +529,11 @@
***************************************************************/
bool is_at_coast(int x, int y)
{
- cartesian_adjacent_iterate(x, y, x1, y1) {
+ cardinal_adjc_iterate(x, y, x1, y1) {
if (is_ocean(map_get_terrain(x1, y1))) {
return TRUE;
}
- } cartesian_adjacent_iterate_end;
+ } cardinal_adjc_iterate_end;
return FALSE;
}
@@ -699,13 +699,13 @@
|| tile_has_special(ptile, S_IRRIGATION))
return TRUE;
- cartesian_adjacent_iterate(x, y, x1, y1) {
+ cardinal_adjc_iterate(x, y, x1, y1) {
ptile = map_get_tile(x1, y1);
if (is_ocean(ptile->terrain)
|| tile_has_special(ptile, S_RIVER)
|| tile_has_special(ptile, S_IRRIGATION))
return TRUE;
- } cartesian_adjacent_iterate_end;
+ } cardinal_adjc_iterate_end;
return FALSE;
}
Index: common/map.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/map.h,v
retrieving revision 1.189
diff -u -r1.189 map.h
--- common/map.h 1 Jul 2004 18:15:52 -0000 1.189
+++ common/map.h 1 Jul 2004 18:28:17 -0000
@@ -557,6 +557,12 @@
#define adjc_dir_iterate_end adjc_dirlist_iterate_end
+#define cardinal_adjc_iterate(center_x, center_y, x_itr, y_itr)
\
+ adjc_dirlist_iterate(center_x, center_y, x_itr, y_itr, _dir_itr, \
+ map.cardinal_dirs, map.num_cardinal_dirs)
+
+#define cardinal_adjc_iterate_end adjc_dirlist_iterate_end
+
/* Iterate through all tiles adjacent to a tile using the given list of
* directions. dir_itr is the directional value, (center_x, center_y) is
* the center tile (which must be normalized), and (x_itr, y_itr) is the
@@ -628,12 +634,6 @@
extern const int CAR_DIR_DX[4];
extern const int CAR_DIR_DY[4];
-#define cartesian_adjacent_iterate(center_x, center_y, x_itr, y_itr) \
- adjc_dirlist_iterate(center_x, center_y, x_itr, y_itr, _dir_itr, \
- map.cardinal_dirs, map.num_cardinal_dirs)
-
-#define cartesian_adjacent_iterate_end adjc_dirlist_iterate_end
-
/* Used for network transmission; do not change. */
#define MAP_TILE_OWNER_NULL MAX_UINT8
Index: common/terrain.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/terrain.c,v
retrieving revision 1.8
diff -u -r1.8 terrain.c
--- common/terrain.c 25 Jun 2004 23:43:01 -0000 1.8
+++ common/terrain.c 1 Jul 2004 18:28:17 -0000
@@ -165,11 +165,11 @@
{
int num_adjacent = 0;
- cartesian_adjacent_iterate(map_x, map_y, adjc_x, adjc_y) {
+ cardinal_adjc_iterate(map_x, map_y, adjc_x, adjc_y) {
if (map_get_terrain(adjc_x, adjc_y) == t) {
num_adjacent++;
}
- } cartesian_adjacent_iterate_end;
+ } cardinal_adjc_iterate_end;
return num_adjacent;
}
@@ -215,11 +215,11 @@
{
int num_adjacent = 0;
- cartesian_adjacent_iterate(map_x, map_y, adjc_x, adjc_y) {
+ cardinal_adjc_iterate(map_x, map_y, adjc_x, adjc_y) {
if (terrain_has_flag(map_get_terrain(adjc_x, adjc_y), flag)) {
num_adjacent++;
}
- } cartesian_adjacent_iterate_end;
+ } cardinal_adjc_iterate_end;
return num_adjacent;
}
Index: server/mapgen.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/mapgen.c,v
retrieving revision 1.137
diff -u -r1.137 mapgen.c
--- server/mapgen.c 12 Jun 2004 17:42:28 -0000 1.137
+++ server/mapgen.c 1 Jul 2004 18:28:19 -0000
@@ -426,12 +426,12 @@
if (abs(hmap(x, y) - height) < diff
&& map_get_terrain(x, y) == T_GRASSLAND) {
map_set_terrain(x, y, T_DESERT);
- cartesian_adjacent_iterate(x, y, x1, y1) {
+ cardinal_adjc_iterate(x, y, x1, y1) {
make_desert(x1, y1, height,
diff - 1 - abs(map_temperature(x1, y1) - base_T) / DeltaT,
base_T);
- } cartesian_adjacent_iterate_end;
+ } cardinal_adjc_iterate_end;
}
}
@@ -455,11 +455,11 @@
map_set_terrain(map_x, map_y, T_FOREST);
}
if (abs(hmap(map_x, map_y) - height) < diff) {
- cartesian_adjacent_iterate(map_x, map_y, x1, y1) {
+ cardinal_adjc_iterate(map_x, map_y, x1, y1) {
if (myrand(10) > 5) {
make_forest(x1, y1, height, diff - 5);
}
- } cartesian_adjacent_iterate_end;
+ } cardinal_adjc_iterate_end;
}
forests++;
}
@@ -524,13 +524,13 @@
if (map_get_terrain(x, y) == T_GRASSLAND
&& hmap(x, y) < (maxval * 60) / 100) {
map_set_terrain(x, y, T_SWAMP);
- cartesian_adjacent_iterate(x, y, x1, y1) {
+ cardinal_adjc_iterate(x, y, x1, y1) {
if (myrand(10) > 5 && !is_ocean(map_get_terrain(x1, y1))
&& map_get_terrain(x1, y1) != T_SWAMP ) {
map_set_terrain(x1, y1, T_SWAMP);
swamps++;
}
- } cartesian_adjacent_iterate_end;
+ } cardinal_adjc_iterate_end;
swamps++;
}
}
@@ -572,11 +572,11 @@
{
int num_adjacent = 0;
- cartesian_adjacent_iterate(x, y, x1, y1) {
+ cardinal_adjc_iterate(x, y, x1, y1) {
if (map_has_special(x1, y1, S_RIVER)) {
num_adjacent++;
}
- } cartesian_adjacent_iterate_end;
+ } cardinal_adjc_iterate_end;
return num_adjacent;
}
@@ -590,10 +590,10 @@
return 1;
/* any un-blocked? */
- cartesian_adjacent_iterate(x, y, x1, y1) {
+ cardinal_adjc_iterate(x, y, x1, y1) {
if (!TEST_BIT(rmap(x1, y1), RS_BLOCKED))
return 0;
- } cartesian_adjacent_iterate_end;
+ } cardinal_adjc_iterate_end;
return 1; /* none non-blocked |- all blocked */
}
@@ -675,9 +675,9 @@
rmap(x, y) |= (1u << RS_BLOCKED);
- cartesian_adjacent_iterate(x, y, x1, y1) {
+ cardinal_adjc_iterate(x, y, x1, y1) {
rmap(x1, y1) |= (1u << RS_BLOCKED);
- } cartesian_adjacent_iterate_end;
+ } cardinal_adjc_iterate_end;
}
struct test_func {
@@ -1078,13 +1078,13 @@
if (!map_has_special(map_x, map_y, S_RIVER)) {
map_set_terrain(map_x, map_y, T_HILLS);
}
- cartesian_adjacent_iterate(map_x, map_y, x1, y1) {
+ cardinal_adjc_iterate(map_x, map_y, x1, y1) {
if (myrand(100) > 66
&& !is_ocean(map_get_terrain(x1, y1))
&& !map_has_special(x1, y1, S_RIVER)) {
map_set_terrain(x1, y1, T_HILLS);
}
- } cartesian_adjacent_iterate_end;
+ } cardinal_adjc_iterate_end;
}
} whole_map_iterate_end;
}
@@ -1191,11 +1191,11 @@
return FALSE;
}
- cartesian_adjacent_iterate(x, y, x1, y1) {
+ cardinal_adjc_iterate(x, y, x1, y1) {
if (!is_ocean(map_get_terrain(x1, y1))) {
return FALSE;
}
- } cartesian_adjacent_iterate_end;
+ } cardinal_adjc_iterate_end;
return TRUE;
}
@@ -2034,11 +2034,11 @@
{
int count = 0;
- cartesian_adjacent_iterate(x, y, x1, y1) {
+ cardinal_adjc_iterate(x, y, x1, y1) {
if (hmap(x1, y1) != 0) {
count++;
}
- } cartesian_adjacent_iterate_end;
+ } cardinal_adjc_iterate_end;
return count;
}
Index: server/maphand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/maphand.c,v
retrieving revision 1.134
diff -u -r1.134 maphand.c
--- server/maphand.c 23 Feb 2004 05:31:21 -0000 1.134
+++ server/maphand.c 1 Jul 2004 18:28:19 -0000
@@ -1320,19 +1320,19 @@
/* clear the river if it exists */
map_clear_special(x, y, S_RIVER);
- cartesian_adjacent_iterate(x, y, x1, y1) {
+ cardinal_adjc_iterate(x, y, x1, y1) {
if (map_has_special(x1, y1, S_RIVER)) {
bool ocean_near = FALSE;
- cartesian_adjacent_iterate(x1, y1, x2, y2) {
+ cardinal_adjc_iterate(x1, y1, x2, y2) {
if (is_ocean(map_get_terrain(x2, y2)))
ocean_near = TRUE;
- } cartesian_adjacent_iterate_end;
+ } cardinal_adjc_iterate_end;
if (!ocean_near) {
map_set_special(x, y, S_RIVER);
return;
}
}
- } cartesian_adjacent_iterate_end;
+ } cardinal_adjc_iterate_end;
}
/**************************************************************************
Index: server/settlers.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/settlers.c,v
retrieving revision 1.182
diff -u -r1.182 settlers.c
--- server/settlers.c 23 May 2004 02:05:37 -0000 1.182
+++ server/settlers.c 1 Jul 2004 18:28:20 -0000
@@ -551,10 +551,10 @@
if (is_wet(pplayer, x, y))
return TRUE;
- cartesian_adjacent_iterate(x, y, x1, y1) {
+ cardinal_adjc_iterate(x, y, x1, y1) {
if (is_wet(pplayer, x1, y1))
return TRUE;
- } cartesian_adjacent_iterate_end;
+ } cardinal_adjc_iterate_end;
return FALSE;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] (PR#9161) rename cartesian_adjacent_iterate,
Jason Short <=
|
|