Author: cazfi
Date: Mon Dec 14 00:21:12 2015
New Revision: 30969

URL: http://svn.gna.org/viewcvs/freeciv?rev=30969&view=rev
Log:
Added support for alternative upkeep icons layout.

See patch #6564

Modified:
    trunk/client/gui-sdl2/citydlg.c
    trunk/client/tilespec.c
    trunk/client/tilespec.h
    trunk/data/alio.tilespec
    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/gui-sdl2/citydlg.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-sdl2/citydlg.c?rev=30969&r1=30968&r2=30969&view=diff
==============================================================================
--- trunk/client/gui-sdl2/citydlg.c     (original)
+++ trunk/client/gui-sdl2/citydlg.c     Mon Dec 14 00:21:12 2015
@@ -600,7 +600,7 @@
   struct canvas *destcanvas;
 
   destcanvas = canvas_create(tileset_full_tile_width(tileset),
-                             tileset_unit_with_upkeep_height(tileset));
+                             tileset_unit_with_small_upkeep_height(tileset));
 
   put_unit(punit, destcanvas, 1.0, 0, 0);
 
@@ -627,7 +627,7 @@
       step = pIcons->pFood->w;
     }
 
-    dest.y = tileset_unit_layout_offset_y(tileset);
+    dest.y = tileset_unit_layout_small_offset_y(tileset);
     dest.x = src_rect.x + src_rect.w / 8;
 
     for (i = 0; i < punit->upkeep[O_SHIELD]; i++) {

Modified: trunk/client/tilespec.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/tilespec.c?rev=30969&r1=30968&r2=30969&view=diff
==============================================================================
--- trunk/client/tilespec.c     (original)
+++ trunk/client/tilespec.c     Mon Dec 14 00:21:12 2015
@@ -492,6 +492,7 @@
   int occupied_offset_x;
   int occupied_offset_y;
   int unit_upkeep_offset_y;
+  int unit_upkeep_small_offset_y;
 
 #define NUM_CORNER_DIRS 4
 #define TILES_PER_CORNER 4
@@ -795,11 +796,32 @@
 }
 
 /****************************************************************************
+  Suitable canvas height for a unit icon that includes upkeep sprites,
+  using small space layout.
+****************************************************************************/
+int tileset_unit_with_small_upkeep_height(const struct tileset *t)
+{
+  int uk_bottom = tileset_unit_layout_small_offset_y(tileset) + 
tileset_upkeep_height(tileset);
+  int u_bottom = tileset_unit_height(tileset);
+
+  return MAX(uk_bottom, u_bottom);
+}
+
+/****************************************************************************
   Offset to layout extra unit sprites, such as upkeep.
 ****************************************************************************/
 int tileset_unit_layout_offset_y(const struct tileset *t)
 {
   return t->unit_upkeep_offset_y;
+}
+
+/****************************************************************************
+  Offset to layout extra unit sprites, such as upkeep, requesting small
+  space layout.
+****************************************************************************/
+int tileset_unit_layout_small_offset_y(const struct tileset *t)
+{
+  return t->unit_upkeep_small_offset_y;
 }
 
 /****************************************************************************
@@ -1845,6 +1867,11 @@
 
   t->unit_upkeep_offset_y = secfile_lookup_int_default(file, 
tileset_tile_height(t),
                                                        
"tilespec.unit_upkeep_offset_y");
+
+  t->unit_upkeep_offset_y = secfile_lookup_int_default(file, 
tileset_tile_height(t),
+                                                       
"tilespec.unit_upkeep_offset_y");
+  t->unit_upkeep_small_offset_y = secfile_lookup_int_default(file, 
t->unit_upkeep_offset_y,
+                                                             
"tilespec.unit_upkeep_small_offset_y");
 
   set_city_names_font_sizes(t->city_names_font_size,
                             t->city_productions_font_size);

Modified: trunk/client/tilespec.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/tilespec.h?rev=30969&r1=30968&r2=30969&view=diff
==============================================================================
--- trunk/client/tilespec.h     (original)
+++ trunk/client/tilespec.h     Mon Dec 14 00:21:12 2015
@@ -382,7 +382,9 @@
 int tileset_unit_width(const struct tileset *t);
 int tileset_unit_height(const struct tileset *t);
 int tileset_unit_with_upkeep_height(const struct tileset *t);
+int tileset_unit_with_small_upkeep_height(const struct tileset *t);
 int tileset_unit_layout_offset_y(const struct tileset *t);
+int tileset_unit_layout_small_offset_y(const struct tileset *t);
 int tileset_small_sprite_width(const struct tileset *t);
 int tileset_small_sprite_height(const struct tileset *t);
 int tileset_citybar_offset_y(const struct tileset *t);

Modified: trunk/data/alio.tilespec
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/alio.tilespec?rev=30969&r1=30968&r2=30969&view=diff
==============================================================================
--- trunk/data/alio.tilespec    (original)
+++ trunk/data/alio.tilespec    Mon Dec 14 00:21:12 2015
@@ -78,6 +78,18 @@
 ; (typical in overhead tileset), or overlay lower part of the unit icon,
 ; if unit icon is higher than tiles (typical in iso tilesets)
 ;unit_upkeep_offset_y = 0
+
+; offset the upkeep icons by this amount from the top of the unit itself.
+; The default is the normal tile height, which means that the upkeep icons
+; appear below the unit icon if the unit icons are equal to tile height
+; (typical in overhead tileset), or overlay lower part of the unit icon,
+; if unit icon is higher than tiles (typical in iso tilesets)
+;unit_upkeep_offset_y = 0
+
+; Like unit_upkeep_offset_y, but to be used in case there's only small
+; space for the overall icon produced. Defaults to unit_upkeep_offset_y -
+; not having alternative layout.
+;unit_upkeep_small_offset_y = 0
 
 ; Font to use to draw city names:
 city_names_font = "9x15bold"

Modified: trunk/data/amplio.tilespec
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/amplio.tilespec?rev=30969&r1=30968&r2=30969&view=diff
==============================================================================
--- trunk/data/amplio.tilespec  (original)
+++ trunk/data/amplio.tilespec  Mon Dec 14 00:21:12 2015
@@ -68,6 +68,18 @@
 ; (typical in overhead tileset), or overlay lower part of the unit icon,
 ; if unit icon is higher than tiles (typical in iso tilesets)
 ;unit_upkeep_offset_y = 0
+
+; offset the upkeep icons by this amount from the top of the unit itself.
+; The default is the normal tile height, which means that the upkeep icons
+; appear below the unit icon if the unit icons are equal to tile height
+; (typical in overhead tileset), or overlay lower part of the unit icon,
+; if unit icon is higher than tiles (typical in iso tilesets)
+;unit_upkeep_offset_y = 0
+
+; Like unit_upkeep_offset_y, but to be used in case there's only small
+; space for the overall icon produced. Defaults to unit_upkeep_offset_y -
+; not having alternative layout.
+;unit_upkeep_small_offset_y = 0
 
 ; Font size (points) to use to draw city names and productions:
 city_names_font_size = 10

Modified: trunk/data/amplio2.tilespec
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/amplio2.tilespec?rev=30969&r1=30968&r2=30969&view=diff
==============================================================================
--- trunk/data/amplio2.tilespec (original)
+++ trunk/data/amplio2.tilespec Mon Dec 14 00:21:12 2015
@@ -68,6 +68,18 @@
 ; (typical in overhead tileset), or overlay lower part of the unit icon,
 ; if unit icon is higher than tiles (typical in iso tilesets)
 ;unit_upkeep_offset_y = 0
+
+; offset the upkeep icons by this amount from the top of the unit itself.
+; The default is the normal tile height, which means that the upkeep icons
+; appear below the unit icon if the unit icons are equal to tile height
+; (typical in overhead tileset), or overlay lower part of the unit icon,
+; if unit icon is higher than tiles (typical in iso tilesets)
+;unit_upkeep_offset_y = 0
+
+; Like unit_upkeep_offset_y, but to be used in case there's only small
+; space for the overall icon produced. Defaults to unit_upkeep_offset_y -
+; not having alternative layout.
+;unit_upkeep_small_offset_y = 0
 
 ; Font size (points) to use to draw city names and productions:
 city_names_font_size = 10

Modified: trunk/data/cimpletoon.tilespec
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/cimpletoon.tilespec?rev=30969&r1=30968&r2=30969&view=diff
==============================================================================
--- trunk/data/cimpletoon.tilespec      (original)
+++ trunk/data/cimpletoon.tilespec      Mon Dec 14 00:21:12 2015
@@ -68,6 +68,18 @@
 ; (typical in overhead tileset), or overlay lower part of the unit icon,
 ; if unit icon is higher than tiles (typical in iso tilesets)
 ;unit_upkeep_offset_y = 0
+
+; offset the upkeep icons by this amount from the top of the unit itself.
+; The default is the normal tile height, which means that the upkeep icons
+; appear below the unit icon if the unit icons are equal to tile height
+; (typical in overhead tileset), or overlay lower part of the unit icon,
+; if unit icon is higher than tiles (typical in iso tilesets)
+;unit_upkeep_offset_y = 0
+
+; Like unit_upkeep_offset_y, but to be used in case there's only small
+; space for the overall icon produced. Defaults to unit_upkeep_offset_y -
+; not having alternative layout.
+;unit_upkeep_small_offset_y = 0
 
 ; Font size (points) to use to draw city names and productions:
 city_names_font_size = 10

Modified: trunk/data/hex2t.tilespec
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/hex2t.tilespec?rev=30969&r1=30968&r2=30969&view=diff
==============================================================================
--- trunk/data/hex2t.tilespec   (original)
+++ trunk/data/hex2t.tilespec   Mon Dec 14 00:21:12 2015
@@ -71,6 +71,18 @@
 ; (typical in overhead tileset), or overlay lower part of the unit icon,
 ; if unit icon is higher than tiles (typical in iso tilesets)
 ;unit_upkeep_offset_y = 0
+
+; offset the upkeep icons by this amount from the top of the unit itself.
+; The default is the normal tile height, which means that the upkeep icons
+; appear below the unit icon if the unit icons are equal to tile height
+; (typical in overhead tileset), or overlay lower part of the unit icon,
+; if unit icon is higher than tiles (typical in iso tilesets)
+;unit_upkeep_offset_y = 0
+
+; Like unit_upkeep_offset_y, but to be used in case there's only small
+; space for the overall icon produced. Defaults to unit_upkeep_offset_y -
+; not having alternative layout.
+;unit_upkeep_small_offset_y = 0
 
 ; Font to use to draw city names:
 city_names_font = "6x13bold"

Modified: trunk/data/hexemplio.tilespec
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/hexemplio.tilespec?rev=30969&r1=30968&r2=30969&view=diff
==============================================================================
--- trunk/data/hexemplio.tilespec       (original)
+++ trunk/data/hexemplio.tilespec       Mon Dec 14 00:21:12 2015
@@ -74,6 +74,18 @@
 ; (typical in overhead tileset), or overlay lower part of the unit icon,
 ; if unit icon is higher than tiles (typical in iso tilesets)
 ;unit_upkeep_offset_y = 0
+
+; offset the upkeep icons by this amount from the top of the unit itself.
+; The default is the normal tile height, which means that the upkeep icons
+; appear below the unit icon if the unit icons are equal to tile height
+; (typical in overhead tileset), or overlay lower part of the unit icon,
+; if unit icon is higher than tiles (typical in iso tilesets)
+;unit_upkeep_offset_y = 0
+
+; Like unit_upkeep_offset_y, but to be used in case there's only small
+; space for the overall icon produced. Defaults to unit_upkeep_offset_y -
+; not having alternative layout.
+;unit_upkeep_small_offset_y = 0
 
 ; Font to use to draw city names:
 city_names_font = "9x15bold"

Modified: trunk/data/isophex.tilespec
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/isophex.tilespec?rev=30969&r1=30968&r2=30969&view=diff
==============================================================================
--- trunk/data/isophex.tilespec (original)
+++ trunk/data/isophex.tilespec Mon Dec 14 00:21:12 2015
@@ -71,6 +71,18 @@
 ; (typical in overhead tileset), or overlay lower part of the unit icon,
 ; if unit icon is higher than tiles (typical in iso tilesets)
 ;unit_upkeep_offset_y = 0
+
+; offset the upkeep icons by this amount from the top of the unit itself.
+; The default is the normal tile height, which means that the upkeep icons
+; appear below the unit icon if the unit icons are equal to tile height
+; (typical in overhead tileset), or overlay lower part of the unit icon,
+; if unit icon is higher than tiles (typical in iso tilesets)
+;unit_upkeep_offset_y = 0
+
+; Like unit_upkeep_offset_y, but to be used in case there's only small
+; space for the overall icon produced. Defaults to unit_upkeep_offset_y -
+; not having alternative layout.
+;unit_upkeep_small_offset_y = 0
 
 ; Font to use to draw city names:
 city_names_font = "9x15bold"

Modified: trunk/data/isotrident.tilespec
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/isotrident.tilespec?rev=30969&r1=30968&r2=30969&view=diff
==============================================================================
--- trunk/data/isotrident.tilespec      (original)
+++ trunk/data/isotrident.tilespec      Mon Dec 14 00:21:12 2015
@@ -70,6 +70,18 @@
 ; (typical in overhead tileset), or overlay lower part of the unit icon,
 ; if unit icon is higher than tiles (typical in iso tilesets)
 ;unit_upkeep_offset_y = 0
+
+; offset the upkeep icons by this amount from the top of the unit itself.
+; The default is the normal tile height, which means that the upkeep icons
+; appear below the unit icon if the unit icons are equal to tile height
+; (typical in overhead tileset), or overlay lower part of the unit icon,
+; if unit icon is higher than tiles (typical in iso tilesets)
+;unit_upkeep_offset_y = 0
+
+; Like unit_upkeep_offset_y, but to be used in case there's only small
+; space for the overall icon produced. Defaults to unit_upkeep_offset_y -
+; not having alternative layout.
+;unit_upkeep_small_offset_y = 0
 
 ; Font size (points) to use to draw city names and productions:
 city_names_font_size = 10

Modified: trunk/data/toonhex.tilespec
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/toonhex.tilespec?rev=30969&r1=30968&r2=30969&view=diff
==============================================================================
--- trunk/data/toonhex.tilespec (original)
+++ trunk/data/toonhex.tilespec Mon Dec 14 00:21:12 2015
@@ -75,6 +75,18 @@
 ; (typical in overhead tileset), or overlay lower part of the unit icon,
 ; if unit icon is higher than tiles (typical in iso tilesets)
 ;unit_upkeep_offset_y = 0
+
+; offset the upkeep icons by this amount from the top of the unit itself.
+; The default is the normal tile height, which means that the upkeep icons
+; appear below the unit icon if the unit icons are equal to tile height
+; (typical in overhead tileset), or overlay lower part of the unit icon,
+; if unit icon is higher than tiles (typical in iso tilesets)
+;unit_upkeep_offset_y = 0
+
+; Like unit_upkeep_offset_y, but to be used in case there's only small
+; space for the overall icon produced. Defaults to unit_upkeep_offset_y -
+; not having alternative layout.
+;unit_upkeep_small_offset_y = 0
 
 ; Font to use to draw city names:
 city_names_font = "9x15bold"

Modified: trunk/data/trident.tilespec
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/trident.tilespec?rev=30969&r1=30968&r2=30969&view=diff
==============================================================================
--- trunk/data/trident.tilespec (original)
+++ trunk/data/trident.tilespec Mon Dec 14 00:21:12 2015
@@ -70,6 +70,20 @@
 ; (typical in overhead tileset), or overlay lower part of the unit icon,
 ; if unit icon is higher than tiles (typical in iso tilesets)
 ;unit_upkeep_offset_y = 0
+
+; offset the upkeep icons by this amount from the top of the unit itself.
+; The default is the normal tile height, which means that the upkeep icons
+; appear below the unit icon if the unit icons are equal to tile height
+; (typical in overhead tileset), or overlay lower part of the unit icon,
+; if unit icon is higher than tiles (typical in iso tilesets)
+;unit_upkeep_offset_y = 0
+
+; Like unit_upkeep_offset_y, but to be used in case there's only small
+; space for the overall icon produced. Defaults to unit_upkeep_offset_y -
+; not having alternative layout.
+; Set it to overlay lower part of the unit icon instead of taking extra
+; space below.
+unit_upkeep_small_offset_y = 20
 
 ; Font size (points) to use to draw city names and productions:
 city_names_font_size = 10

Modified: trunk/doc/README.graphics
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/doc/README.graphics?rev=30969&r1=30968&r2=30969&view=diff
==============================================================================
--- trunk/doc/README.graphics   (original)
+++ trunk/doc/README.graphics   Mon Dec 14 00:21:12 2015
@@ -138,6 +138,10 @@
                            equal to tile height (typical in overhead tileset)
                          - Upkeep icons overlay lower part of the unit icon, 
if unit icon
                            is higher than tile height (typical in iso tilesets)
+  unit_upkeep_small_offset_y:
+                         Like unit_upkeep_offset_y, but to be used in case 
there's only small
+                         space for the overall icon produced. Defaults to 
unit_upkeep_offset_y -
+                         not having alternative layout.
   citybar_offset_y     : Gives an offset from city tile origin at which to
                          draw city bar text.
   hex_side             : When is_hex is specified (see is_hex, below), this


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to