Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2001:
[Freeciv-Dev] [PATCH] bugfix for wrapping problem
Home

[Freeciv-Dev] [PATCH] bugfix for wrapping problem

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] [PATCH] bugfix for wrapping problem
From: Jason Dorje Short <jshort@xxxxxxxxxxxxx>
Date: Fri, 24 Aug 2001 03:32:43 -0400

I was right - the normalizations Ross was replacing that didn't check
the return value were being used incorrectly.  The map positions were
being normalized too early, so that it was the normalized coordinates
rather than the absolute ones that were being used to draw to the
canvas.  A screenshot of the current behavior was sent a little while
ago, but I can't find it now.

The attached patch fixes this in a very simple manner.  It's intended as
a preliminary patch just to reveal the problem - it only fixes things
for the standard (non-orthogonal) tiles, only for GTK, and doesn't fix
things like city names (which will be harder).

To see it in action, start up a game using a small tileset and make your
client window very large.  The graphics will not wrap around; you'll
never see the same spot of land twice.  Now apply the patch, recompile,
and restart the client.  Things will work!

jason
Index: client/gui-gtk/mapview.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/mapview.c,v
retrieving revision 1.90
diff -u -r1.90 mapview.c
--- client/gui-gtk/mapview.c    2001/08/24 07:12:45     1.90
+++ client/gui-gtk/mapview.c    2001/08/24 07:30:00
@@ -294,14 +294,8 @@
       && (*canvas_y > -NORMAL_TILE_HEIGHT)
       && (*canvas_y < height);
   } else { /* is_isometric */
-    if (map_view_x0+map_canvas_store_twidth <= map.xsize)
-      *canvas_x = map_x-map_view_x0;
-    else if(map_x >= map_view_x0)
-      *canvas_x = map_x-map_view_x0;
-    else if(map_x < map_adjust_x(map_view_x0+map_canvas_store_twidth))
-      *canvas_x = map_x+map.xsize-map_view_x0;
-    else *canvas_x = -1;
 
+    *canvas_x = map_x - map_view_x0;
     *canvas_y = map_y - map_view_y0;
 
     *canvas_x *= NORMAL_TILE_WIDTH;
@@ -658,9 +652,7 @@
     return get_canvas_xy(x, y, &dummy_x, &dummy_y);
   } else {
     return (y>=map_view_y0 && y<map_view_y0+map_canvas_store_theight &&
-           ((x>=map_view_x0 && x<map_view_x0+map_canvas_store_twidth) ||
-            (x+map.xsize>=map_view_x0 && 
-             x+map.xsize<map_view_x0+map_canvas_store_twidth)));
+           x>=map_view_x0 && x<map_view_x0+map_canvas_store_twidth);
   }
 }
 
@@ -1397,8 +1389,7 @@
 
     for (y_itr=y; y_itr<y+height; y_itr++) {
       for (x_itr=x; x_itr<x+width; x_itr++) {
-       int map_x = map_adjust_x(x_itr);
-       int map_y = y_itr; /* not adjusted;, we want to draw black tiles */
+       int map_x = x_itr, map_y = y_itr; /* absolute coordinates */
 
        get_canvas_xy(map_x, map_y, &canvas_x, &canvas_y);
        if (tile_visible_mapcanvas(map_x, map_y)) {

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