Index: common/map.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/map.c,v retrieving revision 1.92 diff -u -r1.92 map.c --- common/map.c 2001/09/27 22:49:52 1.92 +++ common/map.c 2001/09/28 00:03:26 @@ -1287,11 +1287,6 @@ return 1; } -int is_real_tile(int x, int y) -{ - return 0 <= y && y < map.ysize; -} - /************************************************************************** Normalizes the map position. Returns TRUE if it is real, FALSE otherwise. **************************************************************************/ Index: common/map.h =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/map.h,v retrieving revision 1.94 diff -u -r1.94 map.h --- common/map.h 2001/09/27 22:49:53 1.94 +++ common/map.h 2001/09/28 00:03:27 @@ -213,6 +213,9 @@ (dest_y) += (src_y), \ normalize_map_pos(&(dest_x), &(dest_y))) +#define is_real_tile(x,y) \ + (IN_RANGE((y), map.ysize)) + struct city *map_get_city(int x, int y); void map_set_city(int x, int y, struct city *pcity); enum tile_terrain_type map_get_terrain(int x, int y); @@ -223,7 +226,6 @@ 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 normalize_map_pos(int *x, int *y); void nearest_real_pos(int *x, int *y); Index: common/shared.h =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/shared.h,v retrieving revision 1.87 diff -u -r1.87 shared.h --- common/shared.h 2001/09/15 21:25:12 1.87 +++ common/shared.h 2001/09/28 00:03:28 @@ -59,6 +59,19 @@ #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) +/* We're using a trick here. The straightforward way to write +IN_RANGE() would be as + + 0 <= (a) && (a) < b + +however, since we know that b is always positive and we know +that the bit-pattern of a negative signed int is the same as the +bit-pattern of a very large number when interpreted as an unsigned +int, we can do away with the extra check. */ + +#define IN_RANGE(a,b) \ + (((unsigned) (a)) < ((unsigned) (b))) + char *create_centered_string(char *s); char * get_option(const char *option_name,char **argv,int *i,int argc);