diff -ru -X /home/jjm/cvs/no.freeciv FreecivCVS/common/city.h freeciv/common/city.h --- FreecivCVS/common/city.h Thu Feb 10 09:43:33 2000 +++ freeciv/common/city.h Sun Mar 12 12:39:23 2000 @@ -86,12 +86,13 @@ #define CITY_MAP_SIZE 5 +/* Iterate a city map */ #define city_map_iterate(x, y) \ for (y=0;y #include +#include "city.h" #include "game.h" #include "government.h" #include "log.h" @@ -49,6 +50,8 @@ static int is_already_assigned(struct unit *myunit, struct player *pplayer, int x, int y); +static int city_exists_within_city_radius(int x, int y); + /************************************************************************** ... **************************************************************************/ @@ -1043,7 +1046,8 @@ && map_get_terrain(x, y) != T_OCEAN && (territory[x][y]&(1<ai.founder_want = want; } +} + +/************************************************************************** +Return true iff a city exists within a city radius of the given location. +(Not including a city at the given location. I.e., if only city within +radius is at (x,y), then returns false.) +**************************************************************************/ +int city_exists_within_city_radius(int x, int y) +{ + int dx, dy; + + city_radius_iterate(dx, dy) { + if (!(dx==0 && dy==0)) { + if (map_get_city(x+dx, y+dy)) + return 1; + } + } + + return 0; }