Complete.Org: Mailing Lists: Archives: freeciv-dev: December 2002:
[Freeciv-Dev] (PR#2610) isometric mode: roads drawn over rails
Home

[Freeciv-Dev] (PR#2610) isometric mode: roads drawn over rails

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients:;
Subject: [Freeciv-Dev] (PR#2610) isometric mode: roads drawn over rails
From: "Jason Short via RT" <rt@xxxxxxxxxxxxxx>
Date: Thu, 19 Dec 2002 03:37:56 -0800
Reply-to: rt@xxxxxxxxxxxxxx

In isometric mode there is a bug in the sprite layering: roads can
sometimes be drawn over rails.

The attached patch fixes this.  I *think* it should be correct in all
cases, although the logic is a bit tricky.

jason


Index: client/tilespec.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/tilespec.c,v
retrieving revision 1.100
diff -u -r1.100 tilespec.c
--- client/tilespec.c   2002/12/18 19:05:21     1.100
+++ client/tilespec.c   2002/12/19 11:30:27
@@ -1624,34 +1624,38 @@
       /* Draw road corners underneath rails. */
       sprs = fill_road_corner_sprites(sprs, tspecial, tspecial_near);
 
-      if (contains_special(tspecial, S_RAILROAD)) {
-       bool found = FALSE;
+      if (contains_special(tspecial, S_ROAD)) {
+       bool found = FALSE;
 
        for (dir = 0; dir < 8; dir++) {
-         if (contains_special(tspecial_near[dir], S_RAILROAD)) {
-           *sprs++ = sprites.rail.dir[dir];
-           found = TRUE;
-         } else if (contains_special(tspecial_near[dir], S_ROAD)) {
-           *sprs++ = sprites.road.dir[dir];
+         if (contains_special(tspecial_near[dir], S_ROAD)) {
            found = TRUE;
+           /* Only draw a road if there's no rail there. */
+           if (!(contains_special(tspecial, S_RAILROAD)
+                 && contains_special(tspecial_near[dir], S_RAILROAD))) {
+             *sprs++ = sprites.road.dir[dir];
+           }
          }
        }
 
-       if (!found && !pcity)
-         *sprs++ = sprites.rail.isolated;
+       if (!found && !pcity && !contains_special(tspecial, S_RAILROAD)) {
+         *sprs++ = sprites.road.isolated;
+       }
+      }
 
-      } else if (contains_special(tspecial, S_ROAD)) {
+      if (contains_special(tspecial, S_RAILROAD)) {
        bool found = FALSE;
 
        for (dir = 0; dir < 8; dir++) {
-         if (contains_special(tspecial_near[dir], S_ROAD)) {
-           *sprs++ = sprites.road.dir[dir];
+         if (contains_special(tspecial_near[dir], S_RAILROAD)) {
+           *sprs++ = sprites.rail.dir[dir];
            found = TRUE;
          }
        }
 
-       if (!found && !pcity)
-         *sprs++ = sprites.road.isolated;
+       if (!found && !pcity) {
+         *sprs++ = sprites.rail.isolated;
+       }
       }
 
       /* Draw rail corners over roads. */

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