Re: [Freeciv-Dev] (PR#39387) replace match_style = full

2007-07-17 Thread William Allen Simpson

URL: http://bugs.freeciv.org/Ticket/Display.html?id=39387 

For MATCH_FULL, default to last entry.  This allows use in higher layers
without adding a match_type to every entry, and allows a default match
instead of requiring a unique match for every entry.

In the case at hand, this allows use on layer1 for land entries that
only have a layer0 base, and land to also match mountains, hills,
etc.  Essentially saves a layer!

Index: client/tilespec.c
===
--- client/tilespec.c   (revision 13107)
+++ client/tilespec.c   (working copy)
@@ -3865,15 +3865,16 @@
  break;
case MATCH_FULL:
default:
- if (m[0] != -1  m[1] != -1  m[2] != -1) {
+ {
int n[3];
int j = 0;
for (; j  3; j++) {
  int k = 0;
  for (; k  count; k++) {
+   n[j] = k; /* default to last entry */
if (m[j] == dlp-match_index[k])
{
- n[j] = k;
+ break;
}
  }
}
___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


Re: [Freeciv-Dev] (PR#39387) replace match_style = full with pair

2007-07-14 Thread William Allen Simpson

URL: http://bugs.freeciv.org/Ticket/Display.html?id=39387 

Re-reading the original posting, that should be match_style.

After much testing, I've completely eliminated match_style, and its
parameters none, bool, and full.

Instead, I've replaced it with match_with, a listing of match_types.
This allows completely orthogonal operations between styles.  Styles
are determined automagically (internally).

That is,

   layer0_match_style = bool
   layer0_match_type = hills

becomes

   layer0_match_type = hills
   layer0_match_with = hills

Simple enough.  The elegance comes as more match_with types are added:

   layer0_match_type = shallow
   layer0_match_with = land, deep

The above is the equivalent of the old match_style = full, but doesn't
interfere with other tiles' matching styles.  *And* may be extensible to
more than 3 types!  (Currently limited to 3 as before.)

This patch doesn't make any substantive changes.  It continues to operate
in exactly the same manner as before, so that old savegames will run
without modification.

Never-the-less, this is the big one!  Old tilesets will no longer work.
(Replacements are provided for the main 5 here.)

I've tested 2.1 savegames against all 5 tilesets, and also trunk edit
savegames (with deep water) against all 5 tilesets.

Index: data/trident.tilespec
===
--- data/trident.tilespec   (revision 13103)
+++ data/trident.tilespec   (working copy)
@@ -2,7 +2,7 @@
 [tilespec]
 
 ; Format and options of this tilespec file:
-options = +tilespec4.2007.Feb.20
+options = +tilespec4.2007.Jul.13
 
 ; A simple name for the tileset specified by this file:
 name = Trident
@@ -86,169 +86,138 @@
 ; Terrain info - see README.graphics
 
 [layer0]
-match_style = BOOL
 match_types = arctic, desert, forest, grassland, hills, jungle, 
mountains, water, plains, swamp, tundra
 
 [layer1]
-match_style = BOOL
 match_types = water
 
 [layer2]
-match_style = BOOL
 match_types = water
 
 ; Water graphics referenced by terrain.ruleset
 ;
-[terrain_coast]
+[tile_coast]
 is_blended = 0
 num_layers = 3
-layer0_match_style = none
 layer0_match_type = water
-layer1_match_style = bool
 layer1_match_type = water
-layer2_match_style = bool
+layer1_match_with = water
 layer2_match_type = water
-layer2_cell_type = rect
+layer2_match_with = water
+layer2_sprite_type = corner
 
-[terrain_shelf]
+[tile_shelf]
 is_blended = 0
 num_layers = 3
-layer0_match_style = none
 layer0_match_type = water
-layer1_match_style = bool
 layer1_match_type = water
-layer2_match_style = bool
+layer1_match_with = water
 layer2_match_type = water
-layer2_cell_type = rect
+layer2_match_with = water
+layer2_sprite_type = corner
 
-[terrain_floor]
+[tile_floor]
 is_blended = 0
 num_layers = 3
-layer0_match_style = none
 layer0_match_type = water
-layer1_match_style = bool
 layer1_match_type = water
-layer2_match_style = bool
+layer1_match_with = water
 layer2_match_type = water
-layer2_cell_type = rect
+layer2_match_with = water
+layer2_sprite_type = corner
 
-[terrain_trench]
+[tile_trench]
 is_blended = 0
 num_layers = 3
-layer0_match_style = none
 layer0_match_type = water
-layer1_match_style = bool
 layer1_match_type = water
-layer2_match_style = bool
+layer1_match_with = water
 layer2_match_type = water
-layer2_cell_type = rect
+layer2_match_with = water
+layer2_sprite_type = corner
 
-[terrain_ridge]
+[tile_ridge]
 is_blended = 0
 num_layers = 3
-layer0_match_style = none
 layer0_match_type = water
-layer1_match_style = bool
 layer1_match_type = water
-layer2_match_style = bool
+layer1_match_with = water
 layer2_match_type = water
-layer2_cell_type = rect
+layer2_match_with = water
+layer2_sprite_type = corner
 
-[terrain_vent]
+[tile_vent]
 is_blended = 0
 num_layers = 3
-layer0_match_style = none
 layer0_match_type = water
-layer1_match_style = bool
 layer1_match_type = water
-layer2_match_style = bool
+layer1_match_with = water
 layer2_match_type = water
-layer2_cell_type = rect
+layer2_match_with = water
+layer2_sprite_type = corner
 
 ; Land graphics referenced by terrain.ruleset
 ;
-[terrain_arctic]
+[tile_arctic]
 is_blended = 0
 num_layers = 1
-layer0_match_style = bool
 layer0_match_type = arctic
+layer0_match_with = arctic
 mine_sprite = tx.oil_mine
 
-[terrain_desert]
+[tile_desert]
 is_blended = 0
 num_layers = 1
-layer0_match_style = bool
 layer0_match_type = desert
+layer0_match_with = desert
 mine_sprite = tx.oil_mine
 
-[terrain_forest]
+[tile_forest]
 is_blended = 0
 num_layers = 1
-layer0_match_style = bool
 layer0_match_type = forest
+layer0_match_with = forest
 
-[terrain_grassland]
+[tile_grassland]
 is_blended = 0
 num_layers = 1
-layer0_match_style = bool
 layer0_match_type = grassland
+layer0_match_with = grassland
 
-[terrain_hills]
+[tile_hills]
 is_blended = 0
 num_layers = 1
-layer0_match_style = bool
 layer0_match_type = hills
+layer0_match_with = hills
 mine_sprite = tx.mine
 
-[terrain_jungle]
+[tile_jungle]
 

Re: [Freeciv-Dev] (PR#39387) replace match_style = full

2007-07-14 Thread William Allen Simpson

URL: http://bugs.freeciv.org/Ticket/Display.html?id=39387 

While I was changing tilesets, the sections now are [tile_*], instead of
[terrain_*] (the latter is already used in terrain.ruleset).

And cell_type is now sprite_type, matching its actual function.
The default (a whole tile) made no sense at all as a type of cell --
by definition a fraction of a tile.

And more useful parameter names are used (added in an earlier patch),
in this instance corner -- for a corner sprite.  The old rect wasn't
very enlightening, and in most tilesets isn't even rectangular.

Internally, variables that are not terrain were renamed to their
(current) use.  My guess is that once-upon-a-time the tiles and
terrain were joined.  Now, several terrain can use the same graphic,
and each tile graphic actually be many cell sprites.

Various indexed arrays (used over and over) were changed to use pointers.

Committed trunk revision 13104.



___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev