[Freeciv-Dev] Re: [Patch] is_city_center
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
--- Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx> wrote:
>
> The attached patch introduces a new method is_city_center. It also
> removes the local_ prefix of common/city methods.
>
> check_pollution in server/cityturn.c may need some extra eye balls.
>
> Raimar
>
> --
Check_pollution has this check
if ( ( x != -2 && x != 2 ) || ( y != -2 && y != 2 ) ) {
preventing pollution from being in the city radius. Yours seem to lack this.
static void check_pollution(struct city *pcity)
{
- int x,y;
int k=100;
if (pcity->pollution && myrand(100)<=pcity->pollution) {
while (k) {
/* place pollution somewhere in city radius */
- x=myrand(5)-2;
- y=myrand(5)-2;
- if ( ( x != -2 && x != 2 ) || ( y != -2 && y != 2 ) ) {
- x = pcity->x + x;
- y = pcity->y + y;
- nearest_real_pos(&x, &y);
+ int cx = myrand(CITY_MAP_SIZE);
+ int cy = myrand(CITY_MAP_SIZE);
+
+ if (is_valid_city_coords(cx, cy)) {
+ int x, y;
+
+ if (!city_map_to_map(&x, &y, pcity, cx, cy)) {
+ nearest_real_pos(&x, &y);
+ }
if ( (map_get_terrain(x,y)!=T_OCEAN && map_get_terrain(x,y)<=T_TUNDRA)
&&
(!(map_get_special(x,y)&S_POLLUTION)) ) {
map_set_special(x,y, S_POLLUTION);
__________________________________________________
Do You Yahoo!?
Listen to your Yahoo! Mail messages from any phone.
http://phone.yahoo.com
|
|