Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2005:
[Freeciv-Dev] (PR#12521) let tileset control the citybar Y offset
Home

[Freeciv-Dev] (PR#12521) let tileset control the citybar Y offset

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#12521) let tileset control the citybar Y offset
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 15 Mar 2005 20:01:02 -0800
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=12521 >

Currently the citybar (city text under the city) is drawn right 
underneath the very bottom of the tile that the city is on.

This patch (as requested by the Artists) allows the tileset to control 
how far it is offset.  The default remains the same but I've changed the 
included tilesets to (arbitrarily) be a little higher (I think this 
looks okay but it should be tweaked by the graphics people).

There are update problems with the citybar as well.  This isn't related 
to the patch; it's in the current code.  I don't know what the error is 
but at some point I'll focus on tracking it down.

-jason

? client/.new.control.c
Index: client/mapview_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/mapview_common.c,v
retrieving revision 1.214
diff -u -r1.214 mapview_common.c
--- client/mapview_common.c     15 Mar 2005 16:04:17 -0000      1.214
+++ client/mapview_common.c     16 Mar 2005 03:56:49 -0000
@@ -41,11 +41,6 @@
 struct overview overview;
 bool can_slide = TRUE;
 
-/* Arbitrary estimated maximums for width and height of a city description
- * text.  Eventually this may be determined dynamically. */
-#define MAX_CITY_DESC_WIDTH 128
-#define MAX_CITY_DESC_HEIGHT 32
-
 /*
  * Set to TRUE if the backing store is more recent than the version
  * drawn into overview.window.
@@ -1244,7 +1239,7 @@
   *width = *height = 0;
 
   canvas_x += NORMAL_TILE_WIDTH / 2;
-  canvas_y += NORMAL_TILE_HEIGHT;
+  canvas_y += tileset_citybar_offset_y(tileset);
 
   if (draw_city_names) {
     get_city_mapview_name_and_growth(pcity, name, sizeof(name),
@@ -1296,6 +1291,7 @@
                            int width, int height)
 {
   const int dx = max_desc_width - NORMAL_TILE_WIDTH, dy = max_desc_height;
+  const int offset_y = tileset_citybar_offset_y(tileset);
 
   if (!draw_city_names && !draw_city_productions) {
     return;
@@ -1321,7 +1317,7 @@
    */
   gui_rect_iterate(mapview.gui_x0 + canvas_x - dx / 2,
                   mapview.gui_y0 + canvas_y - dy,
-                  width + dx, height + dy - NORMAL_TILE_HEIGHT,
+                  width + dx, height + dy - offset_y,
                   ptile, pedge, pcorner, gui_x, gui_y) {
     const int canvas_x = gui_x - mapview.gui_x0;
     const int canvas_y = gui_y - mapview.gui_y0;
Index: client/tilespec.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/tilespec.c,v
retrieving revision 1.267
diff -u -r1.267 tilespec.c
--- client/tilespec.c   15 Mar 2005 16:04:17 -0000      1.267
+++ client/tilespec.c   16 Mar 2005 03:56:50 -0000
@@ -158,6 +158,8 @@
   int flag_offset_x, flag_offset_y;
   int unit_offset_x, unit_offset_y;
 
+  int citybar_offset_y;
+
 #define NUM_CORNER_DIRS 4
 #define TILES_PER_CORNER 4
   int num_valid_tileset_dirs, num_cardinal_tileset_dirs;
@@ -286,6 +288,15 @@
 }
 
 /****************************************************************************
+  Return the offset from the origin of the city tile at which to place the
+  citybar text.
+****************************************************************************/
+int tileset_citybar_offset_y(struct tileset *t)
+{
+  return t->citybar_offset_y;
+}
+
+/****************************************************************************
   Return the small sprite height of the current tileset.  The small sprites
   are used for various theme graphics (e.g., citymap citizens/specialists
   as well as panel indicator icons).
@@ -1024,6 +1035,10 @@
   t->unit_offset_y = secfile_lookup_int_default(file, 0,
                                                "tilespec.unit_offset_y");
 
+  t->citybar_offset_y
+    = secfile_lookup_int_default(file, NORMAL_TILE_HEIGHT,
+                                "tilespec.citybar_offset_y");
+
   t->city_names_font_size
     = secfile_lookup_int_default(file, 10, "tilespec.city_names_font_size");
 
Index: client/tilespec.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/tilespec.h,v
retrieving revision 1.128
diff -u -r1.128 tilespec.h
--- client/tilespec.h   15 Mar 2005 16:04:17 -0000      1.128
+++ client/tilespec.h   16 Mar 2005 03:56:51 -0000
@@ -422,6 +422,7 @@
 int tileset_full_tile_height(struct tileset *t);
 int tileset_small_sprite_width(struct tileset *t);
 int tileset_small_sprite_height(struct tileset *t);
+int tileset_citybar_offset_y(struct tileset *t);
 const char *tileset_main_intro_filename(struct tileset *t);
 const char *tileset_mini_intro_filename(struct tileset *t);
 
Index: data/isophex.tilespec
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/isophex.tilespec,v
retrieving revision 1.10
diff -u -r1.10 isophex.tilespec
--- data/isophex.tilespec       3 Mar 2005 03:47:32 -0000       1.10
+++ data/isophex.tilespec       16 Mar 2005 03:56:51 -0000
@@ -33,6 +33,9 @@
 unit_offset_x = 21
 unit_offset_y = 13
 
+; offset the citybar text by this amount (from the city tile origin)
+citybar_offset_y = 20
+
 ; Hex data.
 is_hex = 1
 is_isometric = 0
Index: data/isotrident.tilespec
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/isotrident.tilespec,v
retrieving revision 1.33
diff -u -r1.33 isotrident.tilespec
--- data/isotrident.tilespec    3 Mar 2005 03:47:32 -0000       1.33
+++ data/isotrident.tilespec    16 Mar 2005 03:56:51 -0000
@@ -35,6 +35,9 @@
 unit_offset_x = 21
 unit_offset_y = 13
 
+; offset the citybar text by this amount (from the city tile origin)
+citybar_offset_y = 20
+
 ; Font size (points) to use to draw city names and productions:
 city_names_font_size = 10
 city_productions_font_size = 10
Index: data/trident.tilespec
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/trident.tilespec,v
retrieving revision 1.33
diff -u -r1.33 trident.tilespec
--- data/trident.tilespec       3 Mar 2005 03:47:32 -0000       1.33
+++ data/trident.tilespec       16 Mar 2005 03:56:51 -0000
@@ -31,6 +31,9 @@
 flag_offset_x = 0
 flag_offset_y = 0
 
+; offset the citybar text by this amount (from the city tile origin)
+citybar_offset_y = 27
+
 ; Font size (points) to use to draw city names and productions:
 city_names_font_size = 10
 city_productions_font_size = 10
Index: data/trident_shields.tilespec
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/trident_shields.tilespec,v
retrieving revision 1.24
diff -u -r1.24 trident_shields.tilespec
--- data/trident_shields.tilespec       3 Mar 2005 03:47:32 -0000       1.24
+++ data/trident_shields.tilespec       16 Mar 2005 03:56:51 -0000
@@ -22,6 +22,9 @@
 flag_offset_x = 0
 flag_offset_y = 2
 
+; offset the citybar text by this amount (from the city tile origin)
+citybar_offset_y = 27
+
 ; Do not blend hills and mountains together.
 is_mountainous = 0
 

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#12521) let tileset control the citybar Y offset, Jason Short <=