Complete.Org: Mailing Lists: Archives: freeciv-dev: June 2004:
[Freeciv-Dev] (PR#8945) draw goto lines separately
Home

[Freeciv-Dev] (PR#8945) draw goto lines separately

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#8945) draw goto lines separately
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 9 Jun 2004 21:59:49 -0700
Reply-to: rt@xxxxxxxxxxx

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

Currently in iso-view the tile data is drawn, then all goto lines are 
drawn on top.

However in non-iso view, the goto line is drawn as part of the tile 
layer.  This is more complicated since some special casing is needed 
(goto lines overlap here and there).

The non-iso method is unnecessarily complicated.  It's quite easy to use 
the same method in both cases.  This patch does that.

In other news it should be possible to simplify draw_segment as well.

jason

Index: client/mapview_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/mapview_common.c,v
retrieving revision 1.123
diff -u -r1.123 mapview_common.c
--- client/mapview_common.c     10 Jun 2004 01:04:52 -0000      1.123
+++ client/mapview_common.c     10 Jun 2004 04:57:28 -0000
@@ -1157,29 +1157,6 @@
                         canvas_x, canvas_y,
                         NORMAL_TILE_WIDTH, NORMAL_TILE_HEIGHT);
   }
-
-  if (!citymode && goto_is_active()) {
-    /* put any goto lines on the tile. */
-    if (is_real) {
-      enum direction8 dir;
-
-      for (dir = 0; dir < 8; dir++) {
-       if (is_drawn_line(map_x, map_y, dir)) {
-         draw_segment(map_x, map_y, dir);
-       }
-      }
-    }
-
-    /* Some goto lines overlap onto the tile... */
-    if (NORMAL_TILE_WIDTH % 2 == 0 || NORMAL_TILE_HEIGHT % 2 == 0) {
-      int line_x = map_x - 1, line_y = map_y;
-
-      if (normalize_map_pos(&line_x, &line_y)
-         && is_drawn_line(line_x, line_y, DIR8_NORTHEAST)) {
-       draw_segment(line_x, line_y, DIR8_NORTHEAST);
-      }
-    }
-  }
 }
 
 /**************************************************************************
@@ -1441,18 +1418,6 @@
     gui_rect_iterate(gui_x0, gui_y0, width, height, map_x, map_y, draw) {
       put_tile_iso(map_x, map_y, draw);
     } gui_rect_iterate_end;
-
-    /* Draw the goto lines on top of the whole thing. This is done last as
-     * we want it completely on top. */
-    gui_rect_iterate(gui_x0, gui_y0, width, height, map_x, map_y, draw) {
-      if (normalize_map_pos(&map_x, &map_y)) {
-       adjc_dir_iterate(map_x, map_y, adjc_x, adjc_y, dir) {
-         if (is_drawn_line(map_x, map_y, dir)) {
-           draw_segment(map_x, map_y, dir);
-         }
-       } adjc_dir_iterate_end;
-      }
-    } gui_rect_iterate_end;
   } else {
     /* not isometric */
     gui_rect_iterate(gui_x0, gui_y0, width, height, map_x, map_y, draw) {
@@ -1464,6 +1429,19 @@
     } gui_rect_iterate_end;
   }
 
+  /* Draw the goto lines on top of the whole thing. This is done last as
+   * we want it completely on top. */
+  gui_rect_iterate(gui_x0, gui_y0, width, height, map_x, map_y, draw) {
+    if (((draw & D_B) || (draw & D_M))
+       && normalize_map_pos(&map_x, &map_y)) {
+      adjc_dir_iterate(map_x, map_y, adjc_x, adjc_y, dir) {
+       if (is_drawn_line(map_x, map_y, dir)) {
+         draw_segment(map_x, map_y, dir);
+       }
+      } adjc_dir_iterate_end;
+    }
+  } gui_rect_iterate_end;
+
   /* Draw citymap overlays on top. */
   gui_rect_iterate(gui_x0, gui_y0, width, height, map_x, map_y, draw) {
     if (((draw & D_B) || (draw & D_M))

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#8945) draw goto lines separately, Jason Short <=