Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2004:
[Freeciv-Dev] (PR#10035) mapview drawing error: tall sprites are clipped
Home

[Freeciv-Dev] (PR#10035) mapview drawing error: tall sprites are clipped

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#10035) mapview drawing error: tall sprites are clipped in iso-view
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 11 Sep 2004 15:55:56 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=10035 >

You can reproduce the bug by taking a game with lots of cities or units.
 Play in iso-view (I play on an iso-map, but this probably doesn't
matter).  Jump to a map location, then scroll down.  Boom!  The tops of
the flags are all cut off.

The error is in map_to_canvas_pos: it considers these tiles to be "off
the canvas" even though the top of the flag overlaps with the canvas.

jason

? settler_recursion_crash
Index: client/mapview_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/mapview_common.c,v
retrieving revision 1.143
diff -u -r1.143 mapview_common.c
--- client/mapview_common.c     3 Sep 2004 01:21:03 -0000       1.143
+++ client/mapview_common.c     11 Sep 2004 22:55:42 -0000
@@ -264,15 +264,20 @@
   *canvas_y -= mapview_canvas.gui_y0;
 
   /*
-   * Finally we clip; checking to see if _any part_ of the tile is
-   * present on the backing store.  (Even if it's not visible on the canvas,
-   * if it's present on the backing store we need to draw it in case the
-   * canvas is resized.)
+   * Finally we clip.
+   *
+   * This check is tailored to work for both iso-view and classic view.  Note
+   * that (canvas_x, canvas_y) need not be aligned to a tile boundary, and
+   * that the position is at the top-left of the NORMAL (not UNIT) tile.
+   * This checks to see if _any part_ of the tile is persent on the backing
+   * store.  (Even if it's not visible on the canvas, if it's present on the
+   * backing store we need to draw it in case the canvas is resized.)
    */
   return (*canvas_x > -NORMAL_TILE_WIDTH
          && *canvas_x < mapview_canvas.store_width
          && *canvas_y > -NORMAL_TILE_HEIGHT
-         && *canvas_y < mapview_canvas.store_height);
+         && *canvas_y < (mapview_canvas.store_height
+                         + UNIT_TILE_HEIGHT - NORMAL_TILE_HEIGHT));
 }
 
 /****************************************************************************

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