Complete.Org: Mailing Lists: Archives: freeciv-dev: May 2004:
[Freeciv-Dev] (PR#8862) MAX_NUM_LAYERS define
Home

[Freeciv-Dev] (PR#8862) MAX_NUM_LAYERS define

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#8862) MAX_NUM_LAYERS define
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 30 May 2004 23:01:03 -0700
Reply-to: rt@xxxxxxxxxxx

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

> [jdorje - Fri May 28 23:00:29 2004]:
> 
> This simplistic patch adds a MAX_NUM_LAYERS define, and makes sure no 
> terrain has more than this many layers.
> 
> See also PR#8622.

And the patch.
? diff
? ferries
? flags
? data/flags
Index: client/tilespec.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/tilespec.c,v
retrieving revision 1.170
diff -u -r1.170 tilespec.c
--- client/tilespec.c   22 May 2004 18:12:21 -0000      1.170
+++ client/tilespec.c   28 May 2004 22:55:38 -0000
@@ -747,7 +747,7 @@
                                            terrains[i]);
     terr->num_layers = secfile_lookup_int(file, "%s.num_layers",
                                          terrains[i]);
-    terr->num_layers = MAX(1, terr->num_layers);
+    terr->num_layers = CLIP(1, terr->num_layers, MAX_NUM_LAYERS);
 
     for (l = 0; l < terr->num_layers; l++) {
       terr->layer[l].is_tall
Index: client/tilespec.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/tilespec.h,v
retrieving revision 1.67
diff -u -r1.67 tilespec.h
--- client/tilespec.h   21 May 2004 17:59:42 -0000      1.67
+++ client/tilespec.h   28 May 2004 22:55:39 -0000
@@ -108,6 +108,8 @@
   CELL_SINGLE, CELL_RECT
 };
 
+#define MAX_NUM_LAYERS 2
+
 struct terrain_drawing_data {
   char *name;
   char *mine_tag;
@@ -122,7 +124,7 @@
     struct Sprite *base;
     struct Sprite *match[NUM_DIRECTION_NSEW];
     struct Sprite *cells[8][4]; /* 4 = up down left right */
-  } layer[2];
+  } layer[MAX_NUM_LAYERS];
 
   bool is_blended;
   struct Sprite *blend[4]; /* indexed by a direction4 */

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