Complete.Org: Mailing Lists: Archives: freeciv-dev: July 2004:
[Freeciv-Dev] (PR#9472) Patch: use direction lists for roadstyle 0
Home

[Freeciv-Dev] (PR#9472) Patch: use direction lists for roadstyle 0

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#9472) Patch: use direction lists for roadstyle 0
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 21 Jul 2004 20:04:42 -0700
Reply-to: rt@xxxxxxxxxxx

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

This patch causes roadstyle 0 to use the tileset direction lists.  It 
also changes one hacked caller of dir_get_name to use 
dir_get_tileset_name instead.

This makes roadstyle 0 work better for hex.

jason

Index: client/tilespec.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/tilespec.c,v
retrieving revision 1.187
diff -u -r1.187 tilespec.c
--- client/tilespec.c   22 Jul 2004 02:53:31 -0000      1.187
+++ client/tilespec.c   22 Jul 2004 03:02:48 -0000
@@ -1266,14 +1266,9 @@
   if (roadstyle == 0) {
     /* Roadstyle 0 has just 8 additional sprites for both road and rail:
      * one for the road/rail going off in each direction. */
-    for (i = 0; i < 8; i++) {
-      const char *s = dir_get_name(i);
-      char dir_name[3];
-
-      assert(strlen(s) == 1 || strlen(s) == 2);
-      dir_name[0] = my_tolower(s[0]);
-      dir_name[1] = my_tolower(s[1]);
-      dir_name[2] = my_tolower(s[2]);
+    for (i = 0; i < num_valid_tileset_dirs; i++) {
+      enum direction8 dir = valid_tileset_dirs[i];
+      const char *dir_name = dir_get_tileset_name(dir);
 
       my_snprintf(buffer, sizeof(buffer), "r.road_%s", dir_name);
       SET_SPRITE(road.dir[i], buffer);
@@ -2209,21 +2204,22 @@
     /* With roadstyle 0, we simply draw one road/rail for every connection.
      * This means we only need a few sprites, but a lot of drawing is
      * necessary and it generally doesn't look very good. */
+    int i;
 
     /* First raw roads under rails. */
     if (road) {
-      for (dir = 0; dir < 8; dir++) {
-       if (draw_road[dir]) {
-         ADD_SPRITE_SIMPLE(sprites.road.dir[dir]);
+      for (i = 0; i < num_valid_tileset_dirs; i++) {
+       if (draw_road[valid_tileset_dirs[i]]) {
+         ADD_SPRITE_SIMPLE(sprites.road.dir[i]);
        }
       }
     }
 
     /* Then draw rails over roads. */
     if (rail) {
-      for (dir = 0; dir < 8; dir++) {
-       if (draw_rail[dir]) {
-         ADD_SPRITE_SIMPLE(sprites.rail.dir[dir]);
+      for (i = 0; i < num_valid_tileset_dirs; i++) {
+       if (draw_rail[valid_tileset_dirs[i]]) {
+         ADD_SPRITE_SIMPLE(sprites.rail.dir[i]);
        }
       }
     }

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#9472) Patch: use direction lists for roadstyle 0, Jason Short <=