Author: cazfi Date: Mon Nov 17 21:15:31 2014 New Revision: 27068 URL: http://svn.gna.org/viewcvs/freeciv?rev=27068&view=rev Log: Replaced magic number fogstyle with textual fog_style in tilesets.
See patch #5426 Modified: trunk/client/tilespec.c trunk/client/tilespec.h trunk/data/amplio.tilespec trunk/data/amplio2.tilespec trunk/data/cimpletoon.tilespec trunk/data/hex2t.tilespec trunk/data/hexemplio.tilespec trunk/data/isophex.tilespec trunk/data/isotrident.tilespec trunk/data/toonhex.tilespec trunk/data/trident.tilespec trunk/doc/README.graphics Modified: trunk/client/tilespec.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/tilespec.c?rev=27068&r1=27067&r2=27068&view=diff ============================================================================== --- trunk/client/tilespec.c (original) +++ trunk/client/tilespec.c Mon Nov 17 21:15:31 2014 @@ -383,13 +383,6 @@ struct drawing_data *drawing[MAX_NUM_ITEMS]; }; -/* Don't reorder this enum since tilesets depend on it. */ -enum fog_style { - FOG_AUTO, /* Fog is automatically appended by the code. */ - FOG_SPRITE, /* A single fog sprite is provided by the tileset (tx.fog). */ - FOG_NONE /* No fog. */ -}; - /* Darkness style. Don't reorder this enum since tilesets depend on it. */ enum darkness_style { /* No darkness sprites are drawn. */ @@ -1528,7 +1521,7 @@ enum direction8 dir; const int spl = strlen(TILE_SECTION_PREFIX); struct tileset *t = NULL; - int ei1, ei2; + int ei2; const char *extraname; const char *tstr; @@ -1664,15 +1657,25 @@ t->full_tile_width, t->full_tile_height, t->small_sprite_width, t->small_sprite_height); - /* FIXME: use specenum to load these. */ - if (!secfile_lookup_int(file, &ei1, - "tilespec.fogstyle") - || !secfile_lookup_int(file, &ei2, + tstr = secfile_lookup_str(file, "tilespec.fog_style"); + if (tstr == NULL) { + log_error("Tileset \"%s\": no fog_style", t->name); + goto ON_ERROR; + } + + t->fogstyle = fog_style_by_name(tstr, fc_strcasecmp); + if (!fog_style_is_valid(t->fogstyle)) { + log_error("Tileset \"%s\": unknown fogstyle \"%s\"", t->name, tstr); + goto ON_ERROR; + } + + /* FIXME: use specenum to load this. */ + if (!secfile_lookup_int(file, &ei2, "tilespec.darkness_style")) { - log_error("Tileset \"%s\" invalid: %s", t->name, secfile_error()); + log_error("Tileset \"%s\" invalid darkness_style: %s", t->name, secfile_error()); goto ON_ERROR; } - t->fogstyle = ei1; + t->darkness_style = ei2; if (t->darkness_style < DARKNESS_NONE Modified: trunk/client/tilespec.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/tilespec.h?rev=27068&r1=27067&r2=27068&view=diff ============================================================================== --- trunk/client/tilespec.h (original) +++ trunk/client/tilespec.h Mon Nov 17 21:15:31 2014 @@ -49,6 +49,18 @@ #define SPECENUM_VALUE0NAME N_("Overhead") #define SPECENUM_VALUE1 TS_ISOMETRIC #define SPECENUM_VALUE1NAME N_("Isometric") +#include "specenum_gen.h" + +#define SPECENUM_NAME fog_style +/* Fog is automatically appended by the code. */ +#define SPECENUM_VALUE0 FOG_AUTO +#define SPECENUM_VALUE0NAME "Auto" +/* A single fog sprite is provided by the tileset (tx.fog). */ +#define SPECENUM_VALUE1 FOG_SPRITE +#define SPECENUM_VALUE1NAME "Sprite" +/* No fog, or fog derived from darkness style. */ +#define SPECENUM_VALUE2 FOG_DARKNESS +#define SPECENUM_VALUE2NAME "Darkness" #include "specenum_gen.h" /* An edge is the border between two tiles. This structure represents one Modified: trunk/data/amplio.tilespec URL: http://svn.gna.org/viewcvs/freeciv/trunk/data/amplio.tilespec?rev=27068&r1=27067&r2=27068&view=diff ============================================================================== --- trunk/data/amplio.tilespec (original) +++ trunk/data/amplio.tilespec Mon Nov 17 21:15:31 2014 @@ -21,8 +21,8 @@ type = "isometric" is_hex = FALSE -; Fogstyle 2, darkness_style 4 : blended fog -fogstyle = 2 +; Blended fog +fog_style = "Darkness" darkness_style = 4 ; Which terrain layer darkness is drawn top of (0-2) darkness_layer = 0 Modified: trunk/data/amplio2.tilespec URL: http://svn.gna.org/viewcvs/freeciv/trunk/data/amplio2.tilespec?rev=27068&r1=27067&r2=27068&view=diff ============================================================================== --- trunk/data/amplio2.tilespec (original) +++ trunk/data/amplio2.tilespec Mon Nov 17 21:15:31 2014 @@ -21,8 +21,8 @@ type = "isometric" is_hex = FALSE -; Fogstyle 2, darkness_style 4 : blended fog -fogstyle = 2 +; Blended fog +fog_style = "Darkness" darkness_style = 4 ; Which terrain layer darkness is drawn top of (0-2) darkness_layer = 0 Modified: trunk/data/cimpletoon.tilespec URL: http://svn.gna.org/viewcvs/freeciv/trunk/data/cimpletoon.tilespec?rev=27068&r1=27067&r2=27068&view=diff ============================================================================== --- trunk/data/cimpletoon.tilespec (original) +++ trunk/data/cimpletoon.tilespec Mon Nov 17 21:15:31 2014 @@ -21,8 +21,8 @@ type = "isometric" is_hex = FALSE -; Fogstyle 2, darkness_style 4 : blended fog -fogstyle = 2 +; Blended fog +fog_style = "Darkness" darkness_style = 4 ; Which terrain layer darkness is drawn top of (0-2) darkness_layer = 0 Modified: trunk/data/hex2t.tilespec URL: http://svn.gna.org/viewcvs/freeciv/trunk/data/hex2t.tilespec?rev=27068&r1=27067&r2=27068&view=diff ============================================================================== --- trunk/data/hex2t.tilespec (original) +++ trunk/data/hex2t.tilespec Mon Nov 17 21:15:31 2014 @@ -22,8 +22,8 @@ hex_side = 24 is_hex = TRUE -; Use fogstyle 0 (old iso style) -fogstyle = 0 +; Use old iso style +fog_style = "Auto" ; Was darkness style 1 (single-sprite) darkness_style = 2 Modified: trunk/data/hexemplio.tilespec URL: http://svn.gna.org/viewcvs/freeciv/trunk/data/hexemplio.tilespec?rev=27068&r1=27067&r2=27068&view=diff ============================================================================== --- trunk/data/hexemplio.tilespec (original) +++ trunk/data/hexemplio.tilespec Mon Nov 17 21:15:31 2014 @@ -24,8 +24,8 @@ is_hex = TRUE type = "isometric" -; Use fogstyle 0 (old iso style) -fogstyle = 0 +; Use old iso style +fog_style = "Auto" ; Was darkness style 1 (single-sprite) darkness_style = 2 Modified: trunk/data/isophex.tilespec URL: http://svn.gna.org/viewcvs/freeciv/trunk/data/isophex.tilespec?rev=27068&r1=27067&r2=27068&view=diff ============================================================================== --- trunk/data/isophex.tilespec (original) +++ trunk/data/isophex.tilespec Mon Nov 17 21:15:31 2014 @@ -22,8 +22,8 @@ hex_side = 16 is_hex = TRUE -; Use fogstyle 0 (old iso style) -fogstyle = 0 +; Use old iso style +fog_style = "Auto" ; Was darkness style 1 (single-sprite) darkness_style = 2 Modified: trunk/data/isotrident.tilespec URL: http://svn.gna.org/viewcvs/freeciv/trunk/data/isotrident.tilespec?rev=27068&r1=27067&r2=27068&view=diff ============================================================================== --- trunk/data/isotrident.tilespec (original) +++ trunk/data/isotrident.tilespec Mon Nov 17 21:15:31 2014 @@ -21,8 +21,8 @@ type = "isometric" is_hex = FALSE -; Was fogstyle 0 (old iso style) -fogstyle = 2 +; Was old iso style +fog_style = "Darkness" ; Was darkness style 1 (single-sprite) darkness_style = 4 Modified: trunk/data/toonhex.tilespec URL: http://svn.gna.org/viewcvs/freeciv/trunk/data/toonhex.tilespec?rev=27068&r1=27067&r2=27068&view=diff ============================================================================== --- trunk/data/toonhex.tilespec (original) +++ trunk/data/toonhex.tilespec Mon Nov 17 21:15:31 2014 @@ -25,8 +25,8 @@ is_hex = TRUE type = "isometric" -; Use fogstyle 0 (old iso style) -fogstyle = 0 +; Use old iso style +fog_style = "Auto" ; Was darkness style 1 (single-sprite) darkness_style = 2 Modified: trunk/data/trident.tilespec URL: http://svn.gna.org/viewcvs/freeciv/trunk/data/trident.tilespec?rev=27068&r1=27067&r2=27068&view=diff ============================================================================== --- trunk/data/trident.tilespec (original) +++ trunk/data/trident.tilespec Mon Nov 17 21:15:31 2014 @@ -21,8 +21,8 @@ type = "overhead" is_hex = FALSE -; Was fogstyle 0 (old iso style) -fogstyle = 2 +; Was old iso style +fog_style = "Darkness" ; Was darkness style 3 (15 sprites) darkness_style = 4 Modified: trunk/doc/README.graphics URL: http://svn.gna.org/viewcvs/freeciv/trunk/doc/README.graphics?rev=27068&r1=27067&r2=27068&view=diff ============================================================================== --- trunk/doc/README.graphics (original) +++ trunk/doc/README.graphics Mon Nov 17 21:15:31 2014 @@ -97,12 +97,12 @@ height in isometric tileset small_tile_width : the width of icon sprites small_tile_height : the height of icon sprites - fogstyle : Specifies how fog is drawn. - 0 : Code automatically adds fog. - 1 : A single fog sprite is drawn on top of all - other sprites for fogged tiles. The - tx.fog sprite is used for this. - 2 : No fog, or fog from darkness_style = 4. + fog_style : Specifies how fog is drawn. + "Auto" : Code automatically adds fog. + "Sprite : A single fog sprite is drawn on top of all + other sprites for fogged tiles. The + tx.fog sprite is used for this. + "Darkness" : No fog, or fog from darkness_style = 4. darkness_style : Specifies how "encroaching darkness" is drawn. 0 : No darkness. 1 : A single sprite can be split into 4 parts, each _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits