Complete.Org: Mailing Lists: Archives: freeciv-dev: July 1999:
[Freeciv-Dev] patch: seamless terrain at poles (PR#67)
Home

[Freeciv-Dev] patch: seamless terrain at poles (PR#67)

[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] patch: seamless terrain at poles (PR#67)
From: dwp@xxxxxxxxxxxxxx
Date: Sat, 24 Jul 1999 19:19:46 -0700 (PDT)

This is a multi-part message in MIME format.

--_----------=_93287151312380
Content-Disposition: inline
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

I got sick of seeing that little strip of green at the extreme 
north and south poles (well, mainly north, because the extreme 
south is rarely visible because of the "bottom row" bug).

So this patch makes it as if the next row off the top or
bottom of the map were the same as the top or bottom row.
For normal maps this makes the extreme polar region an 
expanse of pure arctic.

(An alternative would have been for map_get_terrain() to
return T_ARCTIC past the poles, but this current patch is
more general with respect to terrain rulesets, and possibly
better for unusual hand-generated maps with non-arctic poles?!)

A small disadvantage to this patch is that the trident arctic
tiles look like they may have been optimised for the current 
method, and the poles (or rather the polar coasts) don't look 
quite so nice with this...  oh well.

Regards,
-- David

--_----------=_93287151312380
Content-Disposition: inline; filename="seamless_poles1.diff"
Content-Type: text/plain; name="seamless_poles1.diff"
Content-Transfer-Encoding: 7bit

diff -u -r --exclude-from exclude freeciv-cvs/client/gui-gtk/mapview.c 
freeciv-mod/client/gui-gtk/mapview.c
--- freeciv-cvs/client/gui-gtk/mapview.c        Sat Jul 24 13:57:42 1999
+++ freeciv-mod/client/gui-gtk/mapview.c        Sat Jul 24 18:05:06 1999
@@ -1253,16 +1253,30 @@
   }
     
   ttype=map_get_terrain(abs_x0, abs_y0);
-
-  ttype_north=map_get_terrain(abs_x0, abs_y0-1);
-  ttype_south=map_get_terrain(abs_x0, abs_y0+1);
-  ttype_west=map_get_terrain(abs_x0-1, abs_y0);
   ttype_east=map_get_terrain(abs_x0+1, abs_y0);
-  ttype_north_east=map_get_terrain(abs_x0+1, abs_y0-1);
-  ttype_south_east=map_get_terrain(abs_x0+1, abs_y0+1);
-  ttype_south_west=map_get_terrain(abs_x0-1, abs_y0+1);
-  ttype_north_west=map_get_terrain(abs_x0-1, abs_y0-1);
+  ttype_west=map_get_terrain(abs_x0-1, abs_y0);
 
+  /* make north and south pole seamless: */
+  if(abs_y0==0) {
+    ttype_north=ttype;
+    ttype_north_east=ttype_east;
+    ttype_north_west=ttype_west;
+  } else {
+    ttype_north=map_get_terrain(abs_x0, abs_y0-1);
+    ttype_north_east=map_get_terrain(abs_x0+1, abs_y0-1);
+    ttype_north_west=map_get_terrain(abs_x0-1, abs_y0-1);
+  }
+  if(abs_y0==map.ysize-1) {
+    ttype_south=ttype;
+    ttype_south_east=ttype_east;
+    ttype_south_west=ttype_west;
+  } else {
+    ttype_south=map_get_terrain(abs_x0, abs_y0+1);
+    ttype_south_east=map_get_terrain(abs_x0+1, abs_y0+1);
+    ttype_south_west=map_get_terrain(abs_x0-1, abs_y0+1);
+  }
+
+  /* map_get_specials() returns S_NONE past poles anyway */
   tspecial=map_get_special(abs_x0, abs_y0);
   tspecial_north=map_get_special(abs_x0, abs_y0-1);
   tspecial_east=map_get_special(abs_x0+1, abs_y0);
@@ -1272,7 +1286,6 @@
   tspecial_south_east=map_get_special(abs_x0+1, abs_y0+1);
   tspecial_south_west=map_get_special(abs_x0-1, abs_y0+1);
   tspecial_north_west=map_get_special(abs_x0-1, abs_y0-1);
-
 
   tileno=tile_types[ttype].graphic_base;
 
diff -u -r --exclude-from exclude freeciv-cvs/client/gui-xaw/mapview.c 
freeciv-mod/client/gui-xaw/mapview.c
--- freeciv-cvs/client/gui-xaw/mapview.c        Sat Jul 24 13:57:43 1999
+++ freeciv-mod/client/gui-xaw/mapview.c        Sat Jul 24 18:04:46 1999
@@ -1114,16 +1114,30 @@
   }
     
   ttype=map_get_terrain(abs_x0, abs_y0);
-
-  ttype_north=map_get_terrain(abs_x0, abs_y0-1);
-  ttype_south=map_get_terrain(abs_x0, abs_y0+1);
-  ttype_west=map_get_terrain(abs_x0-1, abs_y0);
   ttype_east=map_get_terrain(abs_x0+1, abs_y0);
-  ttype_north_east=map_get_terrain(abs_x0+1, abs_y0-1);
-  ttype_south_east=map_get_terrain(abs_x0+1, abs_y0+1);
-  ttype_south_west=map_get_terrain(abs_x0-1, abs_y0+1);
-  ttype_north_west=map_get_terrain(abs_x0-1, abs_y0-1);
+  ttype_west=map_get_terrain(abs_x0-1, abs_y0);
 
+  /* make north and south pole seamless: */
+  if(abs_y0==0) {
+    ttype_north=ttype;
+    ttype_north_east=ttype_east;
+    ttype_north_west=ttype_west;
+  } else {
+    ttype_north=map_get_terrain(abs_x0, abs_y0-1);
+    ttype_north_east=map_get_terrain(abs_x0+1, abs_y0-1);
+    ttype_north_west=map_get_terrain(abs_x0-1, abs_y0-1);
+  }
+  if(abs_y0==map.ysize-1) {
+    ttype_south=ttype;
+    ttype_south_east=ttype_east;
+    ttype_south_west=ttype_west;
+  } else {
+    ttype_south=map_get_terrain(abs_x0, abs_y0+1);
+    ttype_south_east=map_get_terrain(abs_x0+1, abs_y0+1);
+    ttype_south_west=map_get_terrain(abs_x0-1, abs_y0+1);
+  }
+
+  /* map_get_specials() returns S_NONE past poles anyway */
   tspecial=map_get_special(abs_x0, abs_y0);
   tspecial_north=map_get_special(abs_x0, abs_y0-1);
   tspecial_east=map_get_special(abs_x0+1, abs_y0);
@@ -1133,7 +1147,6 @@
   tspecial_south_east=map_get_special(abs_x0+1, abs_y0+1);
   tspecial_south_west=map_get_special(abs_x0-1, abs_y0+1);
   tspecial_north_west=map_get_special(abs_x0-1, abs_y0-1);
-
 
   tileno=tile_types[ttype].graphic_base;
 

--_----------=_93287151312380--



[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] patch: seamless terrain at poles (PR#67), dwp <=