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 02:41:49 @@ -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 02:41:50 @@ -230,9 +230,10 @@ 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); +static inline 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); +static inline 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); @@ -561,5 +562,19 @@ #define MAP_DEFAULT_GENERATOR 1 #define MAP_MIN_GENERATOR 1 #define MAP_MAX_GENERATOR 4 + +static inline 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. +**************************************************************************/ +static inline int normalize_map_pos(int *x, int *y) +{ + *x = map_adjust_x(*x); + return is_real_tile(*x, *y); +} #endif /* FC__MAP_H */