From 271b56368d57953a70f35b4a5ec9fbf86f4b6bfe Mon Sep 17 00:00:00 2001 From: mir3x Date: Thu, 2 Feb 2017 19:56:50 +0000 Subject: [PATCH] Fixed some tileset variables scaled 2 times See bug #25474 git-svn-id: svn://svn.gna.org/svn/freeciv/branches/S2_6@34939 a0f10bec-cc02-0410-94fc-a9cfff90b4cd --- client/tilespec.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/client/tilespec.c b/client/tilespec.c index 409550ff36..ae9672e70b 100644 --- a/client/tilespec.c +++ b/client/tilespec.c @@ -1915,8 +1915,12 @@ struct tileset *tileset_read_toplevel(const char *tileset_name, bool verbose, log_error("Tileset \"%s\" invalid: %s", t->name, secfile_error()); goto ON_ERROR; } - t->unit_tile_width = ceil(t->unit_tile_width * t->scale); - t->unit_tile_height = ceil(t->unit_tile_height * t->scale); + if (t->unit_tile_width != t->unit_tile_width && t->scale != 1.0f) { + t->unit_tile_width = ceil(t->unit_tile_width * t->scale); + } + if (t->unit_tile_height != t->unit_tile_height && t->scale != 1.0f) { + t->unit_tile_height = ceil(t->unit_tile_height * t->scale); + } t->small_sprite_width = t->small_sprite_width * t->scale; t->small_sprite_height = t->small_sprite_height * t->scale; log_verbose("tile sizes %dx%d, %d%d unit, %d%d small", @@ -2014,9 +2018,14 @@ struct tileset *tileset_read_toplevel(const char *tileset_name, bool verbose, t->tilelabel_offset_y = t->scale * t->tilelabel_offset_y; t->occupied_offset_x = t->scale * t->occupied_offset_x; t->occupied_offset_y = t->scale * t->occupied_offset_y; - t->unit_upkeep_offset_y = t->scale * t->unit_upkeep_offset_y; - t->unit_upkeep_small_offset_y = t->scale * t->unit_upkeep_small_offset_y; - + if (t->scale != 1.0f + && t->unit_upkeep_offset_y != tileset_tile_height(t)) { + t->unit_upkeep_offset_y = t->scale * t->unit_upkeep_offset_y; + } + if (t->scale != 1.0f + && t->unit_upkeep_small_offset_y != t->unit_upkeep_offset_y) { + t->unit_upkeep_small_offset_y = t->scale * t->unit_upkeep_small_offset_y; + } set_city_names_font_sizes(t->city_names_font_size, t->city_productions_font_size); -- 2.11.4.GIT