Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2005:
[Freeciv-Dev] (PR#12471) add tileset parameters to the tileset query fun
Home

[Freeciv-Dev] (PR#12471) add tileset parameters to the tileset query fun

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#12471) add tileset parameters to the tileset query functions
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 9 Mar 2005 19:19:17 -0800
Reply-to: bugs@xxxxxxxxxxx

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

This patch adds a tileset struct parameter to tileset_is_isometric() and 
other tileset query functions.  The effect is to encapsulate the tileset 
data even more (the tileset variable may even be moved out of tilespec.c).

The basic changes are in the interface in tilespec.[ch].  The rest is 
just search-and-replace.

-jason

Index: client/citydlg_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/citydlg_common.c,v
retrieving revision 1.66
diff -u -r1.66 citydlg_common.c
--- client/citydlg_common.c     8 Mar 2005 00:43:26 -0000       1.66
+++ client/citydlg_common.c     10 Mar 2005 03:16:50 -0000
@@ -32,7 +32,7 @@
 #include "control.h"
 #include "mapview_common.h"
 #include "options.h"           /* for concise_city_production */
-#include "tilespec.h"          /* for tileset_is_isometric() */
+#include "tilespec.h"          /* for tileset_is_isometric(tileset) */
 
 static int citydlg_width, citydlg_height;
 
@@ -111,7 +111,7 @@
   canvas_x -= (width - NORMAL_TILE_WIDTH) / 2;
   canvas_y -= (height - NORMAL_TILE_HEIGHT) / 2;
 
-  if (tileset_is_isometric()) {
+  if (tileset_is_isometric(tileset)) {
     const int W = NORMAL_TILE_WIDTH, H = NORMAL_TILE_HEIGHT;
 
     /* Shift the tile left so the top corner of the origin tile is at
Index: client/climap.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/climap.c,v
retrieving revision 1.6
diff -u -r1.6 climap.c
--- client/climap.c     28 Feb 2005 04:01:52 -0000      1.6
+++ client/climap.c     10 Mar 2005 03:16:50 -0000
@@ -18,7 +18,7 @@
 #include "map.h"
 #include "shared.h"
 
-#include "tilespec.h"           /* tileset_is_isometric() */
+#include "tilespec.h"           /* tileset_is_isometric(tileset) */
 
 #include "climap.h"
 
@@ -50,7 +50,7 @@
 **************************************************************************/
 enum direction8 gui_to_map_dir(enum direction8 gui_dir)
 {
-  if (tileset_is_isometric()) {
+  if (tileset_is_isometric(tileset)) {
     return dir_ccw(gui_dir);
   } else {
     return gui_dir;
@@ -64,7 +64,7 @@
 **************************************************************************/
 enum direction8 map_to_gui_dir(enum direction8 map_dir)
 {
-  if (tileset_is_isometric()) {
+  if (tileset_is_isometric(tileset)) {
     return dir_cw(map_dir);
   } else {
     return map_dir;
Index: client/connectdlg_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/connectdlg_common.c,v
retrieving revision 1.30
diff -u -r1.30 connectdlg_common.c
--- client/connectdlg_common.c  28 Feb 2005 04:01:52 -0000      1.30
+++ client/connectdlg_common.c  10 Mar 2005 03:16:50 -0000
@@ -355,9 +355,9 @@
    * both cases the map wraps in the X direction by default.
    *
    * This works with hex maps too now.  A hex map always has
-   * tileset_is_isometric() return TRUE.  An iso-hex map has
-   * tileset_hex_height() != 0, while a non-iso hex map
-   * has tileset_hex_width() != 0.
+   * tileset_is_isometric(tileset) return TRUE.  An iso-hex map has
+   * tileset_hex_height(tileset) != 0, while a non-iso hex map
+   * has tileset_hex_width(tileset) != 0.
    *
    * Setting the option here is a bit of a hack, but so long as the client
    * has sufficient permissions to do so (it doesn't have HACK access yet) it
@@ -365,10 +365,10 @@
    * set but then overwritten during the load. */
   my_snprintf(buf, sizeof(buf), "/set topology %d",
              (TF_WRAPX
-              | ((tileset_is_isometric()
-                  && tileset_hex_height() == 0) ? TF_ISO : 0)
-              | ((tileset_hex_width() != 0
-                  || tileset_hex_height() != 0) ? TF_HEX : 0)));
+              | ((tileset_is_isometric(tileset)
+                  && tileset_hex_height(tileset) == 0) ? TF_ISO : 0)
+              | ((tileset_hex_width(tileset) != 0
+                  || tileset_hex_height(tileset) != 0) ? TF_HEX : 0)));
   send_chat(buf);
 
   return TRUE;
Index: client/mapctrl_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/mapctrl_common.c,v
retrieving revision 1.50
diff -u -r1.50 mapctrl_common.c
--- client/mapctrl_common.c     28 Feb 2005 04:01:52 -0000      1.50
+++ client/mapctrl_common.c     10 Mar 2005 03:16:51 -0000
@@ -199,7 +199,7 @@
    */
   if (diff_x != 0 || diff_y != 0) {
 
-    if (tileset_is_isometric()) {
+    if (tileset_is_isometric(tileset)) {
       rec_w += (diff_x - diff_y) * half_W;
       rec_h += (diff_x + diff_y) * half_H;
 
Index: client/mapview_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/mapview_common.c,v
retrieving revision 1.208
diff -u -r1.208 mapview_common.c
--- client/mapview_common.c     9 Mar 2005 18:12:33 -0000       1.208
+++ client/mapview_common.c     10 Mar 2005 03:16:51 -0000
@@ -177,7 +177,7 @@
 ****************************************************************************/
 void map_to_gui_vector(int *gui_dx, int *gui_dy, int map_dx, int map_dy)
 {
-  if (tileset_is_isometric()) {
+  if (tileset_is_isometric(tileset)) {
     /*
      * Convert the map coordinates to isometric GUI
      * coordinates.  We'll make tile map(0,0) be the origin, and
@@ -220,7 +220,7 @@
 static void gui_to_map_pos(int *map_x, int *map_y, int gui_x, int gui_y)
 {
   const int W = NORMAL_TILE_WIDTH, H = NORMAL_TILE_HEIGHT;
-  const int HH = tileset_hex_height(), HW = tileset_hex_width();
+  const int HH = tileset_hex_height(tileset), HW = tileset_hex_width(tileset);
 
   if (HH > 0 || HW > 0) {
     /* To handle hexagonal cases we have to revert to a less elegant method
@@ -228,7 +228,7 @@
     int x, y, dx, dy;
     int xmult, ymult, mod, compar;
 
-    assert(tileset_is_isometric());
+    assert(tileset_is_isometric(tileset));
 
     x = DIVIDE(gui_x, W);
     y = DIVIDE(gui_y, H);
@@ -253,7 +253,7 @@
 
     *map_x = (x + y) + mod * (xmult + ymult) / 2;
     *map_y = (y - x) + mod * (ymult - xmult) / 2;
-  } else if (tileset_is_isometric()) {
+  } else if (tileset_is_isometric(tileset)) {
     /* The basic operation here is a simple pi/4 rotation; however, we
      * have to first scale because the tiles have different width and
      * height.  Mathematically, this looks like
@@ -287,7 +287,7 @@
     gui_x -= W / 2;
     *map_x = DIVIDE(gui_x * H + gui_y * W, W * H);
     *map_y = DIVIDE(gui_y * W - gui_x * H, W * H);
-  } else {                     /* tileset_is_isometric() */
+  } else {                     /* tileset_is_isometric(tileset) */
     /* We use DIVIDE so that we will get the correct result even
      * for negative coordinates. */
     *map_x = DIVIDE(gui_x, W);
@@ -655,7 +655,7 @@
   *xsize = mapview.width;
   *ysize = mapview.height;
 
-  if (MAP_IS_ISOMETRIC == tileset_is_isometric()) {
+  if (MAP_IS_ISOMETRIC == tileset_is_isometric(tileset)) {
     /* If the map and view line up, it's easy. */
     NATIVE_TO_MAP_POS(xmin, ymin, 0, 0);
     map_to_gui_pos(xmin, ymin, *xmin, *ymin);
@@ -735,7 +735,7 @@
   *xstep = NORMAL_TILE_WIDTH;
   *ystep = NORMAL_TILE_HEIGHT;
 
-  if (tileset_is_isometric()) {
+  if (tileset_is_isometric(tileset)) {
     *xstep /= 2;
     *ystep /= 2;
   }
@@ -817,11 +817,11 @@
 {
   int canvas_x, canvas_y;
   int xmin, ymin, xmax, ymax, xsize, ysize, scroll_x, scroll_y;
-  const int border_x = (tileset_is_isometric() ? NORMAL_TILE_WIDTH / 2
+  const int border_x = (tileset_is_isometric(tileset) ? NORMAL_TILE_WIDTH / 2
                        : 2 * NORMAL_TILE_WIDTH);
-  const int border_y = (tileset_is_isometric() ? NORMAL_TILE_HEIGHT / 2
+  const int border_y = (tileset_is_isometric(tileset) ? NORMAL_TILE_HEIGHT / 2
                        : 2 * NORMAL_TILE_HEIGHT);
-  bool same = (tileset_is_isometric() == MAP_IS_ISOMETRIC);
+  bool same = (tileset_is_isometric(tileset) == MAP_IS_ISOMETRIC);
 
   get_mapview_scroll_window(&xmin, &ymin, &xmax, &ymax, &xsize, &ysize);
   get_mapview_scroll_pos(&scroll_x, &scroll_y);
@@ -986,7 +986,7 @@
 
   /* In iso-view the output sprite is a bit smaller than the tile, so we
    * have to use an offset. */
-  if (tileset_is_isometric()) {
+  if (tileset_is_isometric(tileset)) {
     canvas_x += NORMAL_TILE_WIDTH / 3;
     canvas_y -= NORMAL_TILE_HEIGHT / 3;
   }
@@ -1183,7 +1183,7 @@
 
   mapview_layer_iterate(layer) {
     gui_rect_iterate(gui_x0, gui_y0, width,
-                    height + (tileset_is_isometric()
+                    height + (tileset_is_isometric(tileset)
                               ? (NORMAL_TILE_HEIGHT / 2) : 0),
                     ptile, pedge, pcorner, gui_x, gui_y) {
       const int cx = gui_x - mapview.gui_x0, cy = gui_y - mapview.gui_y0;
@@ -1570,7 +1570,7 @@
     map_to_gui_vector(&canvas_dx, &canvas_dy, dx, dy);
 
     tile_to_canvas_pos(&start_x, &start_y, src_tile);
-    if (tileset_is_isometric()) {
+    if (tileset_is_isometric(tileset)) {
       start_y -= NORMAL_TILE_HEIGHT / 2;
     }
 
@@ -2116,7 +2116,7 @@
   /* Note: these calculations operate on overview coordinates as if they
    * are natural.  Corners may be off by one tile, however. */
 
-  if (tileset_is_isometric() && !MAP_IS_ISOMETRIC) {
+  if (tileset_is_isometric(tileset) && !MAP_IS_ISOMETRIC) {
     /* We start with the west corner. */
 
     /* North */
@@ -2130,7 +2130,7 @@
     /* South */
     x[3] = x[0] + OVERVIEW_TILE_WIDTH * mapview.tile_height;
     y[3] = y[0] + OVERVIEW_TILE_HEIGHT * mapview.tile_height;
-  } else if (!tileset_is_isometric() && MAP_IS_ISOMETRIC) {
+  } else if (!tileset_is_isometric(tileset) && MAP_IS_ISOMETRIC) {
     /* We start with the west corner.  Note the X scale is smaller. */
 
     /* North */
@@ -2147,7 +2147,7 @@
   } else {
     /* We start with the northwest corner. */
     int screen_width = mapview.tile_width;
-    int screen_height = mapview.tile_height * (tileset_is_isometric()
+    int screen_height = mapview.tile_height * (tileset_is_isometric(tileset)
                                               ? 2 : 1);
 
     /* Northeast */
@@ -2257,7 +2257,7 @@
     return TRUE;
   }
   if (XOR(topo_has_flag(TF_ISO) || topo_has_flag(TF_HEX),
-         tileset_is_isometric())) {
+         tileset_is_isometric(tileset))) {
     /* Non-matching.  In this case the mapview does not line up with the
      * map's axis of wrapping.  This will give very bad results for the
      * player!
@@ -2272,8 +2272,8 @@
            && h <= (NATURAL_WIDTH + NATURAL_HEIGHT) * H / 4);
   } else {
     /* Matching. */
-    const int isofactor = (tileset_is_isometric() ? 2 : 1);
-    const int isodiff = (tileset_is_isometric() ? 6 : 2);
+    const int isofactor = (tileset_is_isometric(tileset) ? 2 : 1);
+    const int isodiff = (tileset_is_isometric(tileset) ? 6 : 2);
 
     /* Now we can use the full width and height, with the exception of a small
      * area on each side. */
Index: client/mapview_common.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/mapview_common.h,v
retrieving revision 1.103
diff -u -r1.103 mapview_common.h
--- client/mapview_common.h     5 Mar 2005 02:23:29 -0000       1.103
+++ client/mapview_common.h     10 Mar 2005 03:16:51 -0000
@@ -100,7 +100,8 @@
     _height = -_height;                                                        
    \
   }                                                                        \
   if (_width > 0 && _height > 0) {                                         \
-    const int _ratio = (tileset_is_isometric() ? 2 : 1), _r = _ratio * 2;   \
+    const int _ratio = (tileset_is_isometric(tileset) ? 2 : 1);                
    \
+    const int _r = _ratio * 2;                                             \
     const int _Wr = NORMAL_TILE_WIDTH;                                     \
     const int _Hr = NORMAL_TILE_HEIGHT;                                        
    \
     /* Don't divide by _r yet, to avoid integer rounding errors. */        \
@@ -127,7 +128,7 @@
       GRI_y_itr = GRI_y0 + (GRI_itr / (GRI_x1 - GRI_x0));                  \
       GRI_sum = GRI_x_itr + GRI_y_itr;                                     \
       GRI_diff = GRI_y_itr - GRI_x_itr;                                        
    \
-      if (tileset_is_isometric()) {                                        \
+      if (tileset_is_isometric(tileset)) {                                 \
        if ((GRI_x_itr + GRI_y_itr) % 2 != 0) {                             \
          continue;                                                         \
        }                                                                   \
@@ -146,12 +147,12 @@
                                               (GRI_diff + 2) / 4);         \
            pcorner->tile[3] = map_pos_to_tile((GRI_sum - 6) / 4,           \
                                               (GRI_diff + 2) / 4);         \
-           if (tileset_hex_width() > 0) {                                  \
+           if (tileset_hex_width(tileset) > 0) {                           \
              pedge = &GRI_edge;                                            \
              pedge->type = EDGE_UD;                                        \
              pedge->tile[0] = pcorner->tile[0];                            \
              pedge->tile[1] = pcorner->tile[2];                            \
-           } else if (tileset_hex_height() > 0) {                          \
+           } else if (tileset_hex_height(tileset) > 0) {                   \
              pedge = &GRI_edge;                                            \
              pedge->type = EDGE_LR;                                        \
              pedge->tile[0] = pcorner->tile[1];                            \
Index: client/tilespec.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/tilespec.c,v
retrieving revision 1.261
diff -u -r1.261 tilespec.c
--- client/tilespec.c   9 Mar 2005 18:12:34 -0000       1.261
+++ client/tilespec.c   10 Mar 2005 03:16:52 -0000
@@ -213,45 +213,45 @@
 /****************************************************************************
   Return whether the current tileset is isometric.
 ****************************************************************************/
-bool tileset_is_isometric(void)
+bool tileset_is_isometric(struct tileset *t)
 {
-  return tileset->is_isometric;
+  return t->is_isometric;
 }
 
 /****************************************************************************
   Return the hex_width of the current tileset.  For hex tilesets this value
   will be > 0 and is_isometric will be set.
 ****************************************************************************/
-int tileset_hex_width(void)
+int tileset_hex_width(struct tileset *t)
 {
-  return tileset->hex_width;
+  return t->hex_width;
 }
 
 /****************************************************************************
   Return the hex_height of the current tileset.  For iso-hex tilesets this
   value will be > 0 and is_isometric will be set.
 ****************************************************************************/
-int tileset_hex_height(void)
+int tileset_hex_height(struct tileset *t)
 {
-  return tileset->hex_height;
+  return t->hex_height;
 }
 
 /****************************************************************************
   Return the tile width of the current tileset.  This is the tesselation
   width of the tiled plane.
 ****************************************************************************/
-int tileset_tile_width(void)
+int tileset_tile_width(struct tileset *t)
 {
-  return tileset->normal_tile_width;
+  return t->normal_tile_width;
 }
 
 /****************************************************************************
   Return the tile height of the current tileset.  This is the tesselation
   height of the tiled plane.
 ****************************************************************************/
-int tileset_tile_height(void)
+int tileset_tile_height(struct tileset *t)
 {
-  return tileset->normal_tile_height;
+  return t->normal_tile_height;
 }
 
 /****************************************************************************
@@ -260,9 +260,9 @@
 
   Note: currently this is always equal to the tile width.
 ****************************************************************************/
-int tileset_full_tile_width(void)
+int tileset_full_tile_width(struct tileset *t)
 {
-  return tileset->full_tile_width;
+  return t->full_tile_width;
 }
 
 /****************************************************************************
@@ -270,9 +270,9 @@
   height that any mapview sprite will have.  This may be greater than the
   tile width in which case the extra area is above the "normal" tile.
 ****************************************************************************/
-int tileset_full_tile_height(void)
+int tileset_full_tile_height(struct tileset *t)
 {
-  return tileset->full_tile_height;
+  return t->full_tile_height;
 }
 
 /****************************************************************************
@@ -280,9 +280,9 @@
   are used for various theme graphics (e.g., citymap citizens/specialists
   as well as panel indicator icons).
 ****************************************************************************/
-int tileset_small_sprite_width(void)
+int tileset_small_sprite_width(struct tileset *t)
 {
-  return tileset->small_sprite_width;
+  return t->small_sprite_width;
 }
 
 /****************************************************************************
@@ -290,9 +290,9 @@
   are used for various theme graphics (e.g., citymap citizens/specialists
   as well as panel indicator icons).
 ****************************************************************************/
-int tileset_small_sprite_height(void)
+int tileset_small_sprite_height(struct tileset *t)
 {
-  return tileset->small_sprite_height;
+  return t->small_sprite_height;
 }
 
 /****************************************************************************
@@ -300,9 +300,9 @@
   file can be found.  (It is left up to the GUI code to load and unload this
   file.)
 ****************************************************************************/
-const char *tileset_main_intro_filename(void)
+const char *tileset_main_intro_filename(struct tileset *t)
 {
-  return tileset->main_intro_filename;
+  return t->main_intro_filename;
 }
 
 /****************************************************************************
@@ -310,9 +310,9 @@
   file can be found.  (It is left up to the GUI code to load and unload this
   file.)
 ****************************************************************************/
-const char *tileset_mini_intro_filename(void)
+const char *tileset_mini_intro_filename(struct tileset *t)
 {
-  return tileset->minimap_intro_filename;
+  return t->minimap_intro_filename;
 }
 
 /**************************************************************************
Index: client/tilespec.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/tilespec.h,v
retrieving revision 1.125
diff -u -r1.125 tilespec.h
--- client/tilespec.h   9 Mar 2005 18:12:34 -0000       1.125
+++ client/tilespec.h   10 Mar 2005 03:16:52 -0000
@@ -398,12 +398,12 @@
  *     - NORMAL_TILE_WIDTH and NORMAL_TILE_HEIGHT are even
  */
 
-#define NORMAL_TILE_WIDTH tileset_tile_width()
-#define NORMAL_TILE_HEIGHT tileset_tile_height()
-#define UNIT_TILE_WIDTH tileset_full_tile_width()
-#define UNIT_TILE_HEIGHT tileset_full_tile_height()
-#define SMALL_TILE_WIDTH tileset_small_sprite_width()
-#define SMALL_TILE_HEIGHT tileset_small_sprite_height()
+#define NORMAL_TILE_WIDTH tileset_tile_width(tileset)
+#define NORMAL_TILE_HEIGHT tileset_tile_height(tileset)
+#define UNIT_TILE_WIDTH tileset_full_tile_width(tileset)
+#define UNIT_TILE_HEIGHT tileset_full_tile_height(tileset)
+#define SMALL_TILE_WIDTH tileset_small_sprite_width(tileset)
+#define SMALL_TILE_HEIGHT tileset_small_sprite_height(tileset)
 
 /* The overview tile width and height are defined in terms of the base
  * size.  For iso-maps the width is twice the height since "natural"
@@ -414,17 +414,17 @@
 #define OVERVIEW_TILE_HEIGHT OVERVIEW_TILE_SIZE
 
 /* Tileset accessor functions. */
-bool tileset_is_isometric(void);
-int tileset_hex_width(void);
-int tileset_hex_height(void);
-int tileset_tile_width(void);
-int tileset_tile_height(void);
-int tileset_full_tile_width(void);
-int tileset_full_tile_height(void);
-int tileset_small_sprite_width(void);
-int tileset_small_sprite_height(void);
-const char *tileset_main_intro_filename(void);
-const char *tileset_mini_intro_filename(void);
+bool tileset_is_isometric(struct tileset *t);
+int tileset_hex_width(struct tileset *t);
+int tileset_hex_height(struct tileset *t);
+int tileset_tile_width(struct tileset *t);
+int tileset_tile_height(struct tileset *t);
+int tileset_full_tile_width(struct tileset *t);
+int tileset_full_tile_height(struct tileset *t);
+int tileset_small_sprite_width(struct tileset *t);
+int tileset_small_sprite_height(struct tileset *t);
+const char *tileset_main_intro_filename(struct tileset *t);
+const char *tileset_mini_intro_filename(struct tileset *t);
 
 struct Sprite *load_sprite(struct tileset *t, const char *tag_name);
 void unload_sprite(struct tileset *t, const char *tag_name);
Index: client/gui-ftwl/graphics.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-ftwl/graphics.c,v
retrieving revision 1.2
diff -u -r1.2 graphics.c
--- client/gui-ftwl/graphics.c  3 Mar 2005 17:18:29 -0000       1.2
+++ client/gui-ftwl/graphics.c  10 Mar 2005 03:16:52 -0000
@@ -52,8 +52,8 @@
 void load_intro_gfx(void)
 {
   /* PORTME */
-  intro_gfx_sprite = load_gfxfile(tileset_main_intro_filename());
-  radar_gfx_sprite = load_gfxfile(tileset_mini_intro_filename());
+  intro_gfx_sprite = load_gfxfile(tileset_main_intro_filename(tileset));
+  radar_gfx_sprite = load_gfxfile(tileset_mini_intro_filename(tileset));
 }
 
 /**************************************************************************
Index: client/gui-gtk/citydlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/citydlg.c,v
retrieving revision 1.196
diff -u -r1.196 citydlg.c
--- client/gui-gtk/citydlg.c    28 Feb 2005 04:01:53 -0000      1.196
+++ client/gui-gtk/citydlg.c    10 Mar 2005 03:16:53 -0000
@@ -321,7 +321,7 @@
   canvas_width = get_citydlg_canvas_width();
   canvas_height = get_citydlg_canvas_height();
 
-  if (tileset_is_isometric()) {
+  if (tileset_is_isometric(tileset)) {
     MAX_UNIT_ROWS = (int) (100 / (UNIT_TILE_HEIGHT));
   } else {
     MAX_UNIT_ROWS = (int) (100 / (UNIT_TILE_HEIGHT + 6));
@@ -701,7 +701,7 @@
                    hbox);
 
   for (i = 0; i < MINI_NUM_UNITS; i++) {
-    int unit_height = (tileset_is_isometric()) ?
+    int unit_height = (tileset_is_isometric(tileset)) ?
        UNIT_TILE_HEIGHT : UNIT_TILE_HEIGHT + UNIT_TILE_HEIGHT / 2;
 
     pdialog->overview.supported_unit_boxes[i] = gtk_event_box_new();
@@ -926,7 +926,7 @@
 
   gtk_notebook_append_page(GTK_NOTEBOOK(pdialog->notebook), page, label);
 
-  if (tileset_is_isometric())
+  if (tileset_is_isometric(tileset))
     MAX_UNIT_ROWS = (int) (100 / (UNIT_TILE_HEIGHT));
   else
     MAX_UNIT_ROWS = (int) (100 / (UNIT_TILE_HEIGHT + 6));
Index: client/gui-gtk/graphics.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/graphics.c,v
retrieving revision 1.54
diff -u -r1.54 graphics.c
--- client/gui-gtk/graphics.c   3 Mar 2005 17:18:29 -0000       1.54
+++ client/gui-gtk/graphics.c   10 Mar 2005 03:16:53 -0000
@@ -117,7 +117,7 @@
 
   /* Main graphic */
 
-  intro_gfx_sprite = load_gfxfile(tileset_main_intro_filename());
+  intro_gfx_sprite = load_gfxfile(tileset_main_intro_filename(tileset));
   tot=intro_gfx_sprite->width;
 
   face_gc = gdk_gc_new(root_window);
@@ -133,7 +133,7 @@
 
   /* Minimap graphic */
 
-  radar_gfx_sprite = load_gfxfile(tileset_mini_intro_filename());
+  radar_gfx_sprite = load_gfxfile(tileset_mini_intro_filename(tileset));
   tot = radar_gfx_sprite->width;
 
   my_snprintf(s, sizeof(s), "%d.%d.%d%s",
Index: client/gui-gtk-2.0/pages.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/pages.c,v
retrieving revision 1.19
diff -u -r1.19 pages.c
--- client/gui-gtk-2.0/pages.c  5 Mar 2005 23:51:06 -0000       1.19
+++ client/gui-gtk-2.0/pages.c  10 Mar 2005 03:16:54 -0000
@@ -169,7 +169,7 @@
   gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_ETCHED_OUT);
   gtk_container_add(GTK_CONTAINER(align), frame);
 
-  image = gtk_image_new_from_file(tileset_main_intro_filename());
+  image = gtk_image_new_from_file(tileset_main_intro_filename(tileset));
   g_signal_connect_after(image, "expose_event",
       G_CALLBACK(intro_expose), NULL);
   gtk_container_add(GTK_CONTAINER(frame), image);
Index: client/gui-mui/graphics.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-mui/graphics.c,v
retrieving revision 1.36
diff -u -r1.36 graphics.c
--- client/gui-mui/graphics.c   5 Mar 2005 23:51:06 -0000       1.36
+++ client/gui-mui/graphics.c   10 Mar 2005 03:16:54 -0000
@@ -349,7 +349,7 @@
     node = (struct SpriteNode *) node->node.mln_Succ;
   }
 
-  if (tileset_is_isometric())
+  if (tileset_is_isometric(tileset))
   {
     /* In isometric view we needs to build a fog mask, we could use 
BltPattern()
        to avoid this but the mask position can not be specified fine enough */
Index: client/gui-mui/mapclass.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-mui/mapclass.c,v
retrieving revision 1.104
diff -u -r1.104 mapclass.c
--- client/gui-mui/mapclass.c   5 Mar 2005 23:51:06 -0000       1.104
+++ client/gui-mui/mapclass.c   10 Mar 2005 03:16:54 -0000
@@ -582,14 +582,14 @@
     anim_timer = renew_timer_start(anim_timer, TIMER_USER, TIMER_ACTIVE);
 
     if (w > 0 && h > 0) {
-      if (tileset_is_isometric()) {
+      if (tileset_is_isometric(tileset)) {
       /* We first draw the explosion onto the unit and draw draw the
         complete thing onto the map canvas window. This avoids flickering. */
        MyBltBitMapRastPort(data->map_bitmap, canvas_x, canvas_y,
                            data->unit_layer->rp, 0, 0, w, h, 0xc0);
        put_sprite_overlay(data->unit_layer->rp, sprites.explode.unit[i], 
NORMAL_TILE_WIDTH/4,0);
        MyBltBitMapRastPort(data->unit_bitmap,0,0,_rp(o),_mleft(o) + canvas_x, 
_mtop(o) + canvas_y, w, h, 0xc0);
-      } else { /* tileset_is_isometric() */
+      } else { /* tileset_is_isometric(tileset) */
        MyBltBitMapRastPort(data->map_bitmap, canvas_x, canvas_y,
                            data->unit_layer->rp, 0, 0, w, h, 0xc0);
        put_sprite_overlay(data->unit_layer->rp, sprites.explode.unit[i], 0, 0);
@@ -811,8 +811,8 @@
     colors_pen[i] = ObtainBestPenA(cm, r, g, b, 0); /* global in colors.c */
   }
 
-  data->intro_gfx_sprite = load_sprite(tileset, tileset_main_intro_filename(), 
FALSE);
-  data->radar_gfx_sprite = load_sprite(tileset, tileset_mini_intro_filename(), 
FALSE);
+  data->intro_gfx_sprite = load_sprite(tileset, 
tileset_main_intro_filename(tileset), FALSE);
+  data->radar_gfx_sprite = load_sprite(tileset, 
tileset_mini_intro_filename(tileset), FALSE);
 
   if ((dh = data->drawhandle = ObtainDrawHandle(pen_shared_map, 
&_screen(o)->RastPort, _screen(o)->ViewPort.ColorMap,
                                           GGFX_DitherMode, DITHERMODE_NONE,
@@ -1039,7 +1039,7 @@
 
        APTR cliphandle = MUI_AddClipping(muiRenderInfo(o), _mleft(o), 
_mtop(o), _mwidth(o), _mheight(o));
 
-       if (tileset_is_isometric())
+       if (tileset_is_isometric(tileset))
        {
          /* Do I get points for style? */
 /*       char boom[] = "Really Loud BOOM!!!";
@@ -1159,7 +1159,7 @@
 
        assert(is_drawn_line(src_x, src_y, dir));
 
-       if (tileset_is_isometric()) {
+       if (tileset_is_isometric(tileset)) {
          really_draw_segment(data->map_layer->rp, 0, 0, src_x, src_y, dir,
                              FALSE);
          really_draw_segment(_rp(o), _mleft(o), _mtop(o), src_x, src_y,
@@ -1223,13 +1223,13 @@
        write_to_screen = 1;
 
        /* see update_map_canvas_visible() in mapview.c */
-       if (tileset_is_isometric())
+       if (tileset_is_isometric(tileset))
        {
          y -= width;
          width = height = width + height;
        }
 
-       if ((msg->flags & MADF_DRAWUPDATE) && (data->update == 3) && 
!tileset_is_isometric())
+       if ((msg->flags & MADF_DRAWUPDATE) && (data->update == 3) && 
!tileset_is_isometric(tileset))
        {
          /* Map has been scrolled (non isometric only atm), drawing can be 
optimized */
          int dx = data->horiz_first - data->old_horiz_first;
@@ -1302,7 +1302,7 @@
        }
       }
 
-      if (tileset_is_isometric())
+      if (tileset_is_isometric(tileset))
       {
        int i;
        int x_itr, y_itr;
@@ -2097,7 +2097,7 @@
 {
   DoSuperMethodA(cl, o, (Msg) msg);
 
-  if (tileset_is_isometric())
+  if (tileset_is_isometric(tileset))
   {
     msg->MinMaxInfo->MinWidth += get_normal_tile_width() * 4;
     msg->MinMaxInfo->DefWidth += get_normal_tile_width() * 4;
@@ -2127,7 +2127,7 @@
   {
     struct city *pcity = data->pcity;
 
-    if (tileset_is_isometric())
+    if (tileset_is_isometric(tileset))
     {
       /* First make it all black. */
       SetAPen(rp,data->black_color);
Index: client/gui-mui/overviewclass.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-mui/overviewclass.c,v
retrieving revision 1.21
diff -u -r1.21 overviewclass.c
--- client/gui-mui/overviewclass.c      28 Feb 2005 04:01:53 -0000      1.21
+++ client/gui-mui/overviewclass.c      10 Mar 2005 03:16:55 -0000
@@ -116,7 +116,7 @@
        if (x < 0) x = 0;
        else if (x >= data->ov_MapWidth * data->ov_ScaleX) x = 
data->ov_MapWidth * data->ov_ScaleX - 1;
 
-  if (tileset_is_isometric()) {
+  if (tileset_is_isometric(tileset)) {
     x -= data->rect_width/2;
     y += data->rect_width/2;
     x -= data->rect_height/2;
@@ -226,7 +226,7 @@
 
   SetAPen(rp, data->pen_white);
 
-  if (tileset_is_isometric()) {
+  if (tileset_is_isometric(tileset)) {
     int p1x = data->rect_left*2;
     int p1y = data->rect_top*2;
     int p2x = data->rect_left*2 + data->rect_height*2;
Index: client/gui-sdl/citydlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-sdl/citydlg.c,v
retrieving revision 1.50
diff -u -r1.50 citydlg.c
--- client/gui-sdl/citydlg.c    28 Feb 2005 04:01:53 -0000      1.50
+++ client/gui-sdl/citydlg.c    10 Mar 2005 03:16:55 -0000
@@ -1615,7 +1615,7 @@
 **************************************************************************/
 static bool sdl_city_to_canvas_pos(int *canvas_x, int *canvas_y, int city_x, 
int city_y)
 {
-  if (tileset_is_isometric()) {
+  if (tileset_is_isometric(tileset)) {
     /*
      * The top-left corner is in the center of tile (-2, 2).  However,
      * we're looking for the top-left corner of the tile, so we
@@ -1647,7 +1647,7 @@
 {
   int orig_canvas_x = canvas_x, orig_canvas_y = canvas_y;
 
-  if (tileset_is_isometric()) {
+  if (tileset_is_isometric(tileset)) {
     const int W = SCALLED_TILE_WIDTH, H = SCALLED_TILE_HEIGHT;
 
     /* Shift the tile right so the top corner of tile (-2,2) is at
Index: client/gui-sdl/graphics.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-sdl/graphics.c,v
retrieving revision 1.35
diff -u -r1.35 graphics.c
--- client/gui-sdl/graphics.c   5 Mar 2005 23:51:07 -0000       1.35
+++ client/gui-sdl/graphics.c   10 Mar 2005 03:16:56 -0000
@@ -3450,7 +3450,7 @@
 SDL_Surface * get_intro_gfx(void)
 {
   if(!pIntro_gfx) {
-   pIntro_gfx = load_surf(tileset_main_intro_filename());
+   pIntro_gfx = load_surf(tileset_main_intro_filename(tileset));
   }
   return pIntro_gfx;
 }
@@ -3461,7 +3461,7 @@
 SDL_Surface * get_logo_gfx(void)
 {
   SDL_Surface *pLogo;
-  SDL_Surface *pLogo_Surf = IMG_Load(tileset_mini_intro_filename());
+  SDL_Surface *pLogo_Surf = IMG_Load(tileset_mini_intro_filename(tileset));
   assert(pLogo_Surf != NULL);
   pLogo = SDL_CreateRGBSurface(SDL_SWSURFACE,
                        pLogo_Surf->w, pLogo_Surf->h,
Index: client/gui-sdl/gui_main.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-sdl/gui_main.c,v
retrieving revision 1.53
diff -u -r1.53 gui_main.c
--- client/gui-sdl/gui_main.c   5 Mar 2005 23:51:07 -0000       1.53
+++ client/gui-sdl/gui_main.c   10 Mar 2005 03:16:56 -0000
@@ -425,7 +425,7 @@
       }
     }
 
-    if(tileset_is_isometric() && do_focus_animation && 
pAnim->num_tiles_focused_unit) {
+    if(tileset_is_isometric(tileset) && do_focus_animation && 
pAnim->num_tiles_focused_unit) {
       real_blink_active_unit();
     } else {
       blink_active_unit();
Index: client/gui-sdl/gui_tilespec.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-sdl/gui_tilespec.c,v
retrieving revision 1.22
diff -u -r1.22 gui_tilespec.c
--- client/gui-sdl/gui_tilespec.c       5 Mar 2005 23:51:07 -0000       1.22
+++ client/gui-sdl/gui_tilespec.c       10 Mar 2005 03:16:56 -0000
@@ -502,7 +502,7 @@
     
   /* Map Dithering */
   
-    if (tileset_is_isometric())
+    if (tileset_is_isometric(tileset))
     {
       pBuf = sprites.dither_tile;
       pDitherMask = GET_SURF(pBuf);
@@ -819,7 +819,7 @@
   unload_sprite(tileset, "upkeep.unhappy");
   unload_sprite(tileset, "upkeep.unhappy2");
   unload_sprite(tileset, "upkeep.shield");
-  if (tileset_is_isometric() && sprite_exists("explode.iso_nuke"))
+  if (tileset_is_isometric(tileset) && sprite_exists("explode.iso_nuke"))
   {
     unload_sprite(tileset, "explode.iso_nuke");
   }
Index: client/gui-sdl/mapview.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-sdl/mapview.c,v
retrieving revision 1.80
diff -u -r1.80 mapview.c
--- client/gui-sdl/mapview.c    2 Mar 2005 18:22:59 -0000       1.80
+++ client/gui-sdl/mapview.c    10 Mar 2005 03:16:56 -0000
@@ -2389,7 +2389,7 @@
 SDL_Surface * create_city_map(struct city *pCity)
 {
   
-    if (tileset_is_isometric())
+    if (tileset_is_isometric(tileset))
     {
       return create_iso_city_map(pCity);
     }
@@ -2653,7 +2653,7 @@
   
   clear_dither_tiles();
   
-  if(tileset_is_isometric()) {
+  if(tileset_is_isometric(tileset)) {
     
     /* =========================== */
     pTmpSurface = create_surf(UNIT_TILE_WIDTH,
Index: client/gui-stub/graphics.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-stub/graphics.c,v
retrieving revision 1.14
diff -u -r1.14 graphics.c
--- client/gui-stub/graphics.c  3 Mar 2005 17:18:29 -0000       1.14
+++ client/gui-stub/graphics.c  10 Mar 2005 03:16:56 -0000
@@ -48,8 +48,8 @@
 void load_intro_gfx(void)
 {
   /* PORTME */
-  intro_gfx_sprite = load_gfxfile(tileset_main_intro_filename());
-  radar_gfx_sprite = load_gfxfile(tileset_mini_intro_filename());
+  intro_gfx_sprite = load_gfxfile(tileset_main_intro_filename(tileset));
+  radar_gfx_sprite = load_gfxfile(tileset_mini_intro_filename(tileset));
 }
 
 /****************************************************************************
Index: client/gui-win32/graphics.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-win32/graphics.c,v
retrieving revision 1.26
diff -u -r1.26 graphics.c
--- client/gui-win32/graphics.c 8 Mar 2005 10:03:47 -0000       1.26
+++ client/gui-win32/graphics.c 10 Mar 2005 03:16:57 -0000
@@ -65,8 +65,8 @@
 void
 load_intro_gfx(void)
 {
-  intro_gfx_sprite=load_gfxfile(tileset_main_intro_filename());
-  radar_gfx_sprite = load_gfxfile(tileset_mini_intro_filename());     
+  intro_gfx_sprite=load_gfxfile(tileset_main_intro_filename(tileset));
+  radar_gfx_sprite = load_gfxfile(tileset_mini_intro_filename(tileset));     
 }
 
 /**************************************************************************
Index: client/gui-xaw/graphics.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/graphics.c,v
retrieving revision 1.56
diff -u -r1.56 graphics.c
--- client/gui-xaw/graphics.c   3 Mar 2005 17:18:30 -0000       1.56
+++ client/gui-xaw/graphics.c   10 Mar 2005 03:16:57 -0000
@@ -100,7 +100,7 @@
 
   /* Main graphic */
 
-  intro_gfx_sprite=load_gfxfile(tileset_main_intro_filename());
+  intro_gfx_sprite=load_gfxfile(tileset_main_intro_filename(tileset));
   tot=intro_gfx_sprite->width;
 
   y=intro_gfx_sprite->height-(2*lin);
@@ -114,7 +114,7 @@
 
   /* Minimap graphic */
 
-  radar_gfx_sprite=load_gfxfile(tileset_mini_intro_filename());
+  radar_gfx_sprite=load_gfxfile(tileset_mini_intro_filename(tileset));
   tot=radar_gfx_sprite->width;
 
   y = radar_gfx_sprite->height - (lin +

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#12471) add tileset parameters to the tileset query functions, Jason Short <=