Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2004:
[Freeciv-Dev] Re: (PR#7261) restructure tileset to avoid explicit terrai
Home

[Freeciv-Dev] Re: (PR#7261) restructure tileset to avoid explicit terrai

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] Re: (PR#7261) restructure tileset to avoid explicit terrain mention
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 12 Feb 2004 00:54:15 -0800
Reply-to: rt@xxxxxxxxxxx

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

Raimar Falke wrote:

>>+  for (entries = hash_num_entries(terrain_hash); entries > 0; entries--) {
> 
> I used
> 
>   while(hash_num_entries(terrain_hash)>0) {
> 
> for such constructs in the past.

OK.

>>+    const struct terrain_drawing_data *draw;
>>+
>>+    draw = hash_value_by_number(terrain_hash, 0);
>>+    hash_delete_entry(terrain_hash, draw->name);
>>+    free(draw->name);
>>+    free((void *) draw);
>>+  }
>>+  hash_free(terrain_hash);
> 
> terrain_hash = NULL;
> 
> assert(terrain_hash==NULL);

OK.

>>@@ -668,6 +712,7 @
>>+      freelog(LOG_FATAL, "No graphics %s or %s for %s terrain.",
>>+           tt->graphic_str, tt->graphic_alt, tt->terrain_name);
>>+      exit(-1);
> 
> 
> exit(-1) ??

Should be EXIT_FAILURE.  Note there are many other similar exits in 
tilespec loading.  In future there should be a mechanism for a non-fatal 
failure to load a tilespec (for dynamic tileset changing).


>>+  if (draw->match_type == 0 || draw->is_layered || is_ocean(terrain)) {

>>+  if (draw->match_type != 0 && !is_ocean(terrain)) {
> 
> 
> What if neither the MARK line or this lines matches? Isn't there
> draw->base unset?

Logically one of the lines will always match.

>>                              name[0] != '\0', "tile_type special", name);
> 
> 
> The expression "name[0] != '\0'" will always evaluate to true here.

OK.

> I really have no idea what match-type is. There is no enum, no docu
> and no comment in the tilespecs. The same is true for is_blended and
> is_layered. But you explained these on the list so I have an idea.

Adding documentation is also a goal.  I've added to README.graphics.

> There should be a comment that terrain_hash maps from the name (not
> the sprite name) to drawing-data.

OK.

> Why is struct terrain_drawing_data declared in the header file when it
> is used only in the .c file?

It is part of named_sprites.  This struct contains lots of info that is 
only used in tilespec.c.  Unfortunately some is used outside of it AFAIK.

> I really don't know enough about the drawing code to comment if the
> semantic changes are ok. But if the patch moves hard-coded behavior
> into data files and reproduce the old output it is ok from my side.

I believe the semantics are correct.  I have tested with isotrident and 
trident, including with the civ1 ruleset.  But not all combinations have 
been tried.

-----

The attached patch implements the above changes as well as fixing some 
things in tilespec.c.

jason

Index: client/tilespec.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/tilespec.c,v
retrieving revision 1.137
diff -u -r1.137 tilespec.c
--- client/tilespec.c   2004/01/20 21:52:07     1.137
+++ client/tilespec.c   2004/02/12 08:53:19
@@ -78,7 +78,6 @@
 
 int num_tiles_explode_unit=0;
 
-static bool is_mountainous = FALSE;
 static int roadstyle;
 static int flag_offset_x, flag_offset_y;
 
@@ -134,7 +133,10 @@
  */
 static struct hash_table *sprite_hash = NULL;
 
-#define TILESPEC_CAPSTR "+tilespec2 duplicates_ok roadstyle"
+/* This hash table maps terrain graphic strings to drawing data. */
+static struct hash_table *terrain_hash;
+
+#define TILESPEC_CAPSTR "+tilespec2 duplicates_ok roadstyle +terrain_grid"
 /*
    Tilespec capabilities acceptable to this program:
    +tilespec2     -  basic format, required
@@ -145,6 +147,8 @@
                      style of road drawing to use.  Tilesets which rely on
                      this (those that have roadstyle != is_isometric ? 0 : 1)
                      should specify "+roadstyle".
+   terrain_grid   -  The basic terrain grid information in the top-level
+                     tilespec file is required.
 */
 
 #define SPEC_CAPSTR "+spec2"
@@ -281,6 +285,17 @@
     free(minimap_intro_filename);
     minimap_intro_filename = NULL;
   }
+
+  while (hash_num_entries(terrain_hash) > 0) {
+    const struct terrain_drawing_data *draw;
+
+    draw = hash_value_by_number(terrain_hash, 0);
+    hash_delete_entry(terrain_hash, draw->name);
+    free(draw->name);
+    free((void *) draw);
+  }
+  hash_free(terrain_hash);
+  terrain_hash = NULL; /* Helpful for sanity. */
 }
 
 /**********************************************************************
@@ -580,8 +595,8 @@
   struct section_file the_file, *file = &the_file;
   char *fname, *c;
   int i;
-  int num_spec_files;
-  char **spec_filenames;
+  int num_spec_files, num_terrains;
+  char **spec_filenames, **terrains;
   char *file_capstr;
   bool duplicates_ok;
 
@@ -635,8 +650,6 @@
          UNIT_TILE_WIDTH, UNIT_TILE_HEIGHT,
          SMALL_TILE_WIDTH, SMALL_TILE_HEIGHT);
 
-  is_mountainous = secfile_lookup_bool_default(file, FALSE,
-                                              "tilespec.is_mountainous");
   roadstyle = secfile_lookup_int_default(file, is_isometric ? 0 : 1,
                                         "tilespec.roadstyle");
   flag_offset_x = secfile_lookup_int_default(file, 0,
@@ -660,6 +673,41 @@
   minimap_intro_filename = tilespec_gfx_filename(c);
   freelog(LOG_DEBUG, "radar file %s", minimap_intro_filename);
 
+
+  /* Terrain drawing info. */
+  terrains = secfile_get_secnames_prefix(file, "terrain_", &num_terrains);
+  if (num_terrains == 0) {
+    freelog(LOG_FATAL, "No terrain types supported by tileset.");
+    exit(EXIT_FAILURE);
+  }
+
+  assert(terrain_hash == NULL);
+  terrain_hash = hash_new(hash_fval_string, hash_fcmp_string);
+
+  for (i = 0; i < num_terrains; i++) {
+    struct terrain_drawing_data *terr = fc_malloc(sizeof(*terr));
+
+    memset(terr, 0, sizeof(*terr));
+    terr->name = mystrdup(terrains[i] + strlen("terrain_"));
+    terr->is_blended = secfile_lookup_bool(file, "%s.is_blended",
+                                           terrains[i]);
+    terr->is_layered = secfile_lookup_bool(file, "%s.is_layered",
+                                          terrains[i]);
+    terr->match_type = secfile_lookup_int(file, "%s.match_type",
+                                         terrains[i]);
+
+    if (terr->is_layered && terr->match_type == 0) {
+      freelog(LOG_FATAL, "%s is layered but has no matching type set.",
+             terr->name);
+    }
+
+    if (!hash_insert(terrain_hash, terr->name, terr)) {
+      die("warning: duplicate terrain entry %s.", terrains[i]);
+    }
+  }
+  free(terrains);
+
+
   spec_filenames = secfile_lookup_str_vec(file, &num_spec_files,
                                          "tilespec.files");
   if (num_spec_files == 0) {
@@ -986,21 +1034,6 @@
   }
   
   if (is_isometric) {
-    for(i=0; i<NUM_DIRECTION_NSEW; i++) {
-      my_snprintf(buffer, sizeof(buffer), "tx.s_forest_%s", nsew_str(i));
-      SET_SPRITE(tx.spec_forest[i], buffer);
-    }
-
-    for(i=0; i<NUM_DIRECTION_NSEW; i++) {
-      my_snprintf(buffer, sizeof(buffer), "tx.s_mountain_%s", nsew_str(i));
-      SET_SPRITE(tx.spec_mountain[i], buffer);
-    }
-
-    for(i=0; i<NUM_DIRECTION_NSEW; i++) {
-      my_snprintf(buffer, sizeof(buffer), "tx.s_hill_%s", nsew_str(i));
-      SET_SPRITE(tx.spec_hill[i], buffer);
-    }
-
     for (i=0; i<4; i++) {
       for (j=0; j<8; j++) {
        char *dir2 = "udlr";
@@ -1132,59 +1165,71 @@
   Set tile_type sprite values; should only happen after
   tilespec_load_tiles().
 ***********************************************************************/
-void tilespec_setup_tile_type(int id)
+void tilespec_setup_tile_type(enum tile_terrain_type terrain)
 {
-  struct tile_type *tt = get_tile_type(id);
+  struct tile_type *tt = get_tile_type(terrain);
+  struct terrain_drawing_data *draw;
   char buffer1[MAX_LEN_NAME+20];
-  char buffer2[MAX_LEN_NAME+20];
-  char *nsew;
   int i;
   
   if(tt->terrain_name[0] == '\0') {
-    for(i=0; i<NUM_DIRECTION_NSEW; i++) {
-      tt->sprite[i] = NULL;
-    }
-    for(i=0; i<2; i++) {
-      tt->special[i].sprite = NULL;
-    }
     return;
   }
 
-  if (is_isometric) {
-    my_snprintf(buffer1, sizeof(buffer1), "%s1", tt->graphic_str);
-    if (id != T_RIVER) {
-      tt->sprite[0] = lookup_sprite_tag_alt(buffer1, NULL, TRUE, "tile_type",
-                                           tt->terrain_name);
-    } else {
-      tt->sprite[0] = NULL;
+  draw = hash_lookup_data(terrain_hash, tt->graphic_str);
+  if (!draw) {
+    draw = hash_lookup_data(terrain_hash, tt->graphic_alt);
+    if (!draw) {
+      freelog(LOG_FATAL, "No graphics %s or %s for %s terrain.",
+             tt->graphic_str, tt->graphic_alt, tt->terrain_name);
+      exit(EXIT_FAILURE);
     }
-  } else {
-    for(i=0; i<NUM_DIRECTION_NSEW; i++) {
-      nsew = nsew_str(i);
-      my_snprintf(buffer1, sizeof(buffer1), "%s_%s", tt->graphic_str, nsew);
-      my_snprintf(buffer2, sizeof(buffer2), "%s_%s", tt->graphic_alt, nsew);
+  }
 
-      tt->sprite[i] = lookup_sprite_tag_alt(buffer1, buffer2, TRUE, 
"tile_type",
-                                           tt->terrain_name);
+  /* Currently ocean terrains have special handling.  Although a match type
+   * may be specified it is ignored.  This is a hack. */
+  if (is_isometric && is_ocean(terrain)) {
+    my_snprintf(buffer1, sizeof(buffer1), "t.%s1", draw->name);
+    draw->base = lookup_sprite_tag_alt(buffer1, "", TRUE, "tile_type",
+                                      tt->terrain_name);
+  } else {
+    if (draw->match_type == 0 || draw->is_layered) {
+      /* Load single sprite for this terrain. */
+      my_snprintf(buffer1, sizeof(buffer1), "t.%s1", draw->name);
+      draw->base = lookup_sprite_tag_alt(buffer1, "", TRUE, "tile_type",
+                                        tt->terrain_name);
+    }
+
+    if (draw->match_type != 0) {
+      /* Load 16 cardinally-matched sprites. */
+      for (i = 0; i < NUM_DIRECTION_NSEW; i++) {
+       my_snprintf(buffer1, sizeof(buffer1),
+                   "t.%s_%s", draw->name, nsew_str(i));
+       draw->blend[i] = lookup_sprite_tag_alt(buffer1, "", TRUE,
+                                              "tile_type", tt->terrain_name);
+      }
 
-      assert(tt->sprite[i] != NULL);
-      /* should probably do something if NULL, eg generic default? */
+      if (!draw->base) {
+       draw->base = draw->blend[0];
+      }
     }
   }
 
   for (i=0; i<2; i++) {
     char *name = (i != 0) ? tt->special_2_name : tt->special_1_name;
     if (name[0] != '\0') {
-      tt->special[i].sprite
+      draw->special[i]
        = lookup_sprite_tag_alt(tt->special[i].graphic_str,
                                tt->special[i].graphic_alt,
-                               name[0] != '\0', "tile_type special", name);
-      assert(tt->special[i].sprite != NULL);
+                               TRUE, "tile_type special", name);
+      assert(draw->special[i] != NULL);
     } else {
-      tt->special[i].sprite = NULL;
+      draw->special[i] = NULL;
     }
     /* should probably do something if NULL, eg generic default? */
   }
+
+  sprites.terrain[terrain] = draw;
 }
 
 /**********************************************************************
@@ -1538,36 +1583,15 @@
   if (ttype_other == T_UNKNOWN)
     return sprites.black_tile;
 
-  if (is_ocean(ttype) || ttype == T_JUNGLE) {
+  if (!sprites.terrain[ttype]->is_blended) {
     return NULL;
   }
 
   if (is_ocean(ttype_other)) {
     return sprites.coast_color;
   }
-
-  if (ttype_other != T_UNKNOWN && ttype_other != T_LAST)
-    return get_tile_type(ttype_other)->sprite[0];
-  else
-    return NULL;
-}
-
-/**********************************************************************
-  Return TRUE iff the two mountainous terrain types should be blended.
 
-  If is_mountainous set, the tileset will be "mountainous" and consider
-  adjacent hills and mountains interchangable.  If it's unset then
-  hills will only blend with hills and mountains only with mountains.
-***********************************************************************/
-static bool can_blend_hills_and_mountains(enum tile_terrain_type ttype,
-                                 enum tile_terrain_type ttype_adjc)
-{
-  assert(ttype == T_HILLS || ttype == T_MOUNTAINS);
-  if (is_mountainous) {
-    return ttype_adjc == T_HILLS || ttype_adjc == T_MOUNTAINS;
-  } else {
-    return ttype_adjc == ttype;
-  }
+  return sprites.terrain[ttype_other]->base;
 }
 
 /**************************************************************************
@@ -1902,43 +1926,21 @@
        }
       }
     } else {
-      ADD_SPRITE_SIMPLE(get_tile_type(ttype)->sprite[0]);
-
-      switch (ttype) {
-        case T_HILLS:
-        tileno = INDEX_NSEW(can_blend_hills_and_mountains(T_HILLS,
-                                                 ttype_near[DIR8_NORTH]),
-                           can_blend_hills_and_mountains(T_HILLS,
-                                                 ttype_near[DIR8_SOUTH]),
-                           can_blend_hills_and_mountains(T_HILLS,
-                                                 ttype_near[DIR8_EAST]),
-                           can_blend_hills_and_mountains(T_HILLS,
-                                                 ttype_near[DIR8_WEST]));
-        ADD_SPRITE_SIMPLE(sprites.tx.spec_hill[tileno]);
-        break;
- 
-        case T_FOREST:
-        tileno = INDEX_NSEW(ttype_near[DIR8_NORTH] == T_FOREST,
-                         ttype_near[DIR8_SOUTH] == T_FOREST,
-                         ttype_near[DIR8_EAST] == T_FOREST,
-                         ttype_near[DIR8_WEST] == T_FOREST);
-        ADD_SPRITE_SIMPLE(sprites.tx.spec_forest[tileno]);
-        break;
- 
-        case T_MOUNTAINS:
-        tileno = INDEX_NSEW(can_blend_hills_and_mountains(T_MOUNTAINS,
-                                                 ttype_near[DIR8_NORTH]),
-                           can_blend_hills_and_mountains(T_MOUNTAINS,
-                                                 ttype_near[DIR8_SOUTH]),
-                           can_blend_hills_and_mountains(T_MOUNTAINS,
-                                                 ttype_near[DIR8_EAST]),
-                           can_blend_hills_and_mountains(T_MOUNTAINS,
-                                                 ttype_near[DIR8_WEST]));
-        ADD_SPRITE_SIMPLE(sprites.tx.spec_mountain[tileno]);
-        break;
+      if (sprites.terrain[ttype]->match_type == 0
+         || sprites.terrain[ttype]->is_layered) {
+       ADD_SPRITE_SIMPLE(sprites.terrain[ttype]->base);
+      }
 
-       default:
-       break;
+      if (sprites.terrain[ttype]->match_type != 0) {
+       int match_type = sprites.terrain[ttype]->match_type;
+
+#define MATCH(dir) (sprites.terrain[ttype_near[(dir)]]->match_type)
+       tileno = INDEX_NSEW(MATCH(DIR8_NORTH) == match_type,
+                           MATCH(DIR8_SOUTH) == match_type,
+                           MATCH(DIR8_EAST) == match_type,
+                           MATCH(DIR8_WEST) == match_type);
+       ADD_SPRITE_SIMPLE(sprites.terrain[ttype]->blend[tileno]);
+#undef MATCH
       }
 
       sprs += fill_irrigation_sprite_array(sprs, tspecial, tspecial_near,
@@ -1988,9 +1990,9 @@
         
     if (draw_specials) {
       if (contains_special(tspecial, S_SPECIAL_1)) {
-       ADD_SPRITE_SIMPLE(tile_types[ttype].special[0].sprite);
+       ADD_SPRITE_SIMPLE(sprites.terrain[ttype]->special[0]);
       } else if (contains_special(tspecial, S_SPECIAL_2)) {
-       ADD_SPRITE_SIMPLE(tile_types[ttype].special[1].sprite);
+       ADD_SPRITE_SIMPLE(sprites.terrain[ttype]->special[1]);
       }
     }
     
@@ -2000,9 +2002,9 @@
 
     if (draw_specials) {
       if (contains_special(tspecial, S_SPECIAL_1)) {
-       ADD_SPRITE_SIMPLE(tile_types[ttype].special[0].sprite);
+       ADD_SPRITE_SIMPLE(sprites.terrain[ttype]->special[0]);
       } else if (contains_special(tspecial, S_SPECIAL_2)) {
-       ADD_SPRITE_SIMPLE(tile_types[ttype].special[1].sprite);
+       ADD_SPRITE_SIMPLE(sprites.terrain[ttype]->special[1]);
       }
     }
   
@@ -2130,17 +2132,20 @@
      abs_x0>=34 && abs_x0<=36 && abs_y0>=den_y && abs_y0<=den_y+1) {
     mysprite = sprites.tx.denmark[abs_y0-den_y][abs_x0-34];
   } else {
-    tileno = INDEX_NSEW(ttype_near[DIR8_NORTH] == ttype,
-                       ttype_near[DIR8_SOUTH] == ttype,
-                       ttype_near[DIR8_EAST] == ttype,
-                       ttype_near[DIR8_WEST] == ttype);
-    if(ttype==T_RIVER) {
-      tileno |= INDEX_NSEW(is_ocean(ttype_near[DIR8_NORTH]),
-                          is_ocean(ttype_near[DIR8_SOUTH]),
-                          is_ocean(ttype_near[DIR8_EAST]),
-                          is_ocean(ttype_near[DIR8_WEST]));
+    /* FIXME: doesn't support is_layered. */
+    if (sprites.terrain[ttype]->match_type == 0) {
+      mysprite = sprites.terrain[ttype]->base;
+    } else {
+      int match_type = sprites.terrain[ttype]->match_type;
+
+#define MATCH(dir) (sprites.terrain[ttype_near[(dir)]]->match_type)
+      tileno = INDEX_NSEW(MATCH(DIR8_NORTH) == match_type,
+                         MATCH(DIR8_SOUTH) == match_type,
+                         MATCH(DIR8_EAST) == match_type,
+                         MATCH(DIR8_WEST) == match_type);
+      mysprite = sprites.terrain[ttype]->blend[tileno];
+#undef MATCH
     }
-    mysprite = get_tile_type(ttype)->sprite[tileno];
   }
 
   if (draw_terrain)
@@ -2191,9 +2196,9 @@
 
   if(draw_specials) {
     if (contains_special(tspecial, S_SPECIAL_1))
-      ADD_SPRITE_SIMPLE(tile_types[ttype].special[0].sprite);
+      ADD_SPRITE_SIMPLE(sprites.terrain[ttype]->special[0]);
     else if (contains_special(tspecial, S_SPECIAL_2))
-      ADD_SPRITE_SIMPLE(tile_types[ttype].special[1].sprite);
+      ADD_SPRITE_SIMPLE(sprites.terrain[ttype]->special[1]);
   }
 
   if(contains_special(tspecial, S_MINE) && draw_mines) {
Index: client/tilespec.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/tilespec.h,v
retrieving revision 1.49
diff -u -r1.49 tilespec.h
--- client/tilespec.h   2004/01/11 17:45:03     1.49
+++ client/tilespec.h   2004/02/12 08:53:19
@@ -18,8 +18,6 @@
 #ifndef FC__TILESPEC_H
 #define FC__TILESPEC_H
 
-#include "map.h"               /* NUM_DIRECTION_NSEW */
-
 #include "citydlg_common.h"    /* enum citizen_type */
 #include "colors_g.h"
 #include "options.h"
@@ -45,7 +43,7 @@
 void tilespec_setup_unit_type(int id);
 void tilespec_setup_impr_type(int id);
 void tilespec_setup_tech_type(int id);
-void tilespec_setup_tile_type(int id);
+void tilespec_setup_tile_type(enum tile_terrain_type terrain);
 void tilespec_setup_government(int id);
 void tilespec_setup_nation_flag(int id);
 void tilespec_setup_city_tiles(int style);
@@ -76,6 +74,8 @@
 
 /* This the way directional indices are now encoded: */
 
+#define NUM_DIRECTION_NSEW             16
+
 #define BIT_NORTH (0x01)
 #define BIT_SOUTH (0x02)
 #define BIT_EAST  (0x04)
@@ -97,6 +97,18 @@
   DIR4_NORTH = 0, DIR4_SOUTH, DIR4_EAST, DIR4_WEST
 };
 
+struct terrain_drawing_data {
+  char *name;
+
+  bool is_blended;
+  bool is_layered;
+  int match_type;
+
+  struct Sprite *base;
+  struct Sprite *blend[NUM_DIRECTION_NSEW];
+  struct Sprite *special[2];
+};
+
 struct named_sprites {
   struct Sprite
     *bulb[NUM_TILES_PROGRESS],
@@ -202,15 +214,13 @@
       *spec_river[NUM_DIRECTION_NSEW],
       *darkness[NUM_DIRECTION_NSEW],         /* first unused */
       *river_outlet[4],                /* indexed by enum direction4 */
-      /* for isometric */
-      *spec_forest[NUM_DIRECTION_NSEW],
-      *spec_mountain[NUM_DIRECTION_NSEW],
-      *spec_hill[NUM_DIRECTION_NSEW],
       *coast_cape_iso[8][4], /* 4 = up down left right */
       /* for non-isometric */
       *coast_cape[NUM_DIRECTION_NSEW],       /* first unused */
       *denmark[2][3];          /* row, column */
   } tx;                                /* terrain extra */
+
+  struct terrain_drawing_data *terrain[MAX_NUM_TERRAINS];
 };
 
 extern struct named_sprites sprites;
Index: common/capstr.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/capstr.c,v
retrieving revision 1.157
diff -u -r1.157 capstr.c
--- common/capstr.c     2004/02/07 11:49:44     1.157
+++ common/capstr.c     2004/02/12 08:53:19
@@ -76,7 +76,7 @@
 
 #define CAPABILITY "+1.14.delta +last_turns_shield_surplus veteran +orders " \
                    "+starter +union +iso_maps +orders2client " \
-                   "+change_production"
+                   "+change_production +tilespec1"
 
 /* "+1.14.delta" is the new delta protocol for 1.14.0-dev.
  *
@@ -97,6 +97,8 @@
  * "orders2client" means that the server sends back the orders to the client.
  *
  * "change_production" is the E_CITY_PRODUCTION_CHANGED event.
+ *
+ * "tilespec1" means changed graphic strings in terrain.ruleset.
  */
 
 void init_our_capability(void)
Index: common/map.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/map.h,v
retrieving revision 1.174
diff -u -r1.174 map.h
--- common/map.h        2004/02/06 20:00:32     1.174
+++ common/map.h        2004/02/12 08:53:19
@@ -21,10 +21,6 @@
 #include "terrain.h"
 #include "unit.h"
 
-struct Sprite;                 /* opaque; client-gui specific */
-
-#define NUM_DIRECTION_NSEW             16
-
 /*
  * The value of MOVE_COST_FOR_VALID_SEA_STEP has no particular
  * meaning. The value is only used for comparison. The value must be
@@ -75,7 +71,6 @@
   char terrain_name_orig[MAX_LEN_NAME];        /* untranslated copy */
   char graphic_str[MAX_LEN_NAME];
   char graphic_alt[MAX_LEN_NAME];
-  struct Sprite *sprite[NUM_DIRECTION_NSEW];
 
   int movement_cost;
   int defense_bonus;
@@ -101,7 +96,6 @@
   struct {
     char graphic_str[MAX_LEN_NAME];
     char graphic_alt[MAX_LEN_NAME];
-    struct Sprite *sprite;
   } special[2];
 
   int road_trade_incr;
Index: common/terrain.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/terrain.h,v
retrieving revision 1.12
diff -u -r1.12 terrain.h
--- common/terrain.h    2004/02/02 07:23:45     1.12
+++ common/terrain.h    2004/02/12 08:53:19
@@ -71,6 +71,7 @@
 };
 #define T_FIRST (T_ARCTIC)
 #define T_COUNT (T_UNKNOWN)
+#define MAX_NUM_TERRAINS (T_LAST)
 
 enum terrain_flag_id {
   TER_NO_BARBS, /* No barbarians summoned on this terrain. */
Index: data/isotrident.tilespec
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/isotrident.tilespec,v
retrieving revision 1.8
diff -u -r1.8 isotrident.tilespec
--- data/isotrident.tilespec    2003/02/02 00:15:53     1.8
+++ data/isotrident.tilespec    2004/02/12 08:53:19
@@ -2,7 +2,7 @@
 [tilespec]
 
 ; Format and options of this tilespec file:
-options = "+tilespec2"
+options = "+tilespec2 roadstyle +terrain_grid"
 
 ; A simple name for the tileset specified by this file:
 name = "MacroIsoTrident"
@@ -53,3 +53,72 @@
   "isotrident/nuke.spec",
   "isotrident/cities.spec",
   "isotrident/morecities.spec"
+
+
+; Terrain info - see README.graphics
+
+[terrain_arctic]
+is_blended = 1
+is_layered = 0
+match_type = 0
+
+[terrain_desert]
+is_blended = 1
+is_layered = 0
+match_type = 0
+
+[terrain_forest]
+is_blended = 1
+is_layered = 1
+match_type = 1
+
+[terrain_grassland]
+is_blended = 1
+is_layered = 0
+match_type = 0
+
+[terrain_hills]
+is_blended = 1
+is_layered = 1
+match_type = 2
+
+[terrain_jungle]
+is_blended = 0
+is_layered = 0
+match_type = 0
+
+[terrain_mountains]
+is_blended = 1
+is_layered = 1
+match_type = 3
+
+; ocean has special handling
+[terrain_ocean]
+is_blended = 0
+is_layered = 0
+match_type = 5
+
+[terrain_plains]
+is_blended = 1
+is_layered = 0
+match_type = 0
+
+[terrain_swamp]
+is_blended = 1
+is_layered = 0
+match_type = 0
+
+[terrain_tundra]
+is_blended = 1
+is_layered = 0
+match_type = 0
+
+[terrain_unknown]
+is_blended = 1
+is_layered = 0
+match_type = 0
+
+[terrain_t_river]
+is_blended = 1
+is_layered = 1
+match_type = 5
Index: data/trident.tilespec
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/trident.tilespec,v
retrieving revision 1.15
diff -u -r1.15 trident.tilespec
--- data/trident.tilespec       2003/02/02 00:15:53     1.15
+++ data/trident.tilespec       2004/02/12 08:53:19
@@ -2,7 +2,7 @@
 [tilespec]
 
 ; Format and options of this tilespec file:
-options = "+tilespec2"
+options = "+tilespec2 roadstyle +terrain_grid"
 
 ; A simple name for the tileset specified by this file:
 name = "Trident"
@@ -51,3 +51,72 @@
   "misc/treaty.spec",
   "trident/cities.spec",
   "trident/explosions.spec"
+
+
+; Terrain info - see README.graphics
+
+[terrain_arctic]
+is_blended = 0
+is_layered = 0
+match_type = 1
+
+[terrain_desert]
+is_blended = 0
+is_layered = 0
+match_type = 2
+
+[terrain_forest]
+is_blended = 0
+is_layered = 0
+match_type = 3
+
+[terrain_grassland]
+is_blended = 0
+is_layered = 0
+match_type = 3
+
+[terrain_hills]
+is_blended = 0
+is_layered = 0
+match_type = 4
+
+[terrain_jungle]
+is_blended = 0
+is_layered = 0
+match_type = 5
+
+[terrain_mountains]
+is_blended = 0
+is_layered = 0
+match_type = 6
+
+; ocean has special handling
+[terrain_ocean]
+is_blended = 0
+is_layered = 0
+match_type = 7
+
+[terrain_plains]
+is_blended = 0
+is_layered = 0
+match_type = 8
+
+[terrain_swamp]
+is_blended = 0
+is_layered = 0
+match_type = 9
+
+[terrain_tundra]
+is_blended = 0
+is_layered = 0
+match_type = 10
+
+[terrain_unknown]
+is_blended = 0
+is_layered = 0
+match_type = 11
+
+[terrain_t_river]
+is_blended = 0
+is_layered = 0
+match_type = 7
Index: data/civ1/terrain.ruleset
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/civ1/terrain.ruleset,v
retrieving revision 1.19
diff -u -r1.19 terrain.ruleset
--- data/civ1/terrain.ruleset   2004/01/22 23:52:21     1.19
+++ data/civ1/terrain.ruleset   2004/02/12 08:53:19
@@ -154,7 +154,7 @@
 
 [terrain_arctic]
 terrain_name         = _("Arctic")
-graphic              = "t.arctic"
+graphic              = "arctic"
 graphic_alt         = "-"
 movement_cost        = 2
 defense_bonus        = 10
@@ -192,7 +192,7 @@
 
 [terrain_desert]
 terrain_name         = _("Desert")
-graphic              = "t.desert"
+graphic              = "desert"
 graphic_alt         = "-"
 movement_cost        = 1
 defense_bonus        = 10
@@ -228,7 +228,7 @@
 
 [terrain_forest]
 terrain_name         = _("Forest")
-graphic              = "t.forest"
+graphic              = "forest"
 graphic_alt         = "-"
 movement_cost        = 2
 defense_bonus        = 15
@@ -264,7 +264,7 @@
 
 [terrain_grassland]
 terrain_name         = _("Grassland")
-graphic              = "t.grassland"
+graphic              = "grassland"
 graphic_alt         = "-"
 movement_cost        = 1
 defense_bonus        = 10
@@ -300,7 +300,7 @@
 
 [terrain_hills]
 terrain_name         = _("Hills")
-graphic              = "t.hills"
+graphic              = "hills"
 graphic_alt         = "-"
 movement_cost        = 2
 defense_bonus        = 20
@@ -336,7 +336,7 @@
 
 [terrain_jungle]
 terrain_name         = _("Jungle")
-graphic              = "t.jungle"
+graphic              = "jungle"
 graphic_alt         = "-"
 movement_cost        = 2
 defense_bonus        = 15
@@ -372,7 +372,7 @@
 
 [terrain_mountains]
 terrain_name         = _("Mountains")
-graphic              = "t.mountains"
+graphic              = "mountains"
 graphic_alt         = "-"
 movement_cost        = 3
 defense_bonus        = 30
@@ -408,7 +408,7 @@
 
 [terrain_ocean]
 terrain_name         = _("Ocean")
-graphic              = "t.ocean"
+graphic              = "ocean"
 graphic_alt         = "-"
 movement_cost        = 1
 defense_bonus        = 10
@@ -447,7 +447,7 @@
 
 [terrain_plains]
 terrain_name         = _("Plains")
-graphic              = "t.plains"
+graphic              = "plains"
 graphic_alt         = "-"
 movement_cost        = 1
 defense_bonus        = 10
@@ -484,7 +484,7 @@
 
 [terrain_river]
 terrain_name         = _("River")
-graphic              = "t.t_river"
+graphic              = "t_river"
 graphic_alt         = "-"
 movement_cost        = 1
 defense_bonus        = 15
@@ -524,7 +524,7 @@
 
 [terrain_swamp]
 terrain_name         = _("Swamp")
-graphic              = "t.swamp"
+graphic              = "swamp"
 graphic_alt         = "-"
 movement_cost        = 2
 defense_bonus        = 15
@@ -560,7 +560,7 @@
 
 [terrain_tundra]
 terrain_name         = _("Tundra")
-graphic              = "t.tundra"
+graphic              = "tundra"
 graphic_alt         = "-"
 movement_cost        = 1
 defense_bonus        = 10
Index: data/civ2/terrain.ruleset
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/civ2/terrain.ruleset,v
retrieving revision 1.21
diff -u -r1.21 terrain.ruleset
--- data/civ2/terrain.ruleset   2004/01/22 23:52:21     1.21
+++ data/civ2/terrain.ruleset   2004/02/12 08:53:20
@@ -162,7 +162,7 @@
 
 [terrain_glacier]
 terrain_name         = _("Glacier")
-graphic              = "t.arctic"
+graphic              = "arctic"
 graphic_alt         = "-"
 movement_cost        = 2
 defense_bonus        = 10
@@ -200,7 +200,7 @@
 
 [terrain_desert]
 terrain_name         = _("Desert")
-graphic              = "t.desert"
+graphic              = "desert"
 graphic_alt         = "-"
 movement_cost        = 1
 defense_bonus        = 10
@@ -236,7 +236,7 @@
 
 [terrain_forest]
 terrain_name         = _("Forest")
-graphic              = "t.forest"
+graphic              = "forest"
 graphic_alt         = "-"
 movement_cost        = 2
 defense_bonus        = 15
@@ -272,7 +272,7 @@
 
 [terrain_grassland]
 terrain_name         = _("Grassland")
-graphic              = "t.grassland"
+graphic              = "grassland"
 graphic_alt         = "-"
 movement_cost        = 1
 defense_bonus        = 10
@@ -308,7 +308,7 @@
 
 [terrain_hills]
 terrain_name         = _("Hills")
-graphic              = "t.hills"
+graphic              = "hills"
 graphic_alt         = "-"
 movement_cost        = 2
 defense_bonus        = 20
@@ -344,7 +344,7 @@
 
 [terrain_jungle]
 terrain_name         = _("Jungle")
-graphic              = "t.jungle"
+graphic              = "jungle"
 graphic_alt         = "-"
 movement_cost        = 2
 defense_bonus        = 15
@@ -380,7 +380,7 @@
 
 [terrain_mountains]
 terrain_name         = _("Mountains")
-graphic              = "t.mountains"
+graphic              = "mountains"
 graphic_alt         = "-"
 movement_cost        = 3
 defense_bonus        = 30
@@ -416,7 +416,7 @@
 
 [terrain_ocean]
 terrain_name         = _("Ocean")
-graphic              = "t.ocean"
+graphic              = "ocean"
 graphic_alt         = "-"
 movement_cost        = 1
 defense_bonus        = 10
@@ -455,7 +455,7 @@
 
 [terrain_plains]
 terrain_name         = _("Plains")
-graphic              = "t.plains"
+graphic              = "plains"
 graphic_alt         = "-"
 movement_cost        = 1
 defense_bonus        = 10
@@ -524,7 +524,7 @@
 
 [terrain_swamp]
 terrain_name         = _("Swamp")
-graphic              = "t.swamp"
+graphic              = "swamp"
 graphic_alt         = "-"
 movement_cost        = 2
 defense_bonus        = 15
@@ -560,7 +560,7 @@
 
 [terrain_tundra]
 terrain_name         = _("Tundra")
-graphic              = "t.tundra"
+graphic              = "tundra"
 graphic_alt         = "-"
 movement_cost        = 1
 defense_bonus        = 10
Index: data/default/terrain.ruleset
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/default/terrain.ruleset,v
retrieving revision 1.22
diff -u -r1.22 terrain.ruleset
--- data/default/terrain.ruleset        2004/01/22 23:52:21     1.22
+++ data/default/terrain.ruleset        2004/02/12 08:53:20
@@ -162,7 +162,7 @@
 
 [terrain_glacier]
 terrain_name         = _("Glacier")
-graphic              = "t.arctic"
+graphic              = "arctic"
 graphic_alt         = "-"
 movement_cost        = 2
 defense_bonus        = 10
@@ -200,7 +200,7 @@
 
 [terrain_desert]
 terrain_name         = _("Desert")
-graphic              = "t.desert"
+graphic              = "desert"
 graphic_alt         = "-"
 movement_cost        = 1
 defense_bonus        = 10
@@ -236,7 +236,7 @@
 
 [terrain_forest]
 terrain_name         = _("Forest")
-graphic              = "t.forest"
+graphic              = "forest"
 graphic_alt         = "-"
 movement_cost        = 2
 defense_bonus        = 15
@@ -272,7 +272,7 @@
 
 [terrain_grassland]
 terrain_name         = _("Grassland")
-graphic              = "t.grassland"
+graphic              = "grassland"
 graphic_alt         = "-"
 movement_cost        = 1
 defense_bonus        = 10
@@ -308,7 +308,7 @@
 
 [terrain_hills]
 terrain_name         = _("Hills")
-graphic              = "t.hills"
+graphic              = "hills"
 graphic_alt         = "-"
 movement_cost        = 2
 defense_bonus        = 20
@@ -344,7 +344,7 @@
 
 [terrain_jungle]
 terrain_name         = _("Jungle")
-graphic              = "t.jungle"
+graphic              = "jungle"
 graphic_alt         = "-"
 movement_cost        = 2
 defense_bonus        = 15
@@ -380,7 +380,7 @@
 
 [terrain_mountains]
 terrain_name         = _("Mountains")
-graphic              = "t.mountains"
+graphic              = "mountains"
 graphic_alt         = "-"
 movement_cost        = 3
 defense_bonus        = 30
@@ -416,7 +416,7 @@
 
 [terrain_ocean]
 terrain_name         = _("Ocean")
-graphic              = "t.ocean"
+graphic              = "ocean"
 graphic_alt         = "-"
 movement_cost        = 1
 defense_bonus        = 10
@@ -455,7 +455,7 @@
 
 [terrain_plains]
 terrain_name         = _("Plains")
-graphic              = "t.plains"
+graphic              = "plains"
 graphic_alt         = "-"
 movement_cost        = 1
 defense_bonus        = 10
@@ -524,7 +524,7 @@
 
 [terrain_swamp]
 terrain_name         = _("Swamp")
-graphic              = "t.swamp"
+graphic              = "swamp"
 graphic_alt         = "-"
 movement_cost        = 2
 defense_bonus        = 15
@@ -560,7 +560,7 @@
 
 [terrain_tundra]
 terrain_name         = _("Tundra")
-graphic              = "t.tundra"
+graphic              = "tundra"
 graphic_alt         = "-"
 movement_cost        = 1
 defense_bonus        = 10
Index: data/history/terrain.ruleset
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/history/terrain.ruleset,v
retrieving revision 1.6
diff -u -r1.6 terrain.ruleset
--- data/history/terrain.ruleset        2004/01/22 23:52:21     1.6
+++ data/history/terrain.ruleset        2004/02/12 08:53:20
@@ -162,7 +162,7 @@
 
 [terrain_glacier]
 terrain_name         = _("Glacier")
-graphic              = "t.arctic"
+graphic              = "arctic"
 graphic_alt         = "-"
 movement_cost        = 2
 defense_bonus        = 10
@@ -200,7 +200,7 @@
 
 [terrain_desert]
 terrain_name         = _("Desert")
-graphic              = "t.desert"
+graphic              = "desert"
 graphic_alt         = "-"
 movement_cost        = 1
 defense_bonus        = 10
@@ -236,7 +236,7 @@
 
 [terrain_forest]
 terrain_name         = _("Forest")
-graphic              = "t.forest"
+graphic              = "forest"
 graphic_alt         = "-"
 movement_cost        = 2
 defense_bonus        = 15
@@ -272,7 +272,7 @@
 
 [terrain_grassland]
 terrain_name         = _("Grassland")
-graphic              = "t.grassland"
+graphic              = "grassland"
 graphic_alt         = "-"
 movement_cost        = 1
 defense_bonus        = 10
@@ -308,7 +308,7 @@
 
 [terrain_hills]
 terrain_name         = _("Hills")
-graphic              = "t.hills"
+graphic              = "hills"
 graphic_alt         = "-"
 movement_cost        = 2
 defense_bonus        = 20
@@ -344,7 +344,7 @@
 
 [terrain_jungle]
 terrain_name         = _("Jungle")
-graphic              = "t.jungle"
+graphic              = "jungle"
 graphic_alt         = "-"
 movement_cost        = 2
 defense_bonus        = 15
@@ -380,7 +380,7 @@
 
 [terrain_mountains]
 terrain_name         = _("Mountains")
-graphic              = "t.mountains"
+graphic              = "mountains"
 graphic_alt         = "-"
 movement_cost        = 3
 defense_bonus        = 30
@@ -416,7 +416,7 @@
 
 [terrain_ocean]
 terrain_name         = _("Ocean")
-graphic              = "t.ocean"
+graphic              = "ocean"
 graphic_alt         = "-"
 movement_cost        = 1
 defense_bonus        = 10
@@ -455,7 +455,7 @@
 
 [terrain_plains]
 terrain_name         = _("Plains")
-graphic              = "t.plains"
+graphic              = "plains"
 graphic_alt         = "-"
 movement_cost        = 1
 defense_bonus        = 10
@@ -524,7 +524,7 @@
 
 [terrain_swamp]
 terrain_name         = _("Swamp")
-graphic              = "t.swamp"
+graphic              = "swamp"
 graphic_alt         = "-"
 movement_cost        = 2
 defense_bonus        = 15
@@ -560,7 +560,7 @@
 
 [terrain_tundra]
 terrain_name         = _("Tundra")
-graphic              = "t.tundra"
+graphic              = "tundra"
 graphic_alt         = "-"
 movement_cost        = 1
 defense_bonus        = 10
Index: data/isotrident/terrain1.spec
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/isotrident/terrain1.spec,v
retrieving revision 1.1
diff -u -r1.1 terrain1.spec
--- data/isotrident/terrain1.spec       2002/05/02 05:46:59     1.1
+++ data/isotrident/terrain1.spec       2004/02/12 08:53:20
@@ -33,6 +33,9 @@
   2,    0,  "t.grassland1"
   2,    1, "t.grassland2"
 
+  2,   0, "t.t_river1"
+  2,   1, "t.t_river2"
+
   3,    0, "t.forest1"
   3,    1, "t.forest2"
 
Index: data/isotrident/terrain2.spec
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/isotrident/terrain2.spec,v
retrieving revision 1.1
diff -u -r1.1 terrain2.spec
--- data/isotrident/terrain2.spec       2002/05/02 05:47:02     1.1
+++ data/isotrident/terrain2.spec       2004/02/12 08:53:20
@@ -42,62 +42,81 @@
  3,  6, "tx.s_river_n0s1e1w1"
  3,  7, "tx.s_river_n1s1e1w1"
 
+; Rivers as overlay
+
+ 2,  0, "t.t_river_n0s0e0w0"
+ 2,  1, "t.t_river_n1s0e0w0"
+ 2,  2, "t.t_river_n0s0e1w0"
+ 2,  3, "t.t_river_n1s0e1w0"
+ 2,  4, "t.t_river_n0s1e0w0"
+ 2,  5, "t.t_river_n1s1e0w0"
+ 2,  6, "t.t_river_n0s1e1w0"
+ 2,  7, "t.t_river_n1s1e1w0"
+ 3,  0, "t.t_river_n0s0e0w1"
+ 3,  1, "t.t_river_n1s0e0w1"
+ 3,  2, "t.t_river_n0s0e1w1"
+ 3,  3, "t.t_river_n1s0e1w1"
+ 3,  4, "t.t_river_n0s1e0w1"
+ 3,  5, "t.t_river_n1s1e0w1"
+ 3,  6, "t.t_river_n0s1e1w1"
+ 3,  7, "t.t_river_n1s1e1w1"
+
 ;forrests as overlay
 
- 4,  0, "tx.s_forest_n0s0e0w0"
- 4,  1, "tx.s_forest_n1s0e0w0"
- 4,  2, "tx.s_forest_n0s0e1w0"
- 4,  3, "tx.s_forest_n1s0e1w0"
- 4,  4, "tx.s_forest_n0s1e0w0"
- 4,  5, "tx.s_forest_n1s1e0w0"
- 4,  6, "tx.s_forest_n0s1e1w0"
- 4,  7, "tx.s_forest_n1s1e1w0"
- 5,  0, "tx.s_forest_n0s0e0w1"
- 5,  1, "tx.s_forest_n1s0e0w1"
- 5,  2, "tx.s_forest_n0s0e1w1"
- 5,  3, "tx.s_forest_n1s0e1w1"
- 5,  4, "tx.s_forest_n0s1e0w1"
- 5,  5, "tx.s_forest_n1s1e0w1"
- 5,  6, "tx.s_forest_n0s1e1w1"
- 5,  7, "tx.s_forest_n1s1e1w1"
+ 4,  0, "t.forest_n0s0e0w0"
+ 4,  1, "t.forest_n1s0e0w0"
+ 4,  2, "t.forest_n0s0e1w0"
+ 4,  3, "t.forest_n1s0e1w0"
+ 4,  4, "t.forest_n0s1e0w0"
+ 4,  5, "t.forest_n1s1e0w0"
+ 4,  6, "t.forest_n0s1e1w0"
+ 4,  7, "t.forest_n1s1e1w0"
+ 5,  0, "t.forest_n0s0e0w1"
+ 5,  1, "t.forest_n1s0e0w1"
+ 5,  2, "t.forest_n0s0e1w1"
+ 5,  3, "t.forest_n1s0e1w1"
+ 5,  4, "t.forest_n0s1e0w1"
+ 5,  5, "t.forest_n1s1e0w1"
+ 5,  6, "t.forest_n0s1e1w1"
+ 5,  7, "t.forest_n1s1e1w1"
 
 ;mountains as overlay
 
- 6,  0, "tx.s_mountain_n0s0e0w0"
- 6,  1, "tx.s_mountain_n1s0e0w0"
- 6,  2, "tx.s_mountain_n0s0e1w0"
- 6,  3, "tx.s_mountain_n1s0e1w0"
- 6,  4, "tx.s_mountain_n0s1e0w0"
- 6,  5, "tx.s_mountain_n1s1e0w0"
- 6,  6, "tx.s_mountain_n0s1e1w0"
- 6,  7, "tx.s_mountain_n1s1e1w0"
- 7,  0, "tx.s_mountain_n0s0e0w1"
- 7,  1, "tx.s_mountain_n1s0e0w1"
- 7,  2, "tx.s_mountain_n0s0e1w1"
- 7,  3, "tx.s_mountain_n1s0e1w1"
- 7,  4, "tx.s_mountain_n0s1e0w1"
- 7,  5, "tx.s_mountain_n1s1e0w1"
- 7,  6, "tx.s_mountain_n0s1e1w1"
- 7,  7, "tx.s_mountain_n1s1e1w1"
+ 6,  0, "t.mountains_n0s0e0w0"
+ 6,  1, "t.mountains_n1s0e0w0"
+ 6,  2, "t.mountains_n0s0e1w0"
+ 6,  3, "t.mountains_n1s0e1w0"
+ 6,  4, "t.mountains_n0s1e0w0"
+ 6,  5, "t.mountains_n1s1e0w0"
+ 6,  6, "t.mountains_n0s1e1w0"
+ 6,  7, "t.mountains_n1s1e1w0"
+ 7,  0, "t.mountains_n0s0e0w1"
+ 7,  1, "t.mountains_n1s0e0w1"
+ 7,  2, "t.mountains_n0s0e1w1"
+ 7,  3, "t.mountains_n1s0e1w1"
+ 7,  4, "t.mountains_n0s1e0w1"
+ 7,  5, "t.mountains_n1s1e0w1"
+ 7,  6, "t.mountains_n0s1e1w1"
+ 7,  7, "t.mountains_n1s1e1w1"
 
 ;hills as overlay
 
- 8,  0, "tx.s_hill_n0s0e0w0"
- 8,  1, "tx.s_hill_n1s0e0w0"
- 8,  2, "tx.s_hill_n0s0e1w0"
- 8,  3, "tx.s_hill_n1s0e1w0"
- 8,  4, "tx.s_hill_n0s1e0w0"
- 8,  5, "tx.s_hill_n1s1e0w0"
- 8,  6, "tx.s_hill_n0s1e1w0"
- 8,  7, "tx.s_hill_n1s1e1w0"
- 9,  0, "tx.s_hill_n0s0e0w1"
- 9,  1, "tx.s_hill_n1s0e0w1"
- 9,  2, "tx.s_hill_n0s0e1w1"
- 9,  3, "tx.s_hill_n1s0e1w1"
- 9,  4, "tx.s_hill_n0s1e0w1"
- 9,  5, "tx.s_hill_n1s1e0w1"
- 9,  6, "tx.s_hill_n0s1e1w1"
- 9,  7, "tx.s_hill_n1s1e1w1"
+ 8,  0, "t.hills_n0s0e0w0"
+ 8,  1, "t.hills_n1s0e0w0"
+ 8,  2, "t.hills_n0s0e1w0"
+ 8,  3, "t.hills_n1s0e1w0"
+ 8,  4, "t.hills_n0s1e0w0"
+ 8,  5, "t.hills_n1s1e0w0"
+ 8,  6, "t.hills_n0s1e1w0"
+ 8,  7, "t.hills_n1s1e1w0"
+ 9,  0, "t.hills_n0s0e0w1"
+ 9,  1, "t.hills_n1s0e0w1"
+ 9,  2, "t.hills_n0s0e1w1"
+ 9,  3, "t.hills_n1s0e1w1"
+ 9,  4, "t.hills_n0s1e0w1"
+ 9,  5, "t.hills_n1s1e0w1"
+ 9,  6, "t.hills_n0s1e1w1"
+ 9,  7, "t.hills_n1s1e1w1"
 
 ;river outlets
 
Index: doc/README.graphics
===================================================================
RCS file: /home/freeciv/CVS/freeciv/doc/README.graphics,v
retrieving revision 1.7
diff -u -r1.7 README.graphics
--- doc/README.graphics 2003/10/22 06:09:02     1.7
+++ doc/README.graphics 2004/02/12 08:53:20
@@ -98,12 +98,89 @@
   Booleans (0 or 1)
   -----------------
   is_isometric          : set to 1 for an iso-view tileset
-  is_mountainous        : do hills and mountains blend together?
 
   String lists (a comma-separated list of strings)
   ------------------------------------------------
   files                 : A list of .spec files to scan for sprites.
                           See "individual spec files", below.
+
+
+----------------------------------------------------------------------
+Terrain options:
+----------------
+
+The top-level tilespec file also contains information on how to draw each
+terrain type.  For each terrain type include a section "terrain_<terrain>"
+(e.g., "terrain_plains").  This section contains information on how to draw
+this terrain type.  (The terrain types are specified in the server ruleset
+file under the graphc and graphic_alt flags.)
+
+  Fields and Flags
+  ----------------
+  is_blended            : If set, this terrain will be blended with adjacent
+                          terrains.  Blending is done civ2-style with a
+                          dither mask.  Only iso-view currently supports
+                          blending.  Only the base graphic will be dithered.
+                          The blending mask has sprite t.dither_tile.
+  is_layered            : If set, this terrain will be drawn layered.  The
+                          base sprite will be drawn underneath (possibly
+                          blended) with a matched sprite on top.  This option
+                          only makes sense if a match_type is set.  Only
+                          iso-view currently supports layering.
+  match_type            : If 0, no terrain matching will be done and the base
+                          sprite will be drawn for the terrain.  If non-zero,
+                          then terrain matching will be done.  A matched
+                          sprite will be chosen that matches all cardinally
+                          adjacent tiles whose terrain has the same
+                          match_type.
+ 
+  Sprites
+  -------
+
+  Depending on the information given here the tileset must contain certain
+  sprites.
+ 
+  base sprite           : If the terrain has no match type or is layered, a
+                          base sprite is needed.  This sprite has tag
+                          "t.<terrain>1" (e.g., "t.grassland1").
+  matched sprites       : If the terrain has a match type or is layered, a
+                          set of matched sprites is needed.  This consists of
+                          16 sprites with tags "t.<terrain>_n<V>s<V>e<V>w<V>"
+                          (e.g., "t.hills_n0s0e1w0".  Each direcional value
+                          <V> is either 0 or 1.  Note that the directions are
+                          in map coordinates, so n (north) in iso-view is
+                          northeast on the mapview.
+
+Examples:
+
+  ; This specifies a civ2-like grassland tile.  A single sprite
+  ; t.grassland is needed; it will be drawn blended.
+  [terrain_grassland]
+  is_blended = 1
+  is_layered = 0
+  match_type = 0
+
+  ; This specifies a civ1-like mountain tile.  16 sprites
+  ; t.mountains_n0s0e0w0 ... t.mountains_n1s1e1w1 are needed.  One of them
+  ; will be drawn to match the adjacent tiles.  Assuming only mountains
+  ; has this match_type, adjacent mountains will match.
+  [terrain_mountains]
+  is_blended = 0
+  is_layered = 0
+  match_type = 7
+
+  ; This specifies a civ2-like hills tile.  A base sprite t.hills will be
+  ; needed, plus 16 matching sprites.  The base sprite will be drawn,
+  ; dithered with adjacent base sprites, and the matching sprite will be
+  ; drawn on top.  (In most civ2 tilesets the base sprite is the grassland
+  ; sprite).
+  [terrain_hills]
+  is_blended = 1
+  is_layered = 1
+  match_type = 8
+
+The exception to the above rule is the ocean terrain.  Although it should
+have an entry in the tilespec file it is drawn according to hard-coded rules.
 
 ----------------------------------------------------------------------
 Individual spec files:

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