Complete.Org: Mailing Lists: Archives: freeciv-dev: April 2005:
[Freeciv-Dev] (PR#12880) make the citybar a client option
Home

[Freeciv-Dev] (PR#12880) make the citybar a client option

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#12880) make the citybar a client option
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 23 Apr 2005 15:21:50 -0700
Reply-to: bugs@xxxxxxxxxxx

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

This patch makes the full citybar into a client option.  This is mostly
useful because some people would probably want to disable it even in
freim96.  It defaults to on.

Also attached are the citybar graphics.  All tilesets must now include
these.

-jason

? data/mom
? data/mom.serv
? data/misc/citybar.png
? data/misc/citybar.spec
Index: client/mapview_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/mapview_common.c,v
retrieving revision 1.229
diff -u -r1.229 mapview_common.c
--- client/mapview_common.c     23 Apr 2005 17:40:22 -0000      1.229
+++ client/mapview_common.c     23 Apr 2005 22:20:33 -0000
@@ -1490,7 +1490,7 @@
                           int canvas_x, int canvas_y,
                           struct city *pcity, int *width, int *height)
 {
-  if (tileset_is_full_citybar(tileset)) {
+  if (draw_full_citybar) {
     show_full_citybar(pcanvas, canvas_x, canvas_y, pcity, width, height);
   } else {
     show_small_citybar(pcanvas, canvas_x, canvas_y, pcity, width, height);
Index: client/options.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/options.c,v
retrieving revision 1.125
diff -u -r1.125 options.c
--- client/options.c    20 Apr 2005 16:42:10 -0000      1.125
+++ client/options.c    23 Apr 2005 22:20:33 -0000
@@ -160,6 +160,11 @@
                  N_("If this option is disabled them combat animation "
                     "between units on the mapview will be turned off."),
                  COC_GRAPHICS),
+  GEN_BOOL_OPTION(draw_full_citybar, N_("Draw a larger citybar"),
+                 N_("If this option is set then instead of just the city "
+                    "name and attributes, a large amount of data will be "
+                    "drawn beneach each city in the 'citybar'."),
+                 COC_GRAPHICS),
   GEN_BOOL_OPTION(ai_manual_turn_done, N_("Manual Turn Done in AI Mode"),
                  N_("If this option is disabled, then you will not have "
                     "to press the turn done button manually when watching "
@@ -228,6 +233,7 @@
 bool draw_focus_unit = FALSE;
 bool draw_fog_of_war = TRUE;
 bool draw_borders = TRUE;
+bool draw_full_citybar = TRUE;
 
 #define VIEW_OPTION(name) { #name, &name }
 #define VIEW_OPTION_TERMINATOR { NULL, NULL }
Index: client/options.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/options.h,v
retrieving revision 1.48
diff -u -r1.48 options.h
--- client/options.h    9 Feb 2005 16:23:12 -0000       1.48
+++ client/options.h    23 Apr 2005 22:20:33 -0000
@@ -137,6 +137,7 @@
 extern bool draw_focus_unit;
 extern bool draw_fog_of_war;
 extern bool draw_borders;
+extern bool draw_full_citybar;
 
 typedef struct {
   const char *name;
Index: client/tilespec.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/tilespec.c,v
retrieving revision 1.295
diff -u -r1.295 tilespec.c
--- client/tilespec.c   23 Apr 2005 17:40:23 -0000      1.295
+++ client/tilespec.c   23 Apr 2005 22:20:33 -0000
@@ -353,7 +353,6 @@
   int flag_offset_x, flag_offset_y;
   int unit_offset_x, unit_offset_y;
 
-  bool is_full_citybar;
   int citybar_offset_y;
 
 #define NUM_CORNER_DIRS 4
@@ -514,16 +513,6 @@
 }
 
 /****************************************************************************
-  Return TRUE iff a "full" citybar is to be used.  The full citybar draws
-  the flag and size and occupied sprites as part of the citybar instead of
-  behind the city.
-****************************************************************************/
-bool tileset_is_full_citybar(const struct tileset *t)
-{
-  return t->is_full_citybar;
-}
-
-/****************************************************************************
   Return the offset from the origin of the city tile at which to place the
   citybar text.
 ****************************************************************************/
@@ -1316,8 +1305,6 @@
   t->unit_offset_y = secfile_lookup_int_default(file, 0,
                                                "tilespec.unit_offset_y");
 
-  t->is_full_citybar
-    = secfile_lookup_bool_default(file, FALSE, "tilespec.is_full_citybar");
   t->citybar_offset_y
     = secfile_lookup_int_default(file, t->normal_tile_height,
                                 "tilespec.citybar_offset_y");
@@ -1979,26 +1966,24 @@
     }
   }
 
-  if (t->is_full_citybar) {
-    SET_SPRITE(citybar.shields, "citybar.shields");
-    SET_SPRITE(citybar.food, "citybar.food");
-    SET_SPRITE(citybar.occupied, "citybar.occupied");
-    SET_SPRITE(citybar.background, "citybar.background");
-    sprite_vector_init(&t->sprites.citybar.occupancy);
-    for (i = 0; ; i++) {
-      struct sprite *sprite;
-
-      my_snprintf(buffer, sizeof(buffer), "citybar.occupancy_%d", i);
-      sprite = load_sprite(t, buffer);
-      if (!sprite) {
-       break;
-      }
-      sprite_vector_append(&t->sprites.citybar.occupancy, &sprite);
-    }
-    if (t->sprites.citybar.occupancy.size < 2) {
-      freelog(LOG_FATAL, "Missing necessary citybar.occupancy_N sprites.");
-      exit(EXIT_FAILURE);
+  SET_SPRITE(citybar.shields, "citybar.shields");
+  SET_SPRITE(citybar.food, "citybar.food");
+  SET_SPRITE(citybar.occupied, "citybar.occupied");
+  SET_SPRITE(citybar.background, "citybar.background");
+  sprite_vector_init(&t->sprites.citybar.occupancy);
+  for (i = 0; ; i++) {
+    struct sprite *sprite;
+
+    my_snprintf(buffer, sizeof(buffer), "citybar.occupancy_%d", i);
+    sprite = load_sprite(t, buffer);
+    if (!sprite) {
+      break;
     }
+    sprite_vector_append(&t->sprites.citybar.occupancy, &sprite);
+  }
+  if (t->sprites.citybar.occupancy.size < 2) {
+    freelog(LOG_FATAL, "Missing necessary citybar.occupancy_N sprites.");
+    exit(EXIT_FAILURE);
   }
 
   SET_SPRITE(city.disorder, "city.disorder");
@@ -3869,13 +3854,13 @@
   case LAYER_CITY1:
     /* City.  Some city sprites are drawn later. */
     if (pcity && draw_cities) {
-      if (!t->is_full_citybar && !solid_color_behind_units) {
+      if (!draw_full_citybar && !solid_color_behind_units) {
        ADD_SPRITE(get_city_flag_sprite(t, pcity), TRUE,
                   FULL_TILE_X_OFFSET + t->flag_offset_x,
                   FULL_TILE_Y_OFFSET + t->flag_offset_y);
       }
       ADD_SPRITE_FULL(get_city_sprite(t, pcity));
-      if (!t->is_full_citybar && pcity->client.occupied) {
+      if (!draw_full_citybar && pcity->client.occupied) {
        ADD_SPRITE_FULL(get_city_occupied_sprite(t, pcity));
       }
       if (!t->is_isometric && city_got_citywalls(pcity)) {
@@ -3909,7 +3894,7 @@
 
   case LAYER_CITY2:
     /* City size.  Drawing this under fog makes it hard to read. */
-    if (pcity && draw_cities && !t->is_full_citybar) {
+    if (pcity && draw_cities && !draw_full_citybar) {
       if (pcity->size >= 10) {
        ADD_SPRITE(t->sprites.city.size_tens[pcity->size / 10],
                   FALSE, FULL_TILE_X_OFFSET, FULL_TILE_Y_OFFSET);
@@ -4255,9 +4240,7 @@
 
   sprite_vector_free(&t->sprites.explode.unit);
   sprite_vector_free(&t->sprites.nation_flag);
-  if (t->is_full_citybar) {
-    sprite_vector_free(&t->sprites.citybar.occupancy);
-  }
+  sprite_vector_free(&t->sprites.citybar.occupancy);
 }
 
 /**************************************************************************
@@ -4428,7 +4411,7 @@
 **************************************************************************/
 const struct citybar_sprites *get_citybar_sprites(const struct tileset *t)
 {
-  if (t->is_full_citybar) {
+  if (draw_full_citybar) {
     return &t->sprites.citybar;
   } else {
     return NULL;
Index: client/tilespec.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/tilespec.h,v
retrieving revision 1.149
diff -u -r1.149 tilespec.h
--- client/tilespec.h   20 Apr 2005 02:36:33 -0000      1.149
+++ client/tilespec.h   23 Apr 2005 22:20:33 -0000
@@ -232,7 +232,6 @@
 int tileset_full_tile_height(const struct tileset *t);
 int tileset_small_sprite_width(const struct tileset *t);
 int tileset_small_sprite_height(const struct tileset *t);
-bool tileset_is_full_citybar(const struct tileset *t);
 int tileset_citybar_offset_y(const struct tileset *t);
 const char *tileset_main_intro_filename(const struct tileset *t);
 const char *tileset_mini_intro_filename(const struct tileset *t);
Index: data/isophex.tilespec
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/isophex.tilespec,v
retrieving revision 1.14
diff -u -r1.14 isophex.tilespec
--- data/isophex.tilespec       20 Apr 2005 02:36:33 -0000      1.14
+++ data/isophex.tilespec       23 Apr 2005 22:20:33 -0000
@@ -34,7 +34,6 @@
 unit_offset_y = 13
 
 ; offset the citybar text by this amount (from the city tile origin)
-is_full_citybar = 0
 citybar_offset_y = 20
 
 ; Hex data.
@@ -63,6 +62,7 @@
 files = 
   "misc/colors.spec",
   "misc/overlays.spec",
+  "misc/citybar.spec",
   "isophex/terrain1.spec",
   "isophex/terrain2.spec",
   "isophex/darkness.spec",
Index: data/isotrident.tilespec
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/isotrident.tilespec,v
retrieving revision 1.37
diff -u -r1.37 isotrident.tilespec
--- data/isotrident.tilespec    20 Apr 2005 02:36:33 -0000      1.37
+++ data/isotrident.tilespec    23 Apr 2005 22:20:33 -0000
@@ -36,7 +36,6 @@
 unit_offset_y = 13
 
 ; offset the citybar text by this amount (from the city tile origin)
-is_full_citybar = 0
 citybar_offset_y = 20
 
 ; Font size (points) to use to draw city names and productions:
@@ -55,6 +54,7 @@
 files = 
   "misc/colors.spec",
   "misc/overlays.spec",
+  "misc/citybar.spec",
   "isotrident/terrain1.spec",
   "isotrident/terrain2.spec",
   "isotrident/tiles.spec",
Index: data/trident.tilespec
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/trident.tilespec,v
retrieving revision 1.37
diff -u -r1.37 trident.tilespec
--- data/trident.tilespec       20 Apr 2005 02:36:33 -0000      1.37
+++ data/trident.tilespec       23 Apr 2005 22:20:33 -0000
@@ -32,7 +32,6 @@
 flag_offset_y = 0
 
 ; offset the citybar text by this amount (from the city tile origin)
-is_full_citybar = 0
 citybar_offset_y = 27
 
 ; Font size (points) to use to draw city names and productions:
@@ -51,6 +50,7 @@
 files = 
   "misc/colors.spec",
   "misc/overlays.spec",
+  "misc/citybar.spec",
   "trident/tiles.spec",
   "misc/small.spec",
   "trident/units.spec",
Index: data/trident_shields.tilespec
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/trident_shields.tilespec,v
retrieving revision 1.28
diff -u -r1.28 trident_shields.tilespec
--- data/trident_shields.tilespec       20 Apr 2005 02:36:33 -0000      1.28
+++ data/trident_shields.tilespec       23 Apr 2005 22:20:33 -0000
@@ -23,7 +23,6 @@
 flag_offset_y = 2
 
 ; offset the citybar text by this amount (from the city tile origin)
-is_full_citybar = 0
 citybar_offset_y = 27
 
 ; Do not blend hills and mountains together.
@@ -54,6 +53,7 @@
 files = 
   "misc/colors.spec",
   "misc/overlays.spec",
+  "misc/citybar.spec",
   "trident/tiles.spec",
   "misc/small.spec",
   "trident/units.spec",
Index: data/misc/Makefile.am
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/misc/Makefile.am,v
retrieving revision 1.12
diff -u -r1.12 Makefile.am
--- data/misc/Makefile.am       16 Mar 2005 19:30:38 -0000      1.12
+++ data/misc/Makefile.am       23 Apr 2005 22:20:34 -0000
@@ -8,6 +8,8 @@
        buildings.spec  \
        chiefs.png      \
        chiefs.spec     \
+       citybar.png     \
+       citybar.spec    \
        cityicon.png    \
        civicon.png     \
        colors.png      \

Attachment: citybar.tar.gz
Description: Unix tar archive


[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#12880) make the citybar a client option, Jason Short <=