[Freeciv-Dev] (PR#14163) make tileset options manditory
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=14163 >
This patch makes several tileset options manditory. This cuts down on
code and makes the tilespec files more consistent. They were originally
made optional to allow the client options tileset switching code to work
with older tilesets...but this code now checks capabilities so this is
no longer needed.
-jason
Index: client/tilespec.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/tilespec.c,v
retrieving revision 1.324
diff -p -u -r1.324 tilespec.c
--- client/tilespec.c 22 Sep 2005 04:50:51 -0000 1.324
+++ client/tilespec.c 2 Oct 2005 22:28:22 -0000
@@ -1061,15 +1061,8 @@ static void scan_specfile(struct tileset
int x_top_left, y_top_left, dx, dy;
int pixel_border;
- pixel_border =
- secfile_lookup_int_default(file, -1, "%s.pixel_border", gridnames[i]);
- if (pixel_border < 0) {
- /* is_pixel_border is used in old tilesets. */
- pixel_border =
- (secfile_lookup_bool_default(file, FALSE,
- "%s.is_pixel_border", gridnames[i])
- ? 1 : 0);
- }
+ pixel_border = secfile_lookup_int_default(file, 0, "%s.pixel_border",
+ gridnames[i]);
x_top_left = secfile_lookup_int(file, "%s.x_top_left", gridnames[i]);
y_top_left = secfile_lookup_int(file, "%s.y_top_left", gridnames[i]);
@@ -1247,14 +1240,15 @@ struct tileset *tileset_read_toplevel(co
(void) section_file_lookup(file, "tilespec.name"); /* currently unused */
sz_strlcpy(t->name, tileset_name);
- t->priority = secfile_lookup_int_default(file, 0, "tilespec.priority");
+ t->priority = secfile_lookup_int(file, "tilespec.priority");
- t->is_isometric = secfile_lookup_bool_default(file, FALSE,
- "tilespec.is_isometric");
+ t->is_isometric = secfile_lookup_bool(file, "tilespec.is_isometric");
/* Read hex-tileset information. */
- is_hex = secfile_lookup_bool_default(file, FALSE, "tilespec.is_hex");
- hex_side = secfile_lookup_int_default(file, 0, "tilespec.hex_side");
+ is_hex = secfile_lookup_bool(file, "tilespec.is_hex");
+ if (is_hex) {
+ hex_side = secfile_lookup_int(file, "tilespec.hex_side");
+ }
t->hex_width = t->hex_height = 0;
if (is_hex) {
if (t->is_isometric) {
@@ -1326,12 +1320,8 @@ struct tileset *tileset_read_toplevel(co
t->full_tile_width, t->full_tile_height,
t->small_sprite_width, t->small_sprite_height);
- t->roadstyle = secfile_lookup_int_default(file, t->is_isometric ? 0 : 1,
- "tilespec.roadstyle");
- t->fogstyle
- = secfile_lookup_int_default(file,
- t->is_isometric ? FOG_AUTO : FOG_SPRITE,
- "tilespec.fogstyle");
+ t->roadstyle = secfile_lookup_int(file, "tilespec.roadstyle");
+ t->fogstyle = secfile_lookup_int(file, "tilespec.fogstyle");
t->darkness_style = secfile_lookup_int(file, "tilespec.darkness_style");
if (t->darkness_style < DARKNESS_NONE
|| t->darkness_style > DARKNESS_CORNER
@@ -1340,25 +1330,19 @@ struct tileset *tileset_read_toplevel(co
freelog(LOG_FATAL, _("Invalid darkness style set in tileset."));
exit(EXIT_FAILURE);
}
- t->flag_offset_x = secfile_lookup_int_default(file, 0,
- "tilespec.flag_offset_x");
- t->flag_offset_y = secfile_lookup_int_default(file, 0,
- "tilespec.flag_offset_y");
- t->unit_offset_x = secfile_lookup_int_default(file, 0,
- "tilespec.unit_offset_x");
- t->unit_offset_y = secfile_lookup_int_default(file, 0,
- "tilespec.unit_offset_y");
+ t->flag_offset_x = secfile_lookup_int(file, "tilespec.flag_offset_x");
+ t->flag_offset_y = secfile_lookup_int(file, "tilespec.flag_offset_y");
+ t->unit_offset_x = secfile_lookup_int(file, "tilespec.unit_offset_x");
+ t->unit_offset_y = secfile_lookup_int(file, "tilespec.unit_offset_y");
t->citybar_offset_y
- = secfile_lookup_int_default(file, t->normal_tile_height,
- "tilespec.citybar_offset_y");
+ = secfile_lookup_int(file, "tilespec.citybar_offset_y");
t->city_names_font_size
- = secfile_lookup_int_default(file, 10, "tilespec.city_names_font_size");
+ = secfile_lookup_int(file, "tilespec.city_names_font_size");
t->city_productions_font_size
- = secfile_lookup_int_default(file, 10,
- "tilespec.city_productions_font_size");
+ = secfile_lookup_int(file, "tilespec.city_productions_font_size");
set_city_names_font_sizes(t->city_names_font_size,
t->city_productions_font_size);
@@ -1372,15 +1356,18 @@ struct tileset *tileset_read_toplevel(co
/* Terrain layer info. */
for (i = 0; i < MAX_NUM_LAYERS; i++) {
- char *style = secfile_lookup_str_default(file, "none",
- "layer%d.match_style", i);
+ char *style = secfile_lookup_str(file, "layer%d.match_style", i);
int j;
if (mystrcasecmp(style, "full") == 0) {
t->layers[i].match_style = MATCH_FULL;
} else if (mystrcasecmp(style, "bool") == 0) {
t->layers[i].match_style = MATCH_BOOLEAN;
+ } else if (mystrcasecmp(style, "none") == 0) {
+ t->layers[i].match_style = MATCH_NONE;
} else {
+ freelog(LOG_ERROR, "Invalid match style %s for layer %d.",
+ style, i);
t->layers[i].match_style = MATCH_NONE;
}
Index: data/amplio.tilespec
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/amplio.tilespec,v
retrieving revision 1.2
diff -p -u -r1.2 amplio.tilespec
--- data/amplio.tilespec 2 Oct 2005 21:34:08 -0000 1.2
+++ data/amplio.tilespec 2 Oct 2005 22:28:22 -0000
@@ -18,6 +18,7 @@ small_tile_width = 15
small_tile_height = 20
is_isometric = 1
+is_hex = 0
; Do not blend hills and mountains together.
is_mountainous = 0
Index: data/isophex.tilespec
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/isophex.tilespec,v
retrieving revision 1.19
diff -p -u -r1.19 isophex.tilespec
--- data/isophex.tilespec 9 Jun 2005 18:34:45 -0000 1.19
+++ data/isophex.tilespec 2 Oct 2005 22:28:22 -0000
@@ -51,6 +51,10 @@ city_productions_font = "6x13"
; Should flags be drawn as transparent: (else opaque)
flags_are_transparent = 1
+; Font size (points) to use to draw city names and productions:
+city_names_font_size = 10
+city_productions_font_size = 10
+
; These are special because they get freed and reloaded
; as required:
main_intro_file = "misc/intro"
Index: data/isotrident.tilespec
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/isotrident.tilespec,v
retrieving revision 1.42
diff -p -u -r1.42 isotrident.tilespec
--- data/isotrident.tilespec 9 Jun 2005 18:34:45 -0000 1.42
+++ data/isotrident.tilespec 2 Oct 2005 22:28:22 -0000
@@ -18,6 +18,7 @@ small_tile_width = 15
small_tile_height = 20
is_isometric = 1
+is_hex = 0
; Use roadstyle 0 (old iso style)
roadstyle = 0
Index: data/trident.tilespec
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/trident.tilespec,v
retrieving revision 1.43
diff -p -u -r1.43 trident.tilespec
--- data/trident.tilespec 9 Jun 2005 18:34:45 -0000 1.43
+++ data/trident.tilespec 2 Oct 2005 22:28:22 -0000
@@ -18,6 +18,7 @@ small_tile_width = 15
small_tile_height = 20
is_isometric = 0
+is_hex = 0
; Use roadstyle 1 (old non-iso style)
roadstyle = 1
@@ -31,6 +32,10 @@ darkness_style = 4
; offset the flags by this amount when drawing units
flag_offset_x = 0
flag_offset_y = 0
+
+; offset the units by this amount when drawing units
+unit_offset_x = 0
+unit_offset_y = 0
; offset the citybar text by this amount (from the city tile origin)
citybar_offset_y = 27
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] (PR#14163) make tileset options manditory,
Jason Short <=
|
|