Complete.Org: Mailing Lists: Archives: freeciv-dev: October 2001:
[Freeciv-Dev] Re: [Patch] is_city_center
Home

[Freeciv-Dev] Re: [Patch] is_city_center

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: rf13@xxxxxxxxxxxxxxxxxxxxxx, freeciv development list <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] Re: [Patch] is_city_center
From: Raahul Kumar <raahul_da_man@xxxxxxxxx>
Date: Mon, 1 Oct 2001 04:15:02 -0700 (PDT)

--- 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


[Prev in Thread] Current Thread [Next in Thread]