Complete.Org: Mailing Lists: Archives: freeciv-dev: July 1999:
[Freeciv-Dev] pollution placement bug (PR#71)
Home

[Freeciv-Dev] pollution placement bug (PR#71)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Cc: bugs@xxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] pollution placement bug (PR#71)
From: jjm@xxxxxxxxxxxx
Date: Sat, 24 Jul 1999 20:59:20 -0700 (PDT)

Full_Name: Jeff Mallatt
Version: 1.8.1
OS: Linux
Submission from: (NULL) (199.103.194.35)


In server/cityturn.c, the check_pollution() routine tries to not place
pollution
on city squares.  There's a bug, which could be fixed, but I don't mind
polluted
city squares, as long as I can find them.

This patch does two things:  1. draws pollution on top of cities, so it can be
easily found;  2. changes check_pollution() so it can pollute the city square,
but can't pollute outside the city radius.

diff -Nur freeciv-old/client/gui-gtk/mapview.c freeciv/client/gui-gtk/mapview.c
--- freeciv-old/client/gui-gtk/mapview.c        Sat Jul 24 01:31:19 1999
+++ freeciv/client/gui-gtk/mapview.c    Sat Jul 24 13:29:47 1999
@@ -1475,9 +1475,6 @@
   if(tspecial & S_FORTRESS)
     pixmap_put_overlay_tile(pm, x, y, FORTRESS_TILE);
 
-  if(tspecial & S_POLLUTION)
-    pixmap_put_overlay_tile(pm, x, y, POLLUTION_TILE);
-
   if(!citymode && (terrain_control.border_base<NO_SUCH_GRAPHIC)) {
     tileno=terrain_control.border_base;
     if(tile_is_known(abs_x0, abs_y0-1)==TILE_UNKNOWN)
@@ -1506,6 +1503,10 @@
       }
     }
   }
+
+  /* draw pollution last, or player can't find it */
+  if(tspecial & S_POLLUTION)
+    pixmap_put_overlay_tile(pm, x, y, POLLUTION_TILE);
 }
 
 
diff -Nur freeciv-old/client/gui-xaw/mapview.c freeciv/client/gui-xaw/mapview.c
--- freeciv-old/client/gui-xaw/mapview.c        Sat Jul 24 01:31:22 1999
+++ freeciv/client/gui-xaw/mapview.c    Sat Jul 24 13:26:10 1999
@@ -1336,9 +1336,6 @@
   if(tspecial & S_FORTRESS)
     pixmap_put_overlay_tile(pm, x, y, FORTRESS_TILE);
 
-  if(tspecial & S_POLLUTION)
-    pixmap_put_overlay_tile(pm, x, y, POLLUTION_TILE);
-
   if(!citymode && (terrain_control.border_base<NO_SUCH_GRAPHIC)) {
     tileno=terrain_control.border_base;
     if(tile_is_known(abs_x0, abs_y0-1)==TILE_UNKNOWN)
@@ -1367,6 +1364,10 @@
       }
     }
   }
+
+  /* draw pollution last, or player can't find it */
+  if(tspecial & S_POLLUTION)
+    pixmap_put_overlay_tile(pm, x, y, POLLUTION_TILE);
 }
 
 
diff -Nur freeciv-old/server/cityturn.c freeciv/server/cityturn.c
--- freeciv-old/server/cityturn.c       Wed Jul 21 07:58:54 1999
+++ freeciv/server/cityturn.c   Sat Jul 24 13:46:48 1999
@@ -749,6 +750,7 @@
 **************************************************************************/
 static void city_increase_size(struct city *pcity)
 {
+  int x,y,have_square;
   int has_granary = city_got_effect(pcity, B_GRANARY);
   
   if (!city_got_building(pcity, B_AQUEDUCT)
@@ -1170,11 +1177,14 @@
   int k=100;
   if (pcity->pollution && myrand(100)<=pcity->pollution) {
     while (k) {
+      /* place pollution somewhere in city radius */
       x=pcity->x+myrand(5)-2;
       y=pcity->y+myrand(5)-2;
+      if ( (x==-2 && y==-2) || (x==-2 && y==2) ||
+          (x==2 && y==-2) || (x==2 && y==2) )
+       continue;
       x=map_adjust_x(x); y=map_adjust_y(y);
-      if ( (x!=pcity->x || y!=pcity->x) && 
-          (map_get_terrain(x,y)!=T_OCEAN && map_get_terrain(x,y)<=T_TUNDRA) &&
+      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);
        send_tile_info(0, x, y, TILE_KNOWN);



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