<URL: http://bugs.freeciv.org/Ticket/Display.html?id=39381 >

Here is my first pass at the reintegrated patches.  It runs.  Not yet
extensively tested.  My new code will take an old savefile and add four
kinds of water: lake, coast, shelf, and floor.  Shelf and floor only
display as deep (so far).

Still, it's something to test!

Index: server/maphand.c
===================================================================
--- server/maphand.c    (revision 12966)
+++ server/maphand.c    (working copy)
@@ -120,6 +120,108 @@
 }
 
 /**************************************************************************
+  Regenerate bare ocean tiles with coasts, lakes, and deeper oceans
+**************************************************************************/
+static void regenerate_water(void)
+{
+  struct terrain *lake = get_terrain_by_identifier(LAKE_TERRAIN_IDENTIFIER);
+  struct terrain *coast = get_terrain_by_identifier(COAST_TERRAIN_IDENTIFIER);
+  struct terrain *shelf = get_terrain_by_identifier(SHELF_TERRAIN_IDENTIFIER);
+  struct terrain *floor = get_terrain_by_identifier(FLOOR_TERRAIN_IDENTIFIER);
+
+  /* coasts and lakes */
+  whole_map_iterate(ptile) {
+    Continent_id here = tile_get_continent(ptile);
+
+    if (T_UNKNOWN == ptile->terrain)
+      continue;
+
+    if (WATER_TERRAIN_IDENTIFIER != ptile->terrain->identifier)
+      continue;
+
+    if (0 < lake_surrounders[-here]) {
+      tile_set_terrain(ptile,lake);
+      continue;
+    }
+
+    adjc_iterate(ptile, tile2) {
+      if (T_UNKNOWN == tile2->terrain)
+        continue;
+
+      /* glacier not otherwise near land is not coast */
+      if (GLACIER_TERRAIN_IDENTIFIER == tile2->terrain->identifier)
+        continue;
+
+      if (!is_ocean(tile2->terrain)) {
+        tile_set_terrain(ptile,coast);
+        break;
+      }
+    } adjc_iterate_end;
+  } whole_map_iterate_end;
+
+  /* continental shelf */
+  whole_map_iterate(ptile) {
+    int near = 0;
+
+    if (T_UNKNOWN == ptile->terrain)
+      continue;
+
+    if (WATER_TERRAIN_IDENTIFIER != ptile->terrain->identifier)
+      continue;
+
+    adjc_iterate(ptile, tile2) {
+      if (T_UNKNOWN == tile2->terrain)
+        continue;
+
+      switch (tile2->terrain->identifier) {
+      case GLACIER_TERRAIN_IDENTIFIER:
+      case COAST_TERRAIN_IDENTIFIER:
+        near++;
+        break;
+      };
+    } adjc_iterate_end;
+
+    if (6 < near) {
+      /* smooth with neighbors */
+      tile_set_terrain(ptile,coast);
+    } else if (0 < near) {
+      tile_set_terrain(ptile,shelf);
+    }
+  } whole_map_iterate_end;
+
+  /* deep ocean floor */
+  whole_map_iterate(ptile) {
+    int near = 0;
+
+    if (T_UNKNOWN == ptile->terrain)
+      continue;
+
+    if (WATER_TERRAIN_IDENTIFIER != ptile->terrain->identifier)
+      continue;
+
+    adjc_iterate(ptile, tile2) {
+      if (T_UNKNOWN == tile2->terrain)
+        continue;
+
+      switch (tile2->terrain->identifier) {
+      case GLACIER_TERRAIN_IDENTIFIER:
+      case COAST_TERRAIN_IDENTIFIER:
+      case SHELF_TERRAIN_IDENTIFIER:
+        near++;
+        break;
+      };
+    } adjc_iterate_end;
+
+    if (6 < near) {
+      /* smooth with neighbors */
+      tile_set_terrain(ptile,shelf);
+    } else {
+      tile_set_terrain(ptile,floor);
+    }
+  } whole_map_iterate_end;
+}
+
+/**************************************************************************
   Assigns continent and ocean numbers to all tiles, and set
   map.num_continents and map.num_oceans.  Recalculates continent and
   ocean sizes, and lake_surrounders[] arrays.
@@ -167,6 +269,7 @@
   } whole_map_iterate_end;
 
   recalculate_lake_surrounders();
+  regenerate_water();
 
   freelog(LOG_VERBOSE, "Map has %d continents and %d oceans", 
          map.num_continents, map.num_oceans);
Index: data/amplio/terrain2.spec
===================================================================
--- data/amplio/terrain2.spec   (revision 12966)
+++ data/amplio/terrain2.spec   (working copy)
@@ -66,62 +66,62 @@
  3,  7, "t.t_river_n1e1s1w1"
 
 
-;forrests as overlay
+;forests as overlay
 
- 4,  0, "t.l1.forest_n0e0s0w0"
- 4,  1, "t.l1.forest_n1e0s0w0"
- 4,  2, "t.l1.forest_n0e1s0w0"
- 4,  3, "t.l1.forest_n1e1s0w0"
- 4,  4, "t.l1.forest_n0e0s1w0"
- 4,  5, "t.l1.forest_n1e0s1w0"
- 4,  6, "t.l1.forest_n0e1s1w0"
- 4,  7, "t.l1.forest_n1e1s1w0"
- 5,  0, "t.l1.forest_n0e0s0w1"
- 5,  1, "t.l1.forest_n1e0s0w1"
- 5,  2, "t.l1.forest_n0e1s0w1"
- 5,  3, "t.l1.forest_n1e1s0w1"
- 5,  4, "t.l1.forest_n0e0s1w1"
- 5,  5, "t.l1.forest_n1e0s1w1"
- 5,  6, "t.l1.forest_n0e1s1w1"
- 5,  7, "t.l1.forest_n1e1s1w1"
+ 4,  0, "t.l2.forest_n0e0s0w0"
+ 4,  1, "t.l2.forest_n1e0s0w0"
+ 4,  2, "t.l2.forest_n0e1s0w0"
+ 4,  3, "t.l2.forest_n1e1s0w0"
+ 4,  4, "t.l2.forest_n0e0s1w0"
+ 4,  5, "t.l2.forest_n1e0s1w0"
+ 4,  6, "t.l2.forest_n0e1s1w0"
+ 4,  7, "t.l2.forest_n1e1s1w0"
+ 5,  0, "t.l2.forest_n0e0s0w1"
+ 5,  1, "t.l2.forest_n1e0s0w1"
+ 5,  2, "t.l2.forest_n0e1s0w1"
+ 5,  3, "t.l2.forest_n1e1s0w1"
+ 5,  4, "t.l2.forest_n0e0s1w1"
+ 5,  5, "t.l2.forest_n1e0s1w1"
+ 5,  6, "t.l2.forest_n0e1s1w1"
+ 5,  7, "t.l2.forest_n1e1s1w1"
 
 ;mountains as overlay
 
- 6,  0, "t.l1.mountains_n0e0s0w0"
- 6,  1, "t.l1.mountains_n0e0s0w1"
- 6,  2, "t.l1.mountains_n0e0s1w0"
- 6,  3, "t.l1.mountains_n0e0s1w1"
- 6,  4, "t.l1.mountains_n0e1s0w0"
- 6,  5, "t.l1.mountains_n0e1s0w1"
- 6,  6, "t.l1.mountains_n0e1s1w0"
- 6,  7, "t.l1.mountains_n0e1s1w1"
- 7,  0, "t.l1.mountains_n1e0s0w0"
- 7,  1, "t.l1.mountains_n1e0s0w1"
- 7,  2, "t.l1.mountains_n1e0s1w0"
- 7,  3, "t.l1.mountains_n1e0s1w1"
- 7,  4, "t.l1.mountains_n1e1s0w0"
- 7,  5, "t.l1.mountains_n1e1s0w1"
- 7,  6, "t.l1.mountains_n1e1s1w0"
- 7,  7, "t.l1.mountains_n1e1s1w1"
+ 6,  0, "t.l2.mountains_n0e0s0w0"
+ 6,  1, "t.l2.mountains_n0e0s0w1"
+ 6,  2, "t.l2.mountains_n0e0s1w0"
+ 6,  3, "t.l2.mountains_n0e0s1w1"
+ 6,  4, "t.l2.mountains_n0e1s0w0"
+ 6,  5, "t.l2.mountains_n0e1s0w1"
+ 6,  6, "t.l2.mountains_n0e1s1w0"
+ 6,  7, "t.l2.mountains_n0e1s1w1"
+ 7,  0, "t.l2.mountains_n1e0s0w0"
+ 7,  1, "t.l2.mountains_n1e0s0w1"
+ 7,  2, "t.l2.mountains_n1e0s1w0"
+ 7,  3, "t.l2.mountains_n1e0s1w1"
+ 7,  4, "t.l2.mountains_n1e1s0w0"
+ 7,  5, "t.l2.mountains_n1e1s0w1"
+ 7,  6, "t.l2.mountains_n1e1s1w0"
+ 7,  7, "t.l2.mountains_n1e1s1w1"
 
 ;hills as overlay
 
- 8,  0, "t.l1.hills_n0e0s0w0"
- 8,  1, "t.l1.hills_n0e0s0w1"
- 8,  2, "t.l1.hills_n0e0s1w0"
- 8,  3, "t.l1.hills_n0e0s1w1"
- 8,  4, "t.l1.hills_n0e1s0w0"
- 8,  5, "t.l1.hills_n0e1s0w1"
- 8,  6, "t.l1.hills_n0e1s1w0"
- 8,  7, "t.l1.hills_n0e1s1w1"
- 9,  0, "t.l1.hills_n1e0s0w0"
- 9,  1, "t.l1.hills_n1e0s0w1"
- 9,  2, "t.l1.hills_n1e0s1w0"
- 9,  3, "t.l1.hills_n1e0s1w1"
- 9,  4, "t.l1.hills_n1e1s0w0"
- 9,  5, "t.l1.hills_n1e1s0w1"
- 9,  6, "t.l1.hills_n1e1s1w0"
- 9,  7, "t.l1.hills_n1e1s1w1"
+ 8,  0, "t.l2.hills_n0e0s0w0"
+ 8,  1, "t.l2.hills_n0e0s0w1"
+ 8,  2, "t.l2.hills_n0e0s1w0"
+ 8,  3, "t.l2.hills_n0e0s1w1"
+ 8,  4, "t.l2.hills_n0e1s0w0"
+ 8,  5, "t.l2.hills_n0e1s0w1"
+ 8,  6, "t.l2.hills_n0e1s1w0"
+ 8,  7, "t.l2.hills_n0e1s1w1"
+ 9,  0, "t.l2.hills_n1e0s0w0"
+ 9,  1, "t.l2.hills_n1e0s0w1"
+ 9,  2, "t.l2.hills_n1e0s1w0"
+ 9,  3, "t.l2.hills_n1e0s1w1"
+ 9,  4, "t.l2.hills_n1e1s0w0"
+ 9,  5, "t.l2.hills_n1e1s0w1"
+ 9,  6, "t.l2.hills_n1e1s1w0"
+ 9,  7, "t.l2.hills_n1e1s1w1"
 
 ;river outlets
 
@@ -143,77 +143,77 @@
 
 tiles = { "row", "column","tag"
 
-; ocean cell sprites.  See doc/README.graphics
- 0, 0,  "t.l0.ocean_cell_u000"
- 0, 2,  "t.l0.ocean_cell_u100"
- 0, 4,  "t.l0.ocean_cell_u010"
- 0, 6,  "t.l0.ocean_cell_u110"
- 0, 8,  "t.l0.ocean_cell_u001"
- 0, 10, "t.l0.ocean_cell_u101"
- 0, 12, "t.l0.ocean_cell_u011"
- 0, 14, "t.l0.ocean_cell_u111"
- 
- 1, 0,  "t.l0.ocean_cell_d000"
- 1, 2,  "t.l0.ocean_cell_d100"
- 1, 4,  "t.l0.ocean_cell_d010"
- 1, 6,  "t.l0.ocean_cell_d110"
- 1, 8,  "t.l0.ocean_cell_d001"
- 1, 10, "t.l0.ocean_cell_d101"
- 1, 12, "t.l0.ocean_cell_d011"
- 1, 14, "t.l0.ocean_cell_d111"
-
- 2, 0,  "t.l0.ocean_cell_l000"
- 2, 2,  "t.l0.ocean_cell_l100"
- 2, 4,  "t.l0.ocean_cell_l010"
- 2, 6,  "t.l0.ocean_cell_l110"
- 2, 8,  "t.l0.ocean_cell_l001"
- 2, 10, "t.l0.ocean_cell_l101"
- 2, 12, "t.l0.ocean_cell_l011"
- 2, 14, "t.l0.ocean_cell_l111"
-
- 2, 1,  "t.l0.ocean_cell_r000"
- 2, 3,  "t.l0.ocean_cell_r100"
- 2, 5,  "t.l0.ocean_cell_r010"
- 2, 7,  "t.l0.ocean_cell_r110"
- 2, 9,  "t.l0.ocean_cell_r001"
- 2, 11, "t.l0.ocean_cell_r101"
- 2, 13, "t.l0.ocean_cell_r011"
- 2, 15, "t.l0.ocean_cell_r111"
-
-; Deep Ocean sprites.
- 3, 0,  "t.l0.deep_cell_u000"
- 3, 2,  "t.l0.deep_cell_u100"
- 3, 4,  "t.l0.deep_cell_u010"
- 3, 6,  "t.l0.deep_cell_u110"
- 3, 8,  "t.l0.deep_cell_u001"
- 3, 10, "t.l0.deep_cell_u101"
- 3, 12, "t.l0.deep_cell_u011"
- 3, 14, "t.l0.deep_cell_u111"
- 
- 4, 0,  "t.l0.deep_cell_d000"
- 4, 2,  "t.l0.deep_cell_d100"
- 4, 4,  "t.l0.deep_cell_d010"
- 4, 6,  "t.l0.deep_cell_d110"
- 4, 8,  "t.l0.deep_cell_d001"
- 4, 10, "t.l0.deep_cell_d101"
- 4, 12, "t.l0.deep_cell_d011"
- 4, 14, "t.l0.deep_cell_d111"
-
- 5, 0,  "t.l0.deep_cell_l000"
- 5, 2,  "t.l0.deep_cell_l100"
- 5, 4,  "t.l0.deep_cell_l010"
- 5, 6,  "t.l0.deep_cell_l110"
- 5, 8,  "t.l0.deep_cell_l001"
- 5, 10, "t.l0.deep_cell_l101"
- 5, 12, "t.l0.deep_cell_l011"
- 5, 14, "t.l0.deep_cell_l111"
-
- 5, 1,  "t.l0.deep_cell_r000"
- 5, 3,  "t.l0.deep_cell_r100"
- 5, 5,  "t.l0.deep_cell_r010"
- 5, 7,  "t.l0.deep_cell_r110"
- 5, 9,  "t.l0.deep_cell_r001"
- 5, 11, "t.l0.deep_cell_r101"
- 5, 13, "t.l0.deep_cell_r011"
- 5, 15, "t.l0.deep_cell_r111"
+;; ocean cell sprites.  See doc/README.graphics
+; 0, 0,  "t.l0.ocean_cell_u000"
+; 0, 2,  "t.l0.ocean_cell_u100"
+; 0, 4,  "t.l0.ocean_cell_u010"
+; 0, 6,  "t.l0.ocean_cell_u110"
+; 0, 8,  "t.l0.ocean_cell_u001"
+; 0, 10, "t.l0.ocean_cell_u101"
+; 0, 12, "t.l0.ocean_cell_u011"
+; 0, 14, "t.l0.ocean_cell_u111"
+; 
+; 1, 0,  "t.l0.ocean_cell_d000"
+; 1, 2,  "t.l0.ocean_cell_d100"
+; 1, 4,  "t.l0.ocean_cell_d010"
+; 1, 6,  "t.l0.ocean_cell_d110"
+; 1, 8,  "t.l0.ocean_cell_d001"
+; 1, 10, "t.l0.ocean_cell_d101"
+; 1, 12, "t.l0.ocean_cell_d011"
+; 1, 14, "t.l0.ocean_cell_d111"
+;
+; 2, 0,  "t.l0.ocean_cell_l000"
+; 2, 2,  "t.l0.ocean_cell_l100"
+; 2, 4,  "t.l0.ocean_cell_l010"
+; 2, 6,  "t.l0.ocean_cell_l110"
+; 2, 8,  "t.l0.ocean_cell_l001"
+; 2, 10, "t.l0.ocean_cell_l101"
+; 2, 12, "t.l0.ocean_cell_l011"
+; 2, 14, "t.l0.ocean_cell_l111"
+;
+; 2, 1,  "t.l0.ocean_cell_r000"
+; 2, 3,  "t.l0.ocean_cell_r100"
+; 2, 5,  "t.l0.ocean_cell_r010"
+; 2, 7,  "t.l0.ocean_cell_r110"
+; 2, 9,  "t.l0.ocean_cell_r001"
+; 2, 11, "t.l0.ocean_cell_r101"
+; 2, 13, "t.l0.ocean_cell_r011"
+; 2, 15, "t.l0.ocean_cell_r111"
+;
+;; Deep Ocean sprites.
+; 3, 0,  "t.l0.deep_cell_u000"
+; 3, 2,  "t.l0.deep_cell_u100"
+; 3, 4,  "t.l0.deep_cell_u010"
+; 3, 6,  "t.l0.deep_cell_u110"
+; 3, 8,  "t.l0.deep_cell_u001"
+; 3, 10, "t.l0.deep_cell_u101"
+; 3, 12, "t.l0.deep_cell_u011"
+; 3, 14, "t.l0.deep_cell_u111"
+; 
+; 4, 0,  "t.l0.deep_cell_d000"
+; 4, 2,  "t.l0.deep_cell_d100"
+; 4, 4,  "t.l0.deep_cell_d010"
+; 4, 6,  "t.l0.deep_cell_d110"
+; 4, 8,  "t.l0.deep_cell_d001"
+; 4, 10, "t.l0.deep_cell_d101"
+; 4, 12, "t.l0.deep_cell_d011"
+; 4, 14, "t.l0.deep_cell_d111"
+;
+; 5, 0,  "t.l0.deep_cell_l000"
+; 5, 2,  "t.l0.deep_cell_l100"
+; 5, 4,  "t.l0.deep_cell_l010"
+; 5, 6,  "t.l0.deep_cell_l110"
+; 5, 8,  "t.l0.deep_cell_l001"
+; 5, 10, "t.l0.deep_cell_l101"
+; 5, 12, "t.l0.deep_cell_l011"
+; 5, 14, "t.l0.deep_cell_l111"
+;
+; 5, 1,  "t.l0.deep_cell_r000"
+; 5, 3,  "t.l0.deep_cell_r100"
+; 5, 5,  "t.l0.deep_cell_r010"
+; 5, 7,  "t.l0.deep_cell_r110"
+; 5, 9,  "t.l0.deep_cell_r001"
+; 5, 11, "t.l0.deep_cell_r101"
+; 5, 13, "t.l0.deep_cell_r011"
+; 5, 15, "t.l0.deep_cell_r111"
 }
Index: data/amplio/terrain1.spec
===================================================================
--- data/amplio/terrain1.spec   (revision 12966)
+++ data/amplio/terrain1.spec   (working copy)
@@ -27,27 +27,27 @@
 tiles = { "row", "column","tag"
 
 ; terrain
- 0,  0, "t.l0.desert1"
+ 0,  0, "t.l1.desert1"
 
- 1,  0, "t.l0.plains1"
+ 1,  0, "t.l1.plains1"
 
- 2,  0, "t.l0.grassland1"
+ 2,  0, "t.l1.grassland1"
 
  2,  0, "t.l0.t_river1"
 
- 3,  0, "t.l0.forest1"
+ 3,  0, "t.l1.forest1"
 
- 4,  0, "t.l0.hills1"
+ 4,  0, "t.l1.hills1"
 
- 5,  0, "t.l0.mountains1"
+ 5,  0, "t.l1.mountains1"
 
- 6,  0, "t.l0.tundra1"
+ 6,  0, "t.l1.tundra1"
 
- 7,  0, "t.l0.arctic1"
+ 7,  0, "t.l1.arctic1"
 
- 8,  0, "t.l0.swamp1"
+ 8,  0, "t.l1.swamp1"
 
- 9,  0, "t.l0.jungle1"
+ 9,  0, "t.l1.jungle1"
 
 ; Terrain special resources:
 
@@ -122,8 +122,8 @@
  15,  0, "tx.darkness"
  15,  2, "mask.tile"
  15,  2, "t.unknown1"
- 15,  3, "t.l0.ocean1"
- 15,  3, "t.l0.deep1"
+ 15,  3, "t.l1.ocean1"
+ 15,  3, "t.l1.deep1"
  15,  4, "user.attention"
  15,  5, "tx.fog"
 }
Index: data/amplio.tilespec
===================================================================
--- data/amplio.tilespec        (revision 12966)
+++ data/amplio.tilespec        (working copy)
@@ -41,7 +41,7 @@
 unit_offset_y = 18
 
 ; The layer in which blending is used (see terrains below)
-blend_layer = 0
+blend_layer = 1
 
 ;Enable citybar
 is_full_citybar = 1
@@ -64,6 +64,7 @@
 files = 
   "amplio/terrain1.spec",
   "amplio/terrain2.spec",
+  "amplio/ocean.spec",
   "amplio/tiles.spec",
   "amplio/fog.spec",
   "misc/small.spec",
@@ -94,101 +95,117 @@
 ; Terrain info - see README.graphics
 
 [layer0]
-match_style = "BOOL"
-match_types = "ocean", "land"
+match_style = "FULL"
+match_types = "c", "o", "d"
 
 [layer1]
+match_style = "NONE"
+
+[layer2]
 match_style = "BOOL"
 match_types = "forest", "hills", "mountains", "deep"
 
 [terrain_arctic]
 is_blended = 1
-num_layers = 1
-layer0_match_type = "land"
+num_layers = 2
+layer0_match_style = "full"
+layer0_match_type = "c"
+layer0_cell_type = "rect"
+layer1_match_style = "none"
 mine_sprite = "tx.oil_mine"
 
 [terrain_desert]
 is_blended = 1
-num_layers = 1
-layer0_match_type = "land"
+num_layers = 2
+layer0_match_style = "full"
+layer0_match_type = "c"
+layer0_cell_type = "rect"
+layer1_match_style = "none"
 mine_sprite = "tx.oil_mine"
 
 [terrain_forest]
 is_blended = 1
-num_layers = 2
-layer0_match_type = "land"
-layer1_match_type = "forest"
-layer1_match_style = "bool"
+num_layers = 3
+layer0_match_style = "full"
+layer0_match_type = "c"
+layer0_cell_type = "rect"
+layer1_match_style = "none"
+layer2_match_type = "forest"
+layer2_match_style = "bool"
 
 [terrain_grassland]
 is_blended = 1
-num_layers = 1
-layer0_match_type = "land"
+num_layers = 2
+layer0_match_style = "full"
+layer0_match_type = "c"
+layer0_cell_type = "rect"
+layer1_match_style = "none"
 
 [terrain_hills]
 is_blended = 1
-num_layers = 2
-layer0_match_type = "land"
-layer1_match_type = "hills"
-layer1_match_style = "bool"
+num_layers = 3
+layer0_match_style = "full"
+layer0_match_type = "c"
+layer0_cell_type = "rect"
+layer1_match_style = "none"
+layer2_match_type = "hills"
+layer2_match_style = "bool"
 mine_sprite = "tx.mine"
 
 [terrain_jungle]
 is_blended = 1
-num_layers = 1
-layer0_match_type = "land"
+num_layers = 2
+layer0_match_style = "full"
+layer0_match_type = "c"
+layer0_cell_type = "rect"
+layer1_match_style = "none"
 
 [terrain_mountains]
 is_blended = 1
-num_layers = 2
-layer0_match_type = "land"
-layer1_match_type = "mountains"
-layer1_match_style = "bool"
+num_layers = 3
+layer0_match_style = "full"
+layer0_match_type = "c"
+layer0_cell_type = "rect"
+layer1_match_style = "none"
+layer2_match_type = "mountains"
+layer2_match_style = "bool"
 mine_sprite = "tx.mine"
 
 [terrain_ocean]
-is_blended = 1
+is_blended = 0
 num_layers = 1
-layer0_match_style = "bool"
-layer0_match_type = "ocean"
+layer0_match_style = "full"
+layer0_match_type = "o"
 layer0_cell_type = "rect"
 
-; Deep Ocean is currently quite a hack:
-; - Blending is disabled so there will be no blending
-;   between Ocean and Deep Ocean. Ocean blending tile
-;   is of land colour and we don't want that to appear
-;   in the middle of the ocean.
-; - Deep Ocean is in two layers. Layer0 is setup just
-;   for match_type = "ocean". Ocean will match this
-;   and will not draw coast sprites between Ocean and
-;   Deep Ocean. Layer1 is for actual Deep Ocean drawing.
-;   Ocean will not match this, so Deep Ocean to Ocean
-;   sprites will be drawn.
-;
-; Problems:
-; - There is no blending between Deep Ocean and land tiles
-; - There is no coast drawn beteen Deep Ocean and land tiles
 [terrain_deep]
 is_blended = 0
-num_layers = 2
-layer0_match_style = "bool"
-layer0_match_type  = "ocean"
+num_layers = 1
+layer0_match_style = "full"
+layer0_match_type  = "d"
 layer0_cell_type   = "rect"
-layer1_match_style = "bool"
-layer1_match_type  = "deep"
-layer1_cell_type   = "rect"
 
 [terrain_plains]
 is_blended = 1
-num_layers = 1
-layer0_match_type = "land"
+num_layers = 2
+layer0_match_style = "full"
+layer0_match_type = "c"
+layer0_cell_type = "rect"
+layer1_match_style = "none"
 
 [terrain_swamp]
 is_blended = 1
-num_layers = 1
-layer0_match_type = "land"
+num_layers = 2
+layer0_match_style = "full"
+layer0_match_type = "c"
+layer0_cell_type = "rect"
+layer1_match_style = "none"
 
 [terrain_tundra]
 is_blended = 1
-num_layers = 1
-layer0_match_type = "land"
+num_layers = 2
+layer0_match_style = "full"
+layer0_match_type = "c"
+layer0_cell_type = "rect"
+layer1_match_style = "none"
+
Index: data/default/terrain.ruleset
===================================================================
--- data/default/terrain.ruleset        (revision 12966)
+++ data/default/terrain.ruleset        (working copy)
@@ -91,9 +91,11 @@
 fallout_trade_penalty=50
 
 ; Below: The individual terrain types, one per section.
+; <PRESUMED OBSOLETE>
 ; For now, the number of such sections must be kept the same (=12).
 ; Also, terrains should be in the same order as defined in common/map.h,
 ; and have similar roles/effects, as some things are still hardwired.
+; </PRESUMED OBSOLETE>
 ; The actual tag used (the * in [terrain_*]) does not matter, except 
 ; it must be unique for each terrain, and it may be used in debug 
 ; output when reading this file.
@@ -152,8 +154,10 @@
 ;   - CanHaveRiver     = Set to 1 if this terrain can have river on it (the
 ;                        actual chance of river generation is controlled
 ;                        separately).
-;   - UnsafeCoast      = This terrain does not provide a safe coast for
+;   - UnsafeCoast      = This terrain does not provide a safe voyage for
 ;                        F_TRIRIEME units.
+;   - UnsafeOcean      = This terrain does not provide a safe voyage for
+;                        F_COASTAL or F_SEAWORTHY units.
 ;   - Oceanic          = This is an "ocean" terrain.  This has a big effect
 ;                        on gameplay.  Naval units can move on oceanic terrain,
 ;                        while land units cannot.  Oceanic tiles can be used
@@ -177,6 +181,367 @@
 ; helptext            = optional help text string; should escape all raw 
 ;                       newlines so that xgettext parsing works
 
+[terrain_water]
+; undifferentiated open water from old savefiles
+name                 = _("Ocean")
+graphic              = "ocean"
+graphic_alt         = "-"
+identifier          = " "
+movement_cost        = 1
+defense_bonus        = 0
+food                 = 1
+shield               = 0
+trade                = 2
+resources            = "Fish", "Whales"
+road_trade_incr      = 0
+road_time            = 0
+irrigation_result    = "no"
+irrigation_food_incr = 0
+irrigation_time      = 0
+mining_result        = "no"
+mining_shield_incr   = 0
+mining_time          = 0
+transform_result     = "Swamp"
+transform_time       = 36
+rail_time            = 3
+airbase_time         = 3
+fortress_time        = 3
+clean_pollution_time = 3
+clean_fallout_time   = 3
+warmer_wetter_result = "no"
+warmer_drier_result  = "no"
+cooler_wetter_result = "no"
+cooler_drier_result  = "no"
+native_to            = "Sea", "Air", "Missile", "Helicopter"
+flags                = "Oceanic", "NoCities", "NoPollution", "UnsafeCoast"
+property_ocean_depth = 10
+helptext            = _("\
+Oceans cover much of the world, and only sea units (Triremes and\
+ other boats) can travel on them.\
+\n\n\
+Ocean squares can never be polluted or subjected to fallout.\
+")
+
+[terrain_fresh_water]
+name                 = _("Lake")
+graphic              = "ocean"
+graphic_alt         = "-"
+identifier          = "+"
+movement_cost        = 1
+defense_bonus        = 0
+food                 = 1
+shield               = 0
+trade                = 2
+resources            = "Fish"
+road_trade_incr      = 0
+road_time            = 0
+irrigation_result    = "no"
+irrigation_food_incr = 0
+irrigation_time      = 0
+mining_result        = "no"
+mining_shield_incr   = 0
+mining_time          = 0
+transform_result     = "Swamp"
+transform_time       = 36
+rail_time            = 3
+airbase_time         = 3
+fortress_time        = 3
+clean_pollution_time = 3
+clean_fallout_time   = 3
+warmer_wetter_result = "no"
+warmer_drier_result  = "no"
+cooler_wetter_result = "no"
+cooler_drier_result  = "no"
+native_to            = "Sea", "Air", "Missile", "Helicopter"
+flags                = "Oceanic", "NoCities", "NoPollution"
+property_ocean_depth = 0
+helptext            = _("\
+Oceans cover much of the world, and only sea units (Triremes and\
+ other boats) can travel on them.\
+\n\n\
+Ocean squares can never be polluted or subjected to fallout.\
+")
+
+[terrain_salt_water]
+name                 = _("Sea")
+graphic              = "ocean"
+graphic_alt         = "-"
+identifier          = "-"
+movement_cost        = 1
+defense_bonus        = 0
+food                 = 1
+shield               = 0
+trade                = 2
+resources            = "Fish"
+road_trade_incr      = 0
+road_time            = 0
+irrigation_result    = "no"
+irrigation_food_incr = 0
+irrigation_time      = 0
+mining_result        = "no"
+mining_shield_incr   = 0
+mining_time          = 0
+transform_result     = "Swamp"
+transform_time       = 36
+rail_time            = 3
+airbase_time         = 3
+fortress_time        = 3
+clean_pollution_time = 3
+clean_fallout_time   = 3
+warmer_wetter_result = "no"
+warmer_drier_result  = "no"
+cooler_wetter_result = "no"
+cooler_drier_result  = "no"
+native_to            = "Sea", "Air", "Missile", "Helicopter"
+flags                = "Oceanic", "NoCities", "NoPollution"
+property_ocean_depth = 10
+helptext            = _("\
+Oceans cover much of the world, and only sea units (Triremes and\
+ other boats) can travel on them.\
+\n\n\
+Ocean squares can never be polluted or subjected to fallout.\
+")
+
+[terrain_coast]
+name                 = _("Coast")
+graphic              = "ocean"
+graphic_alt         = "-"
+identifier          = "."
+movement_cost        = 1
+defense_bonus        = 0
+food                 = 1
+shield               = 0
+trade                = 2
+resources            = "Fish"
+road_trade_incr      = 0
+road_time            = 0
+irrigation_result    = "no"
+irrigation_food_incr = 0
+irrigation_time      = 0
+mining_result        = "no"
+mining_shield_incr   = 0
+mining_time          = 0
+transform_result     = "Swamp"
+transform_time       = 36
+rail_time            = 3
+airbase_time         = 3
+fortress_time        = 3
+clean_pollution_time = 3
+clean_fallout_time   = 3
+warmer_wetter_result = "no"
+warmer_drier_result  = "no"
+cooler_wetter_result = "no"
+cooler_drier_result  = "no"
+native_to            = "Sea", "Air", "Missile", "Helicopter"
+flags                = "Oceanic", "NoCities", "NoPollution"
+property_ocean_depth = 10
+helptext            = _("\
+Oceans cover much of the world, and only sea units (Triremes and\
+ other boats) can travel on them.\
+\n\n\
+Ocean squares can never be polluted or subjected to fallout.\
+")
+
+[terrain_shelf]
+name                 = _("Shelf")
+graphic              = "deep"
+graphic_alt         = "-"
+identifier          = ","
+movement_cost        = 1
+defense_bonus        = 0
+food                 = 1
+shield               = 0
+trade                = 2
+resources            = "Fish", "Whales"
+road_trade_incr      = 0
+road_time            = 0
+irrigation_result    = "no"
+irrigation_food_incr = 0
+irrigation_time      = 0
+mining_result        = "no"
+mining_shield_incr   = 0
+mining_time          = 0
+transform_result     = "no"
+transform_time       = 0
+rail_time            = 3
+airbase_time         = 3
+fortress_time        = 3
+clean_pollution_time = 3
+clean_fallout_time   = 3
+warmer_wetter_result = "no"
+warmer_drier_result  = "no"
+cooler_wetter_result = "no"
+cooler_drier_result  = "no"
+native_to            = "Sea", "Air", "Missile", "Helicopter"
+flags                = "Oceanic", "NoCities", "NoPollution", "UnsafeCoast"
+property_ocean_depth = 20
+helptext            = _("\
+Oceans cover much of the world, and only sea units (Triremes and\
+ other boats) can travel on them.\
+\n\n\
+Ocean squares can never be polluted or subjected to fallout.\
+")
+
+[terrain_ocean_floor]
+name                 = _("Briny Deep")
+graphic              = "deep"
+graphic_alt         = "-"
+identifier          = ":"
+movement_cost        = 1
+defense_bonus        = 0
+food                 = 1
+shield               = 0
+trade                = 2
+;resources            = "none"
+road_trade_incr      = 0
+road_time            = 0
+irrigation_result    = "no"
+irrigation_food_incr = 0
+irrigation_time      = 0
+mining_result        = "no"
+mining_shield_incr   = 0
+mining_time          = 0
+transform_result     = "no"
+transform_time       = 0
+rail_time            = 3
+airbase_time         = 3
+fortress_time        = 3
+clean_pollution_time = 3
+clean_fallout_time   = 3
+warmer_wetter_result = "no"
+warmer_drier_result  = "no"
+cooler_wetter_result = "no"
+cooler_drier_result  = "no"
+native_to            = "Sea", "Air", "Missile", "Helicopter"
+flags                = "Oceanic", "NoCities", "NoPollution", "UnsafeCoast"; 
"UnsafeOcean"
+property_ocean_depth = 40
+helptext            = _("\
+Oceans cover much of the world, and only sea units (Triremes and\
+ other boats) can travel on them.\
+\n\n\
+Ocean squares can never be polluted or subjected to fallout.\
+")
+
+[terrain_ocean_trench]
+name                 = _("Abyss")
+graphic              = "deep"
+graphic_alt         = "-"
+identifier          = ";"
+movement_cost        = 1
+defense_bonus        = 0
+food                 = 1
+shield               = 0
+trade                = 2
+;resources            = "none"
+road_trade_incr      = 0
+road_time            = 0
+irrigation_result    = "no"
+irrigation_food_incr = 0
+irrigation_time      = 0
+mining_result        = "no"
+mining_shield_incr   = 0
+mining_time          = 0
+transform_result     = "no"
+transform_time       = 0
+rail_time            = 3
+airbase_time         = 3
+fortress_time        = 3
+clean_pollution_time = 3
+clean_fallout_time   = 3
+warmer_wetter_result = "no"
+warmer_drier_result  = "no"
+cooler_wetter_result = "no"
+cooler_drier_result  = "no"
+native_to            = "Sea", "Air", "Missile", "Helicopter"
+flags                = "Oceanic", "NoCities", "NoPollution", "UnsafeCoast"; 
"UnsafeOcean"
+property_ocean_depth = 80
+helptext            = _("\
+Oceans cover much of the world, and only sea units (Triremes and\
+ other boats) can travel on them.\
+\n\n\
+Ocean squares can never be polluted or subjected to fallout.\
+")
+
+[terrain_ocean_ridge]
+name                 = _("Oceanic Ridge")
+graphic              = "deep"
+graphic_alt         = "-"
+identifier          = "^"
+movement_cost        = 1
+defense_bonus        = 0
+food                 = 1
+shield               = 0
+trade                = 2
+;resources            = "none"
+road_trade_incr      = 0
+road_time            = 0
+irrigation_result    = "no"
+irrigation_food_incr = 0
+irrigation_time      = 0
+mining_result        = "no"
+mining_shield_incr   = 0
+mining_time          = 0
+transform_result     = "no"
+transform_time       = 0
+rail_time            = 3
+airbase_time         = 3
+fortress_time        = 3
+clean_pollution_time = 3
+clean_fallout_time   = 3
+warmer_wetter_result = "no"
+warmer_drier_result  = "no"
+cooler_wetter_result = "no"
+cooler_drier_result  = "no"
+native_to            = "Sea", "Air", "Missile", "Helicopter"
+flags                = "Oceanic", "NoCities", "NoPollution", "UnsafeCoast"; 
"UnsafeOcean"
+property_ocean_depth = 30
+helptext            = _("\
+Oceans cover much of the world, and only sea units (Triremes and\
+ other boats) can travel on them.\
+\n\n\
+Ocean squares can never be polluted or subjected to fallout.\
+")
+
+[terrain_ocean_vent]
+name                 = _("Oceanic Vent")
+graphic              = "deep"
+graphic_alt         = "-"
+identifier          = "!"
+movement_cost        = 1
+defense_bonus        = 0
+food                 = 1
+shield               = 0
+trade                = 2
+;resources            = "none"
+road_trade_incr      = 0
+road_time            = 0
+irrigation_result    = "no"
+irrigation_food_incr = 0
+irrigation_time      = 0
+mining_result        = "no"
+mining_shield_incr   = 0
+mining_time          = 0
+transform_result     = "no"
+transform_time       = 0
+rail_time            = 3
+airbase_time         = 3
+fortress_time        = 3
+clean_pollution_time = 3
+clean_fallout_time   = 3
+warmer_wetter_result = "no"
+warmer_drier_result  = "no"
+cooler_wetter_result = "no"
+cooler_drier_result  = "no"
+native_to            = "Sea", "Air", "Missile", "Helicopter"
+flags                = "Oceanic", "NoCities", "NoPollution", "UnsafeCoast"; 
"UnsafeOcean"
+property_ocean_depth = 30
+helptext            = _("\
+Oceans cover much of the world, and only sea units (Triremes and\
+ other boats) can travel on them.\
+\n\n\
+Ocean squares can never be polluted or subjected to fallout.\
+")
+
 [terrain_glacier]
 name                 = _("Glacier")
 graphic              = "arctic"
@@ -449,46 +814,6 @@
  trade very difficult.\
 ")
 
-[terrain_ocean]
-name                 = _("Ocean")
-graphic              = "ocean"
-graphic_alt         = "-"
-identifier          = " "
-movement_cost        = 1
-defense_bonus        = 0
-food                 = 1
-shield               = 0
-trade                = 2
-resources            = "Fish", "Whales"
-road_trade_incr      = 0
-road_time            = 0
-irrigation_result    = "no"
-irrigation_food_incr = 0
-irrigation_time      = 0
-mining_result        = "no"
-mining_shield_incr   = 0
-mining_time          = 0
-transform_result     = "Swamp"
-transform_time       = 36
-rail_time            = 3
-airbase_time         = 3
-fortress_time        = 3
-clean_pollution_time = 3
-clean_fallout_time   = 3
-warmer_wetter_result = "no"
-warmer_drier_result  = "no"
-cooler_wetter_result = "no"
-cooler_drier_result  = "no"
-native_to            = "Sea", "Air", "Missile", "Helicopter"
-flags                = "Oceanic", "NoPollution", "UnsafeCoast", "NoCities"
-property_ocean_depth = 10
-helptext            = _("\
-Oceans cover much of the world, and only sea units (Triremes and\
- other boats) can travel on them.\
-\n\n\
-Ocean squares can never be polluted or subjected to fallout.\
-")
-
 [terrain_plains]
 name                 = _("Plains")
 graphic              = "plains"
@@ -547,7 +872,7 @@
 mining_result        = "Forest"
 mining_shield_incr   = 0
 mining_time          = 15
-transform_result     = "Ocean"
+transform_result     = "Coast"
 transform_time       = 36
 rail_time            = 3
 airbase_time         = 3
Index: data/misc/colors.tilespec
===================================================================
--- data/misc/colors.tilespec   (revision 12966)
+++ data/misc/colors.tilespec   (working copy)
@@ -31,7 +31,15 @@
   142, 121,  63, "Hills"
   167,  77,  38, "Mountains"
     0,   0, 220, "Ocean"
+    0,   0, 220, "Coast"
+    0,   0, 220, "Lake"
+    0,   0, 220, "Sea"
+    0,   0, 200, "Shelf"
     0,   0, 170, "Deep Ocean"
+    0,   0, 170, "Briny Deep"
+    0,   0, 170, "Abyss"
+    0,   0, 170, "Oceanic Ridge"
+    0,   0, 170, "Oceanic Vent"
 }
 
 ; Mapview
Index: common/terrain.c
===================================================================
--- common/terrain.c    (revision 12966)
+++ common/terrain.c    (working copy)
@@ -79,6 +79,20 @@
 }
 
 /****************************************************************************
+  Return the terrain type matching the identifier, or T_UNKNOWN if none 
matches.
+****************************************************************************/
+struct terrain *get_terrain_by_identifier(const char identifier)
+{
+  terrain_type_iterate(pterrain) {
+    if (pterrain->identifier == identifier) {
+      return pterrain;
+    }
+  } terrain_type_iterate_end;
+
+  return T_UNKNOWN;
+}
+
+/****************************************************************************
   Return the terrain type matching the name, or T_UNKNOWN if none matches.
 ****************************************************************************/
 struct terrain *get_terrain_by_name(const char *name)
Index: common/terrain.h
===================================================================
--- common/terrain.h    (revision 12966)
+++ common/terrain.h    (working copy)
@@ -125,6 +125,16 @@
 
   /* Server-only. */
   char identifier; /* Single-character identifier used in savegames. */
+#define WATER_TERRAIN_IDENTIFIER ' '
+#define LAKE_TERRAIN_IDENTIFIER '+'
+#define SEA_TERRAIN_IDENTIFIER '-'
+#define COAST_TERRAIN_IDENTIFIER '.'
+#define SHELF_TERRAIN_IDENTIFIER ','
+#define FLOOR_TERRAIN_IDENTIFIER ':'
+#define TRENCH_TERRAIN_IDENTIFIER ';'
+#define RIDGE_TERRAIN_IDENTIFIER '^'
+#define VENT_TERRAIN_IDENTIFIER '!'
+#define GLACIER_TERRAIN_IDENTIFIER 'a'
 #define UNKNOWN_TERRAIN_IDENTIFIER 'u'
 
   int movement_cost;
@@ -195,6 +205,7 @@
 
 /* General terrain accessor functions. */
 struct terrain *get_terrain(Terrain_type_id type);
+struct terrain *get_terrain_by_identifier(const char identifier);
 struct terrain *get_terrain_by_name(const char *name);
 const char *get_name(const struct terrain *pterrain);
 enum terrain_flag_id terrain_flag_from_str(const char *s);
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to