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

[Freeciv-Dev] (PR#7261) restructure tileset to avoid explicit terrain me

[Top] [All Lists]

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

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

One problem with changing the tileset code at all is that there are too 
many special cases.  Most of these are related to terrain types.  Some 
examples:

1. In orthogonal view all terrains are drawn as a single blended sprite. 
  Simple!

2. In iso-view hills, mountains, and forests are treated separately. 
They are drawn as a dithered base terrain (grassland) with a blended 
special terrain on top.  All other terrains except ocean and river are 
drawn as a single dithered sprite.

3. In iso-view river is drawn as a grassland with an S_RIVER sprite on 
top.  Orthogonal view has separate T_RIVER tiles (which blend together 
with ocean, although ocean doesn't blend with them).  (River terrain is 
only present in the civ1 ruleset.)

4. In iso-view the coast is drawn using separate coastal sprites.  Each 
coastline area is assembled from 4 different subrectangular sprites.

5. Mines on hills and mountains use a different sprite from those on 
desert and glacier.

Making any changes to the drawing code is hard.  But making any changes 
to the terrain types is even harder.  There's no way to put support for 
such changes into the tileset, they have to go into tilespec.c.

We discussed this a while ago, when Raimar and I agreed this is purely a 
tilespec issue; it shouldn't involve the server-side ruleset.  So after 
some though I have a design (and preliminary patch) to move toward this 
goal.

- Currently for each terrain the ruleset specifies a sprite tag and 
alternate, like "t.arctic" or "t.forest".  The tileset uses this in its 
own special-casing way, loading the "t.arctic" flag and the 
"tx.s_forest_n0s0e0w0" sprites.  Under my design, the server just gives 
the client a terrain name and alternate to use for this terrain.  The 
(imaginary) association with actual sprite names is dropped, and it's 
left up to the client to determine how the drawing is done.

For instance the "Forest" terrain will specify "forest" as its terrain, 
with no alternate.  Under a different ruleset the "Dark forest" terrain 
could have "mirkwood" as its terrain with "forest" as the alternate. 
The client will know how to draw both mirkwood and forest - possibly not 
in the same way.

- The tilespec file will provide a list of supported terrains: "arctic", 
"forest", "mirkwood", etc.  For each terrain it gives information on how 
to draw this terrain.  This is in the top-level tilespec file: it is 
read when the tileset is first loaded, and only when the ruleset data 
arrives are tilespec terrains associated with ruleset terrains.

- All terrains are handled with the same type of code, with as few 
special-cases as possible.  Ultimately any special-cases that do exist 
should refer to general terrain characteristics (like is_ocean) rather 
than specific ones (like T_RIVER).  The current form of the patch 
removes the special-casing of blending, dithering, and layering 
(basically points 1-2 above).

Specifically, for each terrain we specify:

- Whether it uses dithering.
- Whether it uses layering.
- Whether it uses blending, and if so which terrains it should be 
blended with.

The tilespec code knows how to interpret these options.  It loads 
different sprites and draws a different way based on how they're set. 
But the tileset author should have a fair amount of leeway to change 
these options without any code changes.  Certainly this is incomplete, 
however: for instance dithering is currently tied to iso-view.

In future this can be extended: first so that other special-cases are 
handled in the tileset rather than in the code, and secondly to allow 
new methods of drawing (like civ3's or Daniel/Rafal's cell-based drawing 
methods).

Please comment on design or implementation.

jason

Index: client/tilespec.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/tilespec.c,v
retrieving revision 1.136
diff -u -r1.136 tilespec.c
--- client/tilespec.c   2004/01/16 16:01:25     1.136
+++ client/tilespec.c   2004/01/18 03:14:40
@@ -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;
 
@@ -133,6 +132,7 @@
  * This hash table maps tilespec tags to struct small_sprites.
  */
 static struct hash_table *sprite_hash = NULL;
+static struct hash_table *terrain_hash;
 
 #define TILESPEC_CAPSTR "+tilespec2 duplicates_ok roadstyle"
 /*
@@ -265,6 +265,8 @@
 ***********************************************************************/
 static void tilespec_free_toplevel(void)
 {
+  int entries;
+
   if (city_names_font) {
     free(city_names_font);
     city_names_font = NULL;
@@ -281,6 +283,16 @@
     free(minimap_intro_filename);
     minimap_intro_filename = NULL;
   }
+
+  for (entries = hash_num_entries(terrain_hash); entries > 0; entries--) {
+    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);
 }
 
 /**********************************************************************
@@ -580,8 +592,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 +647,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 +670,37 @@
   minimap_intro_filename = tilespec_gfx_filename(c);
   freelog(LOG_DEBUG, "radar file %s", minimap_intro_filename);
 
+
+  /* Terrain drawing info. */
+  terrains = secfile_lookup_str_vec(file, &num_terrains,
+                                   "terrain.types");
+  if (num_terrains == 0) {
+    freelog(LOG_FATAL, "No terrain types supported by tileset.");
+    exit(EXIT_FAILURE);
+  }
+
+  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]);
+    terr->is_dithered = secfile_lookup_bool(file, "terrain.%s_dither",
+                                           terrains[i]);
+    terr->is_layered = secfile_lookup_bool(file, "terrain.%s_layered",
+                                          terrains[i]);
+    terr->blend_type = secfile_lookup_int(file, "terrain.%s_blend_type",
+                                         terrains[i]);
+
+    if (!hash_insert(terrain_hash, terr->name, terr)) {
+      freelog(LOG_ERROR, "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) {
@@ -668,6 +709,7 @@
   }
 
   sprite_hash = hash_new(hash_fval_string, hash_fcmp_string);
+
   specfile_list_init(&specfiles);
   for (i = 0; i < num_spec_files; i++) {
     struct specfile *sf = fc_malloc(sizeof(*sf));
@@ -986,21 +1028,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 +1159,67 @@
   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(-1);
     }
-  } 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);
+  if (draw->blend_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->blend_type != 0) {
+    /* Load 16 cardinally-blended sprites. */
+    for (i = 0; i < NUM_DIRECTION_NSEW; i++) {
+      nsew = nsew_str(i);
 
-      assert(tt->sprite[i] != NULL);
+      my_snprintf(buffer1, sizeof(buffer1), "t.%s_%s", draw->name, nsew);
+      draw->blend[i] = lookup_sprite_tag_alt(buffer1, "", TRUE,
+                                            "tile_type", tt->terrain_name);
+      assert(draw->blend[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);
+      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;
 }
 
 /**********************************************************************
@@ -1534,7 +1569,7 @@
   if (ttype_other == T_UNKNOWN)
     return sprites.black_tile;
 
-  if (is_ocean(ttype) || ttype == T_JUNGLE) {
+  if (!sprites.terrain[ttype]->is_dithered) {
     return NULL;
   }
 
@@ -1542,30 +1577,9 @@
     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 sprites.terrain[ttype_other]->base;
 }
 
-/**********************************************************************
-  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;
-  }
-}
-
 /**************************************************************************
   Add any corner road sprites to the sprite array.
 **************************************************************************/
@@ -1898,43 +1912,19 @@
        }
       }
     } 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]->blend_type == 0
+         || sprites.terrain[ttype]->is_layered) {
+       ADD_SPRITE_SIMPLE(sprites.terrain[ttype]->base);
+      } else {
+       int blend_type = sprites.terrain[ttype]->blend_type;
 
-       default:
-       break;
+#define BLEND(dir) (sprites.terrain[ttype_near[(dir)]]->blend_type)
+       tileno = INDEX_NSEW(BLEND(DIR8_NORTH) == blend_type,
+                           BLEND(DIR8_SOUTH) == blend_type,
+                           BLEND(DIR8_EAST) == blend_type,
+                           BLEND(DIR8_WEST) == blend_type);
+       ADD_SPRITE_SIMPLE(sprites.terrain[ttype]->blend[tileno]);
+#undef BLEND
       }
 
       sprs += fill_irrigation_sprite_array(sprs, tspecial, tspecial_near,
@@ -1984,9 +1974,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]);
       }
     }
     
@@ -1996,9 +1986,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]);
       }
     }
   
@@ -2126,17 +2116,19 @@
      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]));
+    if (sprites.terrain[ttype]->blend_type == 0) {
+      mysprite = sprites.terrain[ttype]->base;
+    } else {
+      int blend_type = sprites.terrain[ttype]->blend_type;
+
+#define BLEND(dir) (sprites.terrain[ttype_near[(dir)]]->blend_type)
+      tileno = INDEX_NSEW(BLEND(DIR8_NORTH) == blend_type,
+                         BLEND(DIR8_SOUTH) == blend_type,
+                         BLEND(DIR8_EAST) == blend_type,
+                         BLEND(DIR8_WEST) == blend_type);
+      mysprite = sprites.terrain[ttype]->blend[tileno];
+#undef BLEND
     }
-    mysprite = get_tile_type(ttype)->sprite[tileno];
   }
 
   if (draw_terrain)
@@ -2187,9 +2179,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/01/18 03:14:40
@@ -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_dithered;
+  bool is_layered;
+  int blend_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/map.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/map.h,v
retrieving revision 1.167
diff -u -r1.167 map.h
--- common/map.h        2004/01/17 17:21:20     1.167
+++ common/map.h        2004/01/18 03:14:40
@@ -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
@@ -86,7 +82,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;
@@ -112,7 +107,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.8
diff -u -r1.8 terrain.h
--- common/terrain.h    2004/01/17 17:21:20     1.8
+++ common/terrain.h    2004/01/18 03:14:40
@@ -70,6 +70,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/01/18 03:14:40
@@ -53,3 +53,61 @@
   "isotrident/nuke.spec",
   "isotrident/cities.spec",
   "isotrident/morecities.spec"
+
+[terrain]
+
+types = "arctic", "desert", "forest", "grassland", "hills", "jungle",
+        "mountains", "ocean", "plains", "swamp", "tundra",
+        "unknown", "t_river"
+
+arctic_dither = 1
+arctic_layered = 0
+arctic_blend_type = 0
+
+desert_dither = 1
+desert_layered = 0
+desert_blend_type = 0
+
+forest_dither = 1
+forest_layered = 1
+forest_blend_type = 1
+
+grassland_dither = 1
+grassland_layered = 0
+grassland_blend_type = 0
+
+hills_dither = 1
+hills_layered = 1
+hills_blend_type = 2
+
+jungle_dither = 0
+jungle_layered = 0
+jungle_blend_type = 0
+
+mountains_dither = 1
+mountains_layered = 1
+mountains_blend_type = 3
+
+ocean_dither = 0
+ocean_layered = 0
+ocean_blend_type = 0
+
+plains_dither = 1
+plains_layered = 0
+plains_blend_type = 0
+
+swamp_dither = 1
+swamp_layered = 0
+swamp_blend_type = 0
+
+tundra_dither = 1
+tundra_layered = 0
+tundra_blend_type = 0
+
+unknown_dither = 1
+unknown_layered = 0
+unknown_blend_type = 0
+
+t_river_dither = 1
+t_river_layered = 1
+t_river_blend_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/01/18 03:14:40
@@ -51,3 +51,61 @@
   "misc/treaty.spec",
   "trident/cities.spec",
   "trident/explosions.spec"
+
+[terrain]
+
+types = "arctic", "desert", "forest", "grassland", "hills", "jungle",
+        "mountains", "ocean", "plains", "swamp", "tundra",
+        "unknown", "t_river"
+
+arctic_dither = 0
+arctic_layered = 0
+arctic_blend_type = 1
+
+desert_dither = 0
+desert_layered = 0
+desert_blend_type = 2
+
+forest_dither = 0
+forest_layered = 0
+forest_blend_type = 3
+
+grassland_dither = 0
+grassland_layered = 0
+grassland_blend_type = 3
+
+hills_dither = 0
+hills_layered = 0
+hills_blend_type = 4
+
+jungle_dither = 0
+jungle_layered = 0
+jungle_blend_type = 5
+
+mountains_dither = 0
+mountains_layered = 0
+mountains_blend_type = 6
+
+ocean_dither = 0
+ocean_layered = 0
+ocean_blend_type = 7
+
+plains_dither = 0
+plains_layered = 0
+plains_blend_type = 8
+
+swamp_dither = 0
+swamp_layered = 0
+swamp_blend_type = 9
+
+tundra_dither = 0
+tundra_layered = 0
+tundra_blend_type = 10
+
+unknown_dither = 0
+unknown_layered = 0
+unknown_blend_type = 11
+
+t_river_dither = 0
+t_river_layered = 0
+t_river_blend_type = 7
Index: data/civ1/terrain.ruleset
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/civ1/terrain.ruleset,v
retrieving revision 1.15
diff -u -r1.15 terrain.ruleset
--- data/civ1/terrain.ruleset   2003/10/02 17:54:57     1.15
+++ data/civ1/terrain.ruleset   2004/01/18 03:14:40
@@ -142,7 +142,7 @@
 
 [terrain_arctic]
 terrain_name         = _("Arctic")
-graphic              = "t.arctic"
+graphic              = "arctic"
 graphic_alt         = "-"
 movement_cost        = 2
 defense_bonus        = 10
@@ -180,7 +180,7 @@
 
 [terrain_desert]
 terrain_name         = _("Desert")
-graphic              = "t.desert"
+graphic              = "desert"
 graphic_alt         = "-"
 movement_cost        = 1
 defense_bonus        = 10
@@ -216,7 +216,7 @@
 
 [terrain_forest]
 terrain_name         = _("Forest")
-graphic              = "t.forest"
+graphic              = "forest"
 graphic_alt         = "-"
 movement_cost        = 2
 defense_bonus        = 15
@@ -252,7 +252,7 @@
 
 [terrain_grassland]
 terrain_name         = _("Grassland")
-graphic              = "t.grassland"
+graphic              = "grassland"
 graphic_alt         = "-"
 movement_cost        = 1
 defense_bonus        = 10
@@ -287,7 +287,7 @@
 
 [terrain_hills]
 terrain_name         = _("Hills")
-graphic              = "t.hills"
+graphic              = "hills"
 graphic_alt         = "-"
 movement_cost        = 2
 defense_bonus        = 20
@@ -323,7 +323,7 @@
 
 [terrain_jungle]
 terrain_name         = _("Jungle")
-graphic              = "t.jungle"
+graphic              = "jungle"
 graphic_alt         = "-"
 movement_cost        = 2
 defense_bonus        = 15
@@ -359,7 +359,7 @@
 
 [terrain_mountains]
 terrain_name         = _("Mountains")
-graphic              = "t.mountains"
+graphic              = "mountains"
 graphic_alt         = "-"
 movement_cost        = 3
 defense_bonus        = 30
@@ -395,7 +395,7 @@
 
 [terrain_ocean]
 terrain_name         = _("Ocean")
-graphic              = "t.ocean"
+graphic              = "ocean"
 graphic_alt         = "-"
 movement_cost        = 1
 defense_bonus        = 10
@@ -433,7 +433,7 @@
 
 [terrain_plains]
 terrain_name         = _("Plains")
-graphic              = "t.plains"
+graphic              = "plains"
 graphic_alt         = "-"
 movement_cost        = 1
 defense_bonus        = 10
@@ -469,7 +469,7 @@
 
 [terrain_river]
 terrain_name         = _("River")
-graphic              = "t.t_river"
+graphic              = "t_river"
 graphic_alt         = "-"
 movement_cost        = 1
 defense_bonus        = 15
@@ -508,7 +508,7 @@
 
 [terrain_swamp]
 terrain_name         = _("Swamp")
-graphic              = "t.swamp"
+graphic              = "swamp"
 graphic_alt         = "-"
 movement_cost        = 2
 defense_bonus        = 15
@@ -544,7 +544,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.17
diff -u -r1.17 terrain.ruleset
--- data/civ2/terrain.ruleset   2003/10/02 17:54:57     1.17
+++ data/civ2/terrain.ruleset   2004/01/18 03:14:40
@@ -150,7 +150,7 @@
 
 [terrain_glacier]
 terrain_name         = _("Glacier")
-graphic              = "t.arctic"
+graphic              = "arctic"
 graphic_alt         = "-"
 movement_cost        = 2
 defense_bonus        = 10
@@ -188,7 +188,7 @@
 
 [terrain_desert]
 terrain_name         = _("Desert")
-graphic              = "t.desert"
+graphic              = "desert"
 graphic_alt         = "-"
 movement_cost        = 1
 defense_bonus        = 10
@@ -224,7 +224,7 @@
 
 [terrain_forest]
 terrain_name         = _("Forest")
-graphic              = "t.forest"
+graphic              = "forest"
 graphic_alt         = "-"
 movement_cost        = 2
 defense_bonus        = 15
@@ -260,7 +260,7 @@
 
 [terrain_grassland]
 terrain_name         = _("Grassland")
-graphic              = "t.grassland"
+graphic              = "grassland"
 graphic_alt         = "-"
 movement_cost        = 1
 defense_bonus        = 10
@@ -295,7 +295,7 @@
 
 [terrain_hills]
 terrain_name         = _("Hills")
-graphic              = "t.hills"
+graphic              = "hills"
 graphic_alt         = "-"
 movement_cost        = 2
 defense_bonus        = 20
@@ -331,7 +331,7 @@
 
 [terrain_jungle]
 terrain_name         = _("Jungle")
-graphic              = "t.jungle"
+graphic              = "jungle"
 graphic_alt         = "-"
 movement_cost        = 2
 defense_bonus        = 15
@@ -367,7 +367,7 @@
 
 [terrain_mountains]
 terrain_name         = _("Mountains")
-graphic              = "t.mountains"
+graphic              = "mountains"
 graphic_alt         = "-"
 movement_cost        = 3
 defense_bonus        = 30
@@ -403,7 +403,7 @@
 
 [terrain_ocean]
 terrain_name         = _("Ocean")
-graphic              = "t.ocean"
+graphic              = "ocean"
 graphic_alt         = "-"
 movement_cost        = 1
 defense_bonus        = 10
@@ -441,7 +441,7 @@
 
 [terrain_plains]
 terrain_name         = _("Plains")
-graphic              = "t.plains"
+graphic              = "plains"
 graphic_alt         = "-"
 movement_cost        = 1
 defense_bonus        = 10
@@ -509,7 +509,7 @@
 
 [terrain_swamp]
 terrain_name         = _("Swamp")
-graphic              = "t.swamp"
+graphic              = "swamp"
 graphic_alt         = "-"
 movement_cost        = 2
 defense_bonus        = 15
@@ -545,7 +545,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.18
diff -u -r1.18 terrain.ruleset
--- data/default/terrain.ruleset        2003/10/02 17:54:57     1.18
+++ data/default/terrain.ruleset        2004/01/18 03:14:40
@@ -150,7 +150,7 @@
 
 [terrain_glacier]
 terrain_name         = _("Glacier")
-graphic              = "t.arctic"
+graphic              = "arctic"
 graphic_alt         = "-"
 movement_cost        = 2
 defense_bonus        = 10
@@ -188,7 +188,7 @@
 
 [terrain_desert]
 terrain_name         = _("Desert")
-graphic              = "t.desert"
+graphic              = "desert"
 graphic_alt         = "-"
 movement_cost        = 1
 defense_bonus        = 10
@@ -224,7 +224,7 @@
 
 [terrain_forest]
 terrain_name         = _("Forest")
-graphic              = "t.forest"
+graphic              = "forest"
 graphic_alt         = "-"
 movement_cost        = 2
 defense_bonus        = 15
@@ -260,7 +260,7 @@
 
 [terrain_grassland]
 terrain_name         = _("Grassland")
-graphic              = "t.grassland"
+graphic              = "grassland"
 graphic_alt         = "-"
 movement_cost        = 1
 defense_bonus        = 10
@@ -295,7 +295,7 @@
 
 [terrain_hills]
 terrain_name         = _("Hills")
-graphic              = "t.hills"
+graphic              = "hills"
 graphic_alt         = "-"
 movement_cost        = 2
 defense_bonus        = 20
@@ -331,7 +331,7 @@
 
 [terrain_jungle]
 terrain_name         = _("Jungle")
-graphic              = "t.jungle"
+graphic              = "jungle"
 graphic_alt         = "-"
 movement_cost        = 2
 defense_bonus        = 15
@@ -367,7 +367,7 @@
 
 [terrain_mountains]
 terrain_name         = _("Mountains")
-graphic              = "t.mountains"
+graphic              = "mountains"
 graphic_alt         = "-"
 movement_cost        = 3
 defense_bonus        = 30
@@ -403,7 +403,7 @@
 
 [terrain_ocean]
 terrain_name         = _("Ocean")
-graphic              = "t.ocean"
+graphic              = "ocean"
 graphic_alt         = "-"
 movement_cost        = 1
 defense_bonus        = 10
@@ -441,7 +441,7 @@
 
 [terrain_plains]
 terrain_name         = _("Plains")
-graphic              = "t.plains"
+graphic              = "plains"
 graphic_alt         = "-"
 movement_cost        = 1
 defense_bonus        = 10
@@ -509,7 +509,7 @@
 
 [terrain_swamp]
 terrain_name         = _("Swamp")
-graphic              = "t.swamp"
+graphic              = "swamp"
 graphic_alt         = "-"
 movement_cost        = 2
 defense_bonus        = 15
@@ -545,7 +545,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.2
diff -u -r1.2 terrain.ruleset
--- data/history/terrain.ruleset        2003/10/02 17:54:58     1.2
+++ data/history/terrain.ruleset        2004/01/18 03:14:41
@@ -150,7 +150,7 @@
 
 [terrain_glacier]
 terrain_name         = _("Glacier")
-graphic              = "t.arctic"
+graphic              = "arctic"
 graphic_alt         = "-"
 movement_cost        = 2
 defense_bonus        = 10
@@ -188,7 +188,7 @@
 
 [terrain_desert]
 terrain_name         = _("Desert")
-graphic              = "t.desert"
+graphic              = "desert"
 graphic_alt         = "-"
 movement_cost        = 1
 defense_bonus        = 10
@@ -224,7 +224,7 @@
 
 [terrain_forest]
 terrain_name         = _("Forest")
-graphic              = "t.forest"
+graphic              = "forest"
 graphic_alt         = "-"
 movement_cost        = 2
 defense_bonus        = 15
@@ -260,7 +260,7 @@
 
 [terrain_grassland]
 terrain_name         = _("Grassland")
-graphic              = "t.grassland"
+graphic              = "grassland"
 graphic_alt         = "-"
 movement_cost        = 1
 defense_bonus        = 10
@@ -295,7 +295,7 @@
 
 [terrain_hills]
 terrain_name         = _("Hills")
-graphic              = "t.hills"
+graphic              = "hills"
 graphic_alt         = "-"
 movement_cost        = 2
 defense_bonus        = 20
@@ -331,7 +331,7 @@
 
 [terrain_jungle]
 terrain_name         = _("Jungle")
-graphic              = "t.jungle"
+graphic              = "jungle"
 graphic_alt         = "-"
 movement_cost        = 2
 defense_bonus        = 15
@@ -367,7 +367,7 @@
 
 [terrain_mountains]
 terrain_name         = _("Mountains")
-graphic              = "t.mountains"
+graphic              = "mountains"
 graphic_alt         = "-"
 movement_cost        = 3
 defense_bonus        = 30
@@ -403,7 +403,7 @@
 
 [terrain_ocean]
 terrain_name         = _("Ocean")
-graphic              = "t.ocean"
+graphic              = "ocean"
 graphic_alt         = "-"
 movement_cost        = 1
 defense_bonus        = 10
@@ -441,7 +441,7 @@
 
 [terrain_plains]
 terrain_name         = _("Plains")
-graphic              = "t.plains"
+graphic              = "plains"
 graphic_alt         = "-"
 movement_cost        = 1
 defense_bonus        = 10
@@ -509,7 +509,7 @@
 
 [terrain_swamp]
 terrain_name         = _("Swamp")
-graphic              = "t.swamp"
+graphic              = "swamp"
 graphic_alt         = "-"
 movement_cost        = 2
 defense_bonus        = 15
@@ -545,7 +545,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/01/18 03:14:41
@@ -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/01/18 03:14:41
@@ -44,60 +44,60 @@
 
 ;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
 

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#7261) restructure tileset to avoid explicit terrain mention, Jason Short <=