Complete.Org: Mailing Lists: Archives: freeciv-dev: July 2004:
[Freeciv-Dev] (PR#9407) hex tilesets and irrigation
Home

[Freeciv-Dev] (PR#9407) hex tilesets and irrigation

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#9407) hex tilesets and irrigation
From: "Jason Dorje Short" <jdorje@xxxxxxxxxxx>
Date: Fri, 16 Jul 2004 23:09:14 -0700
Reply-to: rt@xxxxxxxxxxx

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

This patch adds support for matched irrigation sprites in hex tilesets.

This is fairly useless since practically no tilesets use matches 
irrigation sprites anyway.  But it's easy.

jason

Index: client/tilespec.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/tilespec.c,v
retrieving revision 1.184
diff -u -r1.184 tilespec.c
--- client/tilespec.c   17 Jul 2004 05:48:13 -0000      1.184
+++ client/tilespec.c   17 Jul 2004 06:07:13 -0000
@@ -1427,12 +1427,13 @@
   /* We use direction-specific irrigation and farmland graphics, if they
    * are available.  If not, we just fall back to the basic irrigation
    * graphics. */
-  for (i = 0; i < NUM_DIRECTION_NSEW; i++) {
-    my_snprintf(buffer, sizeof(buffer), "tx.s_irrigation_%s", nsew_str(i));
+  for (i = 0; i < num_index_cardinal; i++) {
+    my_snprintf(buffer, sizeof(buffer), "tx.s_irrigation_%s",
+               cardinal_str(i));
     SET_SPRITE_ALT(tx.irrigation[i], buffer, "tx.irrigation");
   }
-  for (i = 0; i < NUM_DIRECTION_NSEW; i++) {
-    my_snprintf(buffer, sizeof(buffer), "tx.s_farmland_%s", nsew_str(i));
+  for (i = 0; i < num_index_cardinal; i++) {
+    my_snprintf(buffer, sizeof(buffer), "tx.s_farmland_%s", cardinal_str(i));
     SET_SPRITE_ALT(tx.farmland[i], buffer, "tx.farmland");
   }
 
@@ -2322,13 +2323,18 @@
 **************************************************************************/
 static int get_irrigation_index(enum tile_special_type *tspecial_near)
 {
-  /* A tile with S_FARMLAND will also have S_IRRIGATION set. */
-  bool n = contains_special(tspecial_near[DIR8_NORTH], S_IRRIGATION);
-  bool s = contains_special(tspecial_near[DIR8_SOUTH], S_IRRIGATION);
-  bool e = contains_special(tspecial_near[DIR8_EAST], S_IRRIGATION);
-  bool w = contains_special(tspecial_near[DIR8_WEST], S_IRRIGATION);
+  int tileno = 0, i;
 
-  return INDEX_NSEW(n, s, e, w);
+  for (i = 0; i < num_cardinal_tileset_dirs; i++) {
+    enum direction8 dir = cardinal_tileset_dirs[i];
+
+    /* A tile with S_FARMLAND will also have S_IRRIGATION set. */
+    if (contains_special(tspecial_near[dir], S_IRRIGATION)) {
+      tileno |= 1 << i;
+    }
+  }
+
+  return tileno;
 }
 
 /**************************************************************************
Index: client/tilespec.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/tilespec.h,v
retrieving revision 1.76
diff -u -r1.76 tilespec.h
--- client/tilespec.h   17 Jul 2004 05:48:13 -0000      1.76
+++ client/tilespec.h   17 Jul 2004 06:07:14 -0000
@@ -260,8 +260,8 @@
   } user;
   struct {
     struct Sprite
-      *farmland[NUM_DIRECTION_NSEW],
-      *irrigation[NUM_DIRECTION_NSEW],
+      *farmland[MAX_INDEX_CARDINAL],
+      *irrigation[MAX_INDEX_CARDINAL],
       *pollution,
       *village,
       *fortress,

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#9407) hex tilesets and irrigation, Jason Dorje Short <=