Index: common/map.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/map.c,v retrieving revision 1.96 diff -u -r1.96 map.c --- common/map.c 2001/10/11 12:37:04 1.96 +++ common/map.c 2001/10/14 01:25:51 @@ -1308,13 +1308,6 @@ return 1; } -int is_real_tile(int x, int y) -{ - int x1 = x, y1 = y; - - return normalize_map_pos(&x1, &y1); -} - /************************************************************************** Returns TRUE iff the map position is normal. "Normal" here means that it is both a real/valid coordinate set and that the coordinates are in @@ -1326,19 +1319,6 @@ int x1 = x, y1 = y; return (normalize_map_pos(&x1, &y1) && (x1 == x) && (y1 == y)); -} - -/************************************************************************** -Normalizes the map position. Returns TRUE if it is real, FALSE otherwise. -**************************************************************************/ -int normalize_map_pos(int *x, int *y) -{ - while (*x < 0) - *x += map.xsize; - while (*x >= map.xsize) - *x -= map.xsize; - - return (0 <= *y && *y < map.ysize); } /************************************************************************** Index: common/map.h =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/map.h,v retrieving revision 1.96 diff -u -r1.96 map.h --- common/map.h 2001/10/09 16:26:46 1.96 +++ common/map.h 2001/10/14 01:25:52 @@ -230,9 +230,7 @@ void tile_init(struct tile *ptile); enum known_type tile_is_known(int x, int y); int check_coords(int *x, int *y); -int is_real_tile(int x, int y); int is_normal_map_pos(int x, int y); -int normalize_map_pos(int *x, int *y); void nearest_real_pos(int *x, int *y); void rand_neighbour(int x0, int y0, int *x, int *y); @@ -430,6 +428,13 @@ #define whole_map_iterate_end \ } + +#define is_real_tile(x,y) \ + (0 <= (y) && (y) < map.ysize) + +#define normalize_map_pos(x,y) \ + (*(x) = map_adjust_x(*(x)), \ + is_real_tile(*(x), *(y))) /* used to compute neighboring tiles: