[Freeciv-Dev] (PR#12653) remove NORMAL_TILE_WIDTH and other tileset macr
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=12653 >
This patch removes NORMAL_TILE_WIDTH, UNIT_TILE_WIDTH, SMALL_TILE_WIDTH,
and corresponding HEIGHT macros. They are replaced by direct callers of
the tileset accessor functions.
The reason for this is that the macros use the "global" tileset
variable. This is to be avoided, and the best way to avoid it is to
remove them. In particular the mapview drawing function should (in
future) take a tileset parameter which they use for their drawing.
Aside from tilespec.[ch] these changes are just search-and-replace. I
may fix the style (line wrapping) before committing but I won't do
anything else. In tilespec.h I just cut all the macro lines out
(including some documentation). In tilespec.c I changed the previous
macro users to access the tileset values directly (this uses the local
tileset 't' values, not the global tileset variable). I also added more
documentation to the accessor functions (corresponding to what was
removed from tilespec.h).
-jason
Index: client/citydlg_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/citydlg_common.c,v
retrieving revision 1.69
diff -u -r1.69 citydlg_common.c
--- client/citydlg_common.c 23 Mar 2005 17:49:37 -0000 1.69
+++ client/citydlg_common.c 25 Mar 2005 20:40:56 -0000
@@ -71,8 +71,8 @@
max_y = MAX(canvas_y, max_y);
} city_map_iterate_end;
- citydlg_width = max_x - min_x + NORMAL_TILE_WIDTH;
- citydlg_height = max_y - min_y + NORMAL_TILE_HEIGHT;
+ citydlg_width = max_x - min_x + tileset_tile_width(tileset);
+ citydlg_height = max_y - min_y + tileset_tile_height(tileset);
}
/**************************************************************************
@@ -87,8 +87,8 @@
/* The citymap is centered over the center of the citydlg canvas. */
map_to_gui_vector(canvas_x, canvas_y, city_x - x0, city_y - y0);
- *canvas_x += (width - NORMAL_TILE_WIDTH) / 2;
- *canvas_y += (height - NORMAL_TILE_HEIGHT) / 2;
+ *canvas_x += (width - tileset_tile_width(tileset)) / 2;
+ *canvas_y += (height - tileset_tile_height(tileset)) / 2;
if (!is_valid_city_coords(city_x, city_y)) {
assert(FALSE);
@@ -108,11 +108,11 @@
const int height = get_citydlg_canvas_height();
/* The citymap is centered over the center of the citydlg canvas. */
- canvas_x -= (width - NORMAL_TILE_WIDTH) / 2;
- canvas_y -= (height - NORMAL_TILE_HEIGHT) / 2;
+ canvas_x -= (width - tileset_tile_width(tileset)) / 2;
+ canvas_y -= (height - tileset_tile_height(tileset)) / 2;
if (tileset_is_isometric(tileset)) {
- const int W = NORMAL_TILE_WIDTH, H = NORMAL_TILE_HEIGHT;
+ const int W = tileset_tile_width(tileset), H =
tileset_tile_height(tileset);
/* Shift the tile left so the top corner of the origin tile is at
canvas position (0,0). */
@@ -123,8 +123,8 @@
*city_x = DIVIDE(canvas_x * H + canvas_y * W, W * H);
*city_y = DIVIDE(canvas_y * W - canvas_x * H, W * H);
} else {
- *city_x = DIVIDE(canvas_x, NORMAL_TILE_WIDTH);
- *city_y = DIVIDE(canvas_y, NORMAL_TILE_HEIGHT);
+ *city_x = DIVIDE(canvas_x, tileset_tile_width(tileset));
+ *city_y = DIVIDE(canvas_y, tileset_tile_height(tileset));
}
/* Add on the offset of the top-left corner to get the final
@@ -149,8 +149,8 @@
\
map_to_gui_vector(&_my_gui_x0, &_my_gui_y0, \
_pcity->tile->x, _pcity->tile->y); \
- _my_gui_x0 -= (_my_width - NORMAL_TILE_WIDTH) / 2; \
- _my_gui_y0 -= (_my_height - NORMAL_TILE_HEIGHT) / 2; \
+ _my_gui_x0 -= (_my_width - tileset_tile_width(tileset)) / 2;
\
+ _my_gui_y0 -= (_my_height - tileset_tile_height(tileset)) / 2;
\
freelog(LOG_DEBUG, "citydlg: %d,%d + %dx%d", \
_my_gui_x0, _my_gui_y0, _my_width, _my_height); \
\
Index: client/mapctrl_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/mapctrl_common.c,v
retrieving revision 1.51
diff -u -r1.51 mapctrl_common.c
--- client/mapctrl_common.c 11 Mar 2005 17:11:25 -0000 1.51
+++ client/mapctrl_common.c 25 Mar 2005 20:40:56 -0000
@@ -84,8 +84,8 @@
struct tile *ptile = canvas_pos_to_nearest_tile(canvas_x, canvas_y);
tile_to_canvas_pos(&rec_anchor_x, &rec_anchor_y, ptile);
- rec_anchor_x += NORMAL_TILE_WIDTH / 2;
- rec_anchor_y += NORMAL_TILE_HEIGHT / 2;
+ rec_anchor_x += tileset_tile_width(tileset) / 2;
+ rec_anchor_y += tileset_tile_height(tileset) / 2;
/* FIXME: This may be off-by-one. */
rec_canvas_center_tile = get_center_tile_mapcanvas();
rec_w = rec_h = 0;
@@ -104,8 +104,8 @@
**************************************************************************/
static void define_tiles_within_rectangle(void)
{
- const int W = NORMAL_TILE_WIDTH, half_W = W / 2;
- const int H = NORMAL_TILE_HEIGHT, half_H = H / 2;
+ const int W = tileset_tile_width(tileset), half_W = W / 2;
+ const int H = tileset_tile_height(tileset), half_H = H / 2;
const int segments_x = abs(rec_w / half_W);
const int segments_y = abs(rec_h / half_H);
@@ -161,8 +161,8 @@
**************************************************************************/
void update_selection_rectangle(int canvas_x, int canvas_y)
{
- const int W = NORMAL_TILE_WIDTH, half_W = W / 2;
- const int H = NORMAL_TILE_HEIGHT, half_H = H / 2;
+ const int W = tileset_tile_width(tileset), half_W = W / 2;
+ const int H = tileset_tile_height(tileset), half_H = H / 2;
static struct tile *rec_tile = NULL;
int diff_x, diff_y;
struct tile *center_tile;
Index: client/mapview_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/mapview_common.c,v
retrieving revision 1.220
diff -u -r1.220 mapview_common.c
--- client/mapview_common.c 23 Mar 2005 18:55:44 -0000 1.220
+++ client/mapview_common.c 25 Mar 2005 20:40:56 -0000
@@ -184,11 +184,11 @@
* 789 4 8
* 7
*/
- *gui_dx = (map_dx - map_dy) * NORMAL_TILE_WIDTH / 2;
- *gui_dy = (map_dx + map_dy) * NORMAL_TILE_HEIGHT / 2;
+ *gui_dx = (map_dx - map_dy) * tileset_tile_width(tileset) / 2;
+ *gui_dy = (map_dx + map_dy) * tileset_tile_height(tileset) / 2;
} else {
- *gui_dx = map_dx * NORMAL_TILE_HEIGHT;
- *gui_dy = map_dy * NORMAL_TILE_WIDTH;
+ *gui_dx = map_dx * tileset_tile_height(tileset);
+ *gui_dy = map_dy * tileset_tile_width(tileset);
}
}
@@ -214,7 +214,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 W = tileset_tile_width(tileset), H = tileset_tile_height(tileset);
const int HH = tileset_hex_height(tileset), HW = tileset_hex_width(tileset);
if (HH > 0 || HW > 0) {
@@ -303,13 +303,13 @@
The center of a tile is defined as:
{
tile_to_canvas_pos(&canvas_x, &canvas_y, ptile);
- canvas_x += NORMAL_TILE_WIDTH / 2;
- canvas_y += NORMAL_TILE_HEIGHT / 2;
+ canvas_x += tileset_tile_width(tileset) / 2;
+ canvas_y += tileset_tile_height(tileset) / 2;
}
This pixel is one position closer to the lower right, which may be
important to remember when doing some round-off operations. Other
- parts of the code assume NORMAL_TILE_WIDTH and NORMAL_TILE_HEIGHT
+ parts of the code assume tileset_tile_width(tileset) and
tileset_tile_height(tileset)
to be even numbers.
**************************************************************************/
bool tile_to_canvas_pos(int *canvas_x, int *canvas_y, struct tile *ptile)
@@ -342,11 +342,11 @@
* store. Even if it's not visible on the canvas, if it's present on the
* backing store we need to draw it in case the canvas is resized.
*/
- return (*canvas_x > -NORMAL_TILE_WIDTH
+ return (*canvas_x > -tileset_tile_width(tileset)
&& *canvas_x < mapview.store_width
- && *canvas_y > -NORMAL_TILE_HEIGHT
+ && *canvas_y > -tileset_tile_height(tileset)
&& *canvas_y < (mapview.store_height
- + UNIT_TILE_HEIGHT - NORMAL_TILE_HEIGHT));
+ + tileset_full_tile_height(tileset) -
tileset_tile_height(tileset)));
}
/****************************************************************************
@@ -687,8 +687,8 @@
NATIVE_TO_MAP_POS(xmax, ymax, map.xsize - 1, map.ysize - 1);
map_to_gui_pos(xmax, ymax, *xmax, *ymax);
- *xmax += NORMAL_TILE_WIDTH;
- *ymax += NORMAL_TILE_HEIGHT;
+ *xmax += tileset_tile_width(tileset);
+ *ymax += tileset_tile_height(tileset);
/* To be able to center on positions near the edges, we have to be
* allowed to scroll all the way to those edges. To allow wrapping the
@@ -700,13 +700,13 @@
*xmax += *xsize;
/* We need to be able to scroll a little further to the left. */
- *xmin -= NORMAL_TILE_WIDTH;
+ *xmin -= tileset_tile_width(tileset);
}
if (topo_has_flag(TF_WRAPY)) {
*ymax += *ysize;
/* We need to be able to scroll a little further up. */
- *ymin -= NORMAL_TILE_HEIGHT;
+ *ymin -= tileset_tile_height(tileset);
}
} else {
/* Otherwise it's hard. Very hard. Impossible, in fact. This is just
@@ -757,8 +757,8 @@
****************************************************************************/
void get_mapview_scroll_step(int *xstep, int *ystep)
{
- *xstep = NORMAL_TILE_WIDTH;
- *ystep = NORMAL_TILE_HEIGHT;
+ *xstep = tileset_tile_width(tileset);
+ *ystep = tileset_tile_height(tileset);
if (tileset_is_isometric(tileset)) {
*xstep /= 2;
@@ -810,8 +810,8 @@
map_to_gui_pos(&gui_x, &gui_y, ptile->x, ptile->y);
/* Put the center pixel of the tile at the exact center of the mapview. */
- gui_x -= (mapview.width - NORMAL_TILE_WIDTH) / 2;
- gui_y -= (mapview.height - NORMAL_TILE_HEIGHT) / 2;
+ gui_x -= (mapview.width - tileset_tile_width(tileset)) / 2;
+ gui_y -= (mapview.height - tileset_tile_height(tileset)) / 2;
set_mapview_origin(gui_x, gui_y);
}
@@ -842,10 +842,10 @@
{
int canvas_x, canvas_y;
int xmin, ymin, xmax, ymax, xsize, ysize, scroll_x, scroll_y;
- const int border_x = (tileset_is_isometric(tileset) ? NORMAL_TILE_WIDTH / 2
- : 2 * NORMAL_TILE_WIDTH);
- const int border_y = (tileset_is_isometric(tileset) ? NORMAL_TILE_HEIGHT / 2
- : 2 * NORMAL_TILE_HEIGHT);
+ const int border_x = (tileset_is_isometric(tileset) ?
tileset_tile_width(tileset) / 2
+ : 2 * tileset_tile_width(tileset));
+ const int border_y = (tileset_is_isometric(tileset) ?
tileset_tile_height(tileset) / 2
+ : 2 * tileset_tile_height(tileset));
bool same = (tileset_is_isometric(tileset) == MAP_IS_ISOMETRIC);
get_mapview_scroll_window(&xmin, &ymin, &xmax, &ymax, &xsize, &ysize);
@@ -868,11 +868,11 @@
&& (!same || scroll_y > ymin || topo_has_flag(TF_WRAPY))) {
return FALSE;
}
- if (canvas_x + NORMAL_TILE_WIDTH > mapview.width - border_x
+ if (canvas_x + tileset_tile_width(tileset) > mapview.width - border_x
&& (!same || scroll_x + xsize < xmax || topo_has_flag(TF_WRAPX))) {
return FALSE;
}
- if (canvas_y + NORMAL_TILE_HEIGHT > mapview.height - border_y
+ if (canvas_y + tileset_tile_height(tileset) > mapview.height - border_y
&& (!same || scroll_y + ysize < ymax || topo_has_flag(TF_WRAPY))) {
return FALSE;
}
@@ -939,12 +939,12 @@
/**************************************************************************
Draw the given unit onto the canvas store at the given location. The
- area of drawing is UNIT_TILE_HEIGHT x UNIT_TILE_WIDTH.
+ area of drawing is tileset_full_tile_height(tileset) x
tileset_full_tile_width(tileset).
**************************************************************************/
void put_unit(const struct unit *punit,
struct canvas *pcanvas, int canvas_x, int canvas_y)
{
- canvas_y += (UNIT_TILE_HEIGHT - NORMAL_TILE_HEIGHT);
+ canvas_y += (tileset_full_tile_height(tileset) -
tileset_tile_height(tileset));
mapview_layer_iterate(layer) {
put_one_element(pcanvas, layer, NULL, NULL, NULL,
punit, NULL, canvas_x, canvas_y, NULL);
@@ -953,12 +953,12 @@
/**************************************************************************
Draw the given city onto the canvas store at the given location. The
- area of drawing is UNIT_TILE_HEIGHT x UNIT_TILE_WIDTH.
+ area of drawing is tileset_full_tile_height(tileset) x
tileset_full_tile_width(tileset).
**************************************************************************/
void put_city(struct city *pcity,
struct canvas *pcanvas, int canvas_x, int canvas_y)
{
- canvas_y += (UNIT_TILE_HEIGHT - NORMAL_TILE_HEIGHT);
+ canvas_y += (tileset_full_tile_height(tileset) -
tileset_tile_height(tileset));
mapview_layer_iterate(layer) {
put_one_element(pcanvas, layer,
NULL, NULL, NULL, NULL, pcity,
@@ -968,14 +968,14 @@
/**************************************************************************
Draw the given tile terrain onto the canvas store at the given location.
- The area of drawing is UNIT_TILE_HEIGHT x UNIT_TILE_WIDTH (even though
+ The area of drawing is tileset_full_tile_height(tileset) x
tileset_full_tile_width(tileset) (even though
most tiles are not this tall).
**************************************************************************/
void put_terrain(struct tile *ptile,
struct canvas *pcanvas, int canvas_x, int canvas_y)
{
/* Use full tile height, even for terrains. */
- canvas_y += (UNIT_TILE_HEIGHT - NORMAL_TILE_HEIGHT);
+ canvas_y += (tileset_full_tile_height(tileset) -
tileset_tile_height(tileset));
mapview_layer_iterate(layer) {
put_one_element(pcanvas, layer, ptile, NULL, NULL, NULL, NULL,
canvas_x, canvas_y, NULL);
@@ -1071,8 +1071,8 @@
(void) tile_to_canvas_pos(&canvas_x, &canvas_y, ptile);
get_sprite_dimensions(mysprite, &width, &height);
- canvas_x += (NORMAL_TILE_WIDTH - width) / 2;
- canvas_y += (NORMAL_TILE_HEIGHT - height) / 2;
+ canvas_x += (tileset_tile_width(tileset) - width) / 2;
+ canvas_y += (tileset_tile_height(tileset) - height) / 2;
/* Make sure everything is flushed and synced before proceeding. First
* we update everything to the store, but don't write this to screen.
@@ -1164,7 +1164,7 @@
mapview_layer_iterate(layer) {
gui_rect_iterate(gui_x0, gui_y0, width,
height + (tileset_is_isometric(tileset)
- ? (NORMAL_TILE_HEIGHT / 2) : 0),
+ ? (tileset_tile_height(tileset) / 2) : 0),
ptile, pedge, pcorner, gui_x, gui_y) {
const int cx = gui_x - mapview.gui_x0, cy = gui_y - mapview.gui_y0;
@@ -1268,7 +1268,7 @@
*width = *height = 0;
- canvas_x += NORMAL_TILE_WIDTH / 2;
+ canvas_x += tileset_tile_width(tileset) / 2;
canvas_y += tileset_citybar_offset_y(tileset);
if (draw_city_names) {
@@ -1320,7 +1320,7 @@
void show_city_descriptions(int canvas_x, int canvas_y,
int width, int height)
{
- const int dx = max_desc_width - NORMAL_TILE_WIDTH, dy = max_desc_height;
+ const int dx = max_desc_width - tileset_tile_width(tileset), dy =
max_desc_height;
const int offset_y = tileset_citybar_offset_y(tileset);
if (!draw_city_names && !draw_city_productions) {
@@ -1332,9 +1332,9 @@
* we need to update some tiles above the mapview and some to the left
* and right.
*
- * /--W1--\ (W1 = NORMAL_TILE_WIDTH)
+ * /--W1--\ (W1 = tileset_tile_width(tileset))
* -------- \
- * | CITY | H1 (H1 = NORMAL_TILE_HEIGHT)
+ * | CITY | H1 (H1 = tileset_tile_height(tileset))
* | | /
* ------------------ \
* | DESCRIPTION | H2 (H2 = MAX_CITY_DESC_HEIGHT)
@@ -1422,8 +1422,8 @@
/* Determine the source position of the segment. */
(void) tile_to_canvas_pos(&canvas_x, &canvas_y, src_tile);
- canvas_x += NORMAL_TILE_WIDTH / 2;
- canvas_y += NORMAL_TILE_HEIGHT / 2;
+ canvas_x += tileset_tile_width(tileset) / 2;
+ canvas_y += tileset_tile_height(tileset) / 2;
/* Determine the vector of the segment. */
map_to_gui_vector(&canvas_dx, &canvas_dy, DIR_DX[dir], DIR_DY[dir]);
@@ -1504,7 +1504,7 @@
unqueue_mapview_updates(FALSE);
canvas_copy(mapview.tmp_store, mapview.store,
canvas_x, canvas_y, canvas_x, canvas_y,
- NORMAL_TILE_WIDTH, NORMAL_TILE_HEIGHT);
+ tileset_tile_width(tileset), tileset_tile_height(tileset));
for (i = 0; i < num_tiles_explode_unit; i++) {
int w, h;
@@ -1518,12 +1518,12 @@
* flickering. */
canvas_copy(mapview.store, mapview.tmp_store,
canvas_x, canvas_y, canvas_x, canvas_y,
- NORMAL_TILE_WIDTH, NORMAL_TILE_HEIGHT);
+ tileset_tile_width(tileset), tileset_tile_height(tileset));
canvas_put_sprite_full(mapview.store,
- canvas_x + NORMAL_TILE_WIDTH / 2 - w / 2,
- canvas_y + NORMAL_TILE_HEIGHT / 2 - h / 2,
+ canvas_x + tileset_tile_width(tileset) / 2 - w / 2,
+ canvas_y + tileset_tile_height(tileset) / 2 - h /
2,
sprite);
- dirty_rect(canvas_x, canvas_y, NORMAL_TILE_WIDTH, NORMAL_TILE_HEIGHT);
+ dirty_rect(canvas_x, canvas_y, tileset_tile_width(tileset),
tileset_tile_height(tileset));
flush_dirty();
gui_flush();
@@ -1577,7 +1577,7 @@
tile_to_canvas_pos(&start_x, &start_y, src_tile);
if (tileset_is_isometric(tileset)) {
- start_y -= NORMAL_TILE_HEIGHT / 2;
+ start_y -= tileset_tile_height(tileset) / 2;
}
/* Bring the backing store up to date, but don't flush. */
@@ -1597,11 +1597,11 @@
/* Backup the canvas store to the temp store. */
canvas_copy(mapview.tmp_store, mapview.store,
new_x, new_y, new_x, new_y,
- UNIT_TILE_WIDTH, UNIT_TILE_HEIGHT);
+ tileset_full_tile_width(tileset),
tileset_full_tile_height(tileset));
/* Draw */
put_unit(punit, mapview.store, new_x, new_y);
- dirty_rect(new_x, new_y, UNIT_TILE_WIDTH, UNIT_TILE_HEIGHT);
+ dirty_rect(new_x, new_y, tileset_full_tile_width(tileset),
tileset_full_tile_height(tileset));
/* Flush. */
flush_dirty();
@@ -1610,8 +1610,8 @@
/* Restore the backup. It won't take effect until the next flush. */
canvas_copy(mapview.store, mapview.tmp_store,
new_x, new_y, new_x, new_y,
- UNIT_TILE_WIDTH, UNIT_TILE_HEIGHT);
- dirty_rect(new_x, new_y, UNIT_TILE_WIDTH, UNIT_TILE_HEIGHT);
+ tileset_full_tile_width(tileset),
tileset_full_tile_height(tileset));
+ dirty_rect(new_x, new_y, tileset_full_tile_width(tileset),
tileset_full_tile_height(tileset));
} while (mytime < timing_sec);
}
}
@@ -1845,8 +1845,8 @@
* the citymap area itself plus an extra half-tile in each direction (for
* edge/corner graphics).
*/
- const int W = NORMAL_TILE_WIDTH, H = NORMAL_TILE_HEIGHT;
- const int UW = UNIT_TILE_WIDTH, UH = UNIT_TILE_HEIGHT;
+ const int W = tileset_tile_width(tileset), H = tileset_tile_height(tileset);
+ const int UW = tileset_full_tile_width(tileset), UH =
tileset_full_tile_height(tileset);
const int city_width = get_citydlg_canvas_width() + W;
const int city_height = get_citydlg_canvas_height() + H;
const struct {
@@ -2227,7 +2227,7 @@
**************************************************************************/
static bool can_do_cached_drawing(void)
{
- const int W = NORMAL_TILE_WIDTH, H = NORMAL_TILE_HEIGHT;
+ const int W = tileset_tile_width(tileset), H = tileset_tile_height(tileset);
int w = mapview.store_width, h = mapview.store_height;
/* If the mapview window is too large, cached drawing is not possible.
@@ -2353,10 +2353,10 @@
int old_tile_width = mapview.tile_width;
int old_tile_height = mapview.tile_height;
int old_width = mapview.width, old_height = mapview.height;
- int tile_width = (width + NORMAL_TILE_WIDTH - 1) / NORMAL_TILE_WIDTH;
- int tile_height = (height + NORMAL_TILE_HEIGHT - 1) / NORMAL_TILE_HEIGHT;
- int full_width = tile_width * NORMAL_TILE_WIDTH;
- int full_height = tile_height * NORMAL_TILE_HEIGHT;
+ int tile_width = (width + tileset_tile_width(tileset) - 1) /
tileset_tile_width(tileset);
+ int tile_height = (height + tileset_tile_height(tileset) - 1) /
tileset_tile_height(tileset);
+ int full_width = tile_width * tileset_tile_width(tileset);
+ int full_height = tile_height * tileset_tile_height(tileset);
bool tile_size_changed, size_changed, redrawn = FALSE;
/* Resized */
Index: client/mapview_common.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/mapview_common.h,v
retrieving revision 1.108
diff -u -r1.108 mapview_common.h
--- client/mapview_common.h 25 Mar 2005 18:03:40 -0000 1.108
+++ client/mapview_common.h 25 Mar 2005 20:40:56 -0000
@@ -77,7 +77,7 @@
* directly to fill_sprite_array.
*
* canvas_x, canvas_y: the canvas position of the current element. Each
- * element is assumed to be NORMAL_TILE_WIDTH * NORMAL_TILE_HEIGHT in
+ * element is assumed to be tileset_tile_width(tileset) *
tileset_tile_height(tileset) in
* size. If an element is larger the caller needs to use a larger rectangle
* of iteration.
*
@@ -102,8 +102,8 @@
if (_width > 0 && _height > 0) { \
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;
\
+ const int _Wr = tileset_tile_width(tileset);
\
+ const int _Hr = tileset_tile_height(tileset);
\
/* Don't divide by _r yet, to avoid integer rounding errors. */ \
const int GRI_x0 = DIVIDE(_gui_x0 * _r, _Wr) - _ratio / 2; \
const int GRI_y0 = DIVIDE(_gui_y0 * _r, _Hr) - _ratio / 2; \
@@ -212,8 +212,8 @@
} \
} \
}
\
- gui_x = GRI_x_itr * _Wr / _r - NORMAL_TILE_WIDTH / 2; \
- gui_y = GRI_y_itr * _Hr / _r - NORMAL_TILE_HEIGHT / 2;
+ gui_x = GRI_x_itr * _Wr / _r - tileset_tile_width(tileset) / 2;
\
+ gui_y = GRI_y_itr * _Hr / _r - tileset_tile_height(tileset) / 2;
#define gui_rect_iterate_end \
} \
Index: client/tilespec.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/tilespec.c,v
retrieving revision 1.276
diff -u -r1.276 tilespec.c
--- client/tilespec.c 25 Mar 2005 18:26:04 -0000 1.276
+++ client/tilespec.c 25 Mar 2005 20:40:57 -0000
@@ -433,7 +433,21 @@
/****************************************************************************
Return the tile width of the current tileset. This is the tesselation
- width of the tiled plane.
+ width of the tiled plane. This means it's the width of the bounding box
+ of the basic map tile.
+
+ For best results:
+ - The value should be even (or a multiple of 4 in iso-view).
+ - In iso-view, the width should be twice the height (to give a
+ perspective of 30 degrees above the horizon).
+ - In non-iso-view, width and height should be equal (overhead
+ perspective).
+ - In hex or iso-hex view, remember this is the tesselation vector.
+ hex_width and hex_height then give the size of the side of the
+ hexagon. Calculating the dimensions of a "regular" hexagon or
+ iso-hexagon may be tricky.
+ However these requirements are not absolute and callers should not
+ depend on them (although some do).
****************************************************************************/
int tileset_tile_width(struct tileset *t)
{
@@ -442,7 +456,10 @@
/****************************************************************************
Return the tile height of the current tileset. This is the tesselation
- height of the tiled plane.
+ height of the tiled plane. This means it's the height of the bounding box
+ of the basic map tile.
+
+ See also tileset_tile_width.
****************************************************************************/
int tileset_tile_height(struct tileset *t)
{
@@ -464,6 +481,9 @@
Return the full tile height of the current tileset. This is the maximum
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.
+
+ Some callers assume the full height is 50% larger than the height in
+ iso-view, and equal in non-iso view.
****************************************************************************/
int tileset_full_tile_height(struct tileset *t)
{
@@ -1198,20 +1218,20 @@
t->normal_tile_height
= secfile_lookup_int(file, "tilespec.normal_tile_height");
if (t->is_isometric) {
- t->full_tile_width = NORMAL_TILE_WIDTH;
- t->full_tile_height = 3 * NORMAL_TILE_HEIGHT / 2;
+ t->full_tile_width = t->normal_tile_width;
+ t->full_tile_height = 3 * t->normal_tile_height / 2;
} else {
- t->full_tile_width = NORMAL_TILE_WIDTH;
- t->full_tile_height = NORMAL_TILE_HEIGHT;
+ t->full_tile_width = t->normal_tile_width;
+ t->full_tile_height = t->normal_tile_height;
}
t->small_sprite_width
= secfile_lookup_int(file, "tilespec.small_tile_width");
t->small_sprite_height
= secfile_lookup_int(file, "tilespec.small_tile_height");
freelog(LOG_VERBOSE, "tile sizes %dx%d, %d%d unit, %d%d small",
- NORMAL_TILE_WIDTH, NORMAL_TILE_HEIGHT,
- UNIT_TILE_WIDTH, UNIT_TILE_HEIGHT,
- SMALL_TILE_WIDTH, SMALL_TILE_HEIGHT);
+ t->normal_tile_width, t->normal_tile_height,
+ t->full_tile_width, t->full_tile_height,
+ t->small_sprite_width, t->small_sprite_height);
t->roadstyle = secfile_lookup_int_default(file, t->is_isometric ? 0 : 1,
"tilespec.roadstyle");
@@ -1237,7 +1257,7 @@
"tilespec.unit_offset_y");
t->citybar_offset_y
- = secfile_lookup_int_default(file, NORMAL_TILE_HEIGHT,
+ = secfile_lookup_int_default(file, t->normal_tile_height,
"tilespec.citybar_offset_y");
t->city_names_font_size
@@ -1604,7 +1624,7 @@
{
char buffer[512];
const char dir_char[] = "nsew";
- const int W = NORMAL_TILE_WIDTH, H = NORMAL_TILE_HEIGHT;
+ const int W = t->normal_tile_width, H = t->normal_tile_height;
int i, j;
assert(t->sprite_hash != NULL);
@@ -1936,7 +1956,8 @@
for (p = 0; p < MAX_NUM_PLAYERS + MAX_NUM_BARBARIANS; p++) {
if (t->sprites.colors.player[p] && t->sprites.grid.borders[i][j]) {
s = crop_sprite(t->sprites.colors.player[p],
- 0, 0, NORMAL_TILE_WIDTH, NORMAL_TILE_HEIGHT,
+ 0, 0,
+ t->normal_tile_width, t->normal_tile_height,
t->sprites.grid.borders[i][j], 0, 0);
} else {
s = t->sprites.grid.borders[i][j];
@@ -1975,7 +1996,7 @@
{
/* Isometric: take a single tx.darkness tile and split it into 4. */
struct Sprite *darkness = load_sprite(t, "tx.darkness");
- const int W = NORMAL_TILE_WIDTH, H = NORMAL_TILE_HEIGHT;
+ const int W = t->normal_tile_width, H = t->normal_tile_height;
int offsets[4][2] = {{W / 2, 0}, {0, H / 2}, {W / 2, H / 2}, {0, 0}};
if (!darkness) {
@@ -2291,7 +2312,8 @@
if (sprite) {
/* Crop the sprite to separate this cell. */
- const int W = NORMAL_TILE_WIDTH, H = NORMAL_TILE_HEIGHT;
+ const int W = t->normal_tile_width;
+ const int H = t->normal_tile_height;
int x[4] = {W / 4, W / 4, 0, W / 2};
int y[4] = {H / 2, 0, H / 4, H / 4};
int xo[4] = {0, 0, -W / 2, W / 2};
@@ -2320,7 +2342,7 @@
if (draw->is_blended && t->is_isometric) {
/* Set up blending sprites. This only works in iso-view! */
- const int W = NORMAL_TILE_WIDTH, H = NORMAL_TILE_HEIGHT;
+ const int W = t->normal_tile_width, H = t->normal_tile_height;
const int offsets[4][2] = {
{W / 2, 0}, {0, H / 2}, {W / 2, H / 2}, {0, 0}
};
@@ -2460,8 +2482,8 @@
return t->sprites.city.tile[style][city_styles[style].tiles_num + 1];
}
-#define FULL_TILE_X_OFFSET ((NORMAL_TILE_WIDTH - UNIT_TILE_WIDTH) / 2)
-#define FULL_TILE_Y_OFFSET (NORMAL_TILE_HEIGHT - UNIT_TILE_HEIGHT)
+#define FULL_TILE_X_OFFSET ((t->normal_tile_width - t->full_tile_width) / 2)
+#define FULL_TILE_Y_OFFSET (t->normal_tile_height - t->full_tile_height)
#define ADD_SPRITE(s, draw_fog, x_offset, y_offset) \
(assert(s != NULL), \
@@ -3012,8 +3034,8 @@
int food = city_get_output_tile(city_x, city_y, pcity, O_FOOD);
int shields = city_get_output_tile(city_x, city_y, pcity, O_SHIELD);
int trade = city_get_output_tile(city_x, city_y, pcity, O_TRADE);
- const int ox = t->is_isometric ? NORMAL_TILE_WIDTH / 3 : 0;
- const int oy = t->is_isometric ? -NORMAL_TILE_HEIGHT / 3 : 0;
+ const int ox = t->is_isometric ? t->normal_tile_width / 3 : 0;
+ const int oy = t->is_isometric ? -t->normal_tile_height / 3 : 0;
food = CLIP(0, food, NUM_TILES_DIGITS - 1);
shields = CLIP(0, shields, NUM_TILES_DIGITS - 1);
@@ -3046,7 +3068,7 @@
if (t->is_isometric && t->sprites.terrain[ttype]->is_blended) {
enum direction4 dir;
- const int W = NORMAL_TILE_WIDTH, H = NORMAL_TILE_HEIGHT;
+ const int W = t->normal_tile_width, H = t->normal_tile_height;
const int offsets[4][2] = {
{W/2, 0}, {0, H / 2}, {W / 2, H / 2}, {0, 0}
};
@@ -3212,7 +3234,7 @@
* for each of the 4 cells (32 sprites total).
*
* These arrays correspond to the direction4 ordering. */
- const int W = NORMAL_TILE_WIDTH, H = NORMAL_TILE_HEIGHT;
+ const int W = t->normal_tile_width, H = t->normal_tile_height;
const int iso_offsets[4][2] = {
{W / 4, 0}, {W / 4, H / 2}, {W / 2, H / 4}, {0, H / 4}
};
@@ -3279,7 +3301,7 @@
break;
case DARKNESS_ISORECT:
for (i = 0; i < 4; i++) {
- const int W = NORMAL_TILE_WIDTH, H = NORMAL_TILE_HEIGHT;
+ const int W = t->normal_tile_width, H = t->normal_tile_height;
int offsets[4][2] = {{W / 2, 0}, {0, H / 2}, {W / 2, H / 2}, {0, 0}};
if (UNKNOWN(DIR4_TO_DIR8[i])) {
Index: client/tilespec.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/tilespec.h,v
retrieving revision 1.137
diff -u -r1.137 tilespec.h
--- client/tilespec.h 25 Mar 2005 18:26:04 -0000 1.137
+++ client/tilespec.h 25 Mar 2005 20:40:57 -0000
@@ -200,36 +200,6 @@
Output_type_id otype,
const struct unit *punit);
-/* These variables contain the size of the tiles used within the game.
- *
- * "normal" tiles include most mapview graphics, particularly the basic
- * terrain graphics.
- *
- * "unit" tiles are those used for drawing units. In iso view these are
- * larger than normal tiles to mimic a 3D effect.
- *
- * "small" tiles are used for extra "theme" graphics, particularly sprites
- * for citizens, governments, and other panel indicator icons.
- *
- * Various parts of the code may make additional assumptions, including:
- * - in non-iso view:
- * - NORMAL_TILE_WIDTH == NORMAL_TILE_HEIGHT
- * - UNIT_TILE_WIDTH == NORMAL_TILE_WIDTH
- * - UNIT_TILE_HEIGHT == NORMAL_TILE_HEIGHT
- * - in iso-view:
- * - NORMAL_TILE_WIDTH == 2 * NORMAL_TILE_HEIGHT
- * - UNIT_TILE_WIDTH == NORMAL_TILE_WIDTH
- * - UNIT_TILE_HEIGHT == NORMAL_TILE_HEIGHT * 3 / 2
- * - NORMAL_TILE_WIDTH and NORMAL_TILE_HEIGHT are even
- */
-
-#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"
* coordinates are used. For classical maps the width and height are
Index: client/gui-ftwl/mapview.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-ftwl/mapview.c,v
retrieving revision 1.18
diff -u -r1.18 mapview.c
--- client/gui-ftwl/mapview.c 25 Mar 2005 10:31:52 -0000 1.18
+++ client/gui-ftwl/mapview.c 25 Mar 2005 20:40:58 -0000
@@ -352,13 +352,13 @@
#if 0
/* try to trace that hard-to-find assert that we sometimes get */
freelog(LOG_NORMAL, "show_city_desc(%s) pcx=%d->%d (%d) pcy=%d->%d (%d)",
pcity->name,
- canvas_x, canvas_x+NORMAL_TILE_WIDTH / 2, all_rect.width,
- canvas_y, canvas_y+NORMAL_TILE_HEIGHT, all_rect.height);
+ canvas_x, canvas_x+tileset_tile_width(tileset) / 2, all_rect.width,
+ canvas_y, canvas_y+tileset_tile_height(tileset), all_rect.height);
#endif
/* Put text centered below tile */
- canvas_x += NORMAL_TILE_WIDTH / 2;
- canvas_y += NORMAL_TILE_HEIGHT;
+ canvas_x += tileset_tile_width(tileset) / 2;
+ canvas_y += tileset_tile_height(tileset);
get_city_mapview_name_and_growth(pcity, buffer, sizeof(buffer),
buffer2, sizeof(buffer2), &color);
@@ -516,7 +516,7 @@
**************************************************************************/
static struct osda *unit_to_osda(struct unit *punit)
{
- struct osda *result = be_create_osda(UNIT_TILE_WIDTH, UNIT_TILE_HEIGHT);
+ struct osda *result = be_create_osda(tileset_full_tile_width(tileset),
tileset_full_tile_height(tileset));
struct canvas *store = fc_malloc(sizeof(*store));
store->osda = result;
@@ -533,7 +533,7 @@
**************************************************************************/
static struct osda *terrain_to_osda(struct tile *ptile)
{
- struct osda *result = be_create_osda(UNIT_TILE_WIDTH, UNIT_TILE_HEIGHT);
+ struct osda *result = be_create_osda(tileset_full_tile_width(tileset),
tileset_full_tile_height(tileset));
struct canvas *store = fc_malloc(sizeof(*store));
store->osda = result;
@@ -550,7 +550,7 @@
**************************************************************************/
static struct osda *city_to_osda(struct city *pcity)
{
- struct osda *result = be_create_osda(UNIT_TILE_WIDTH, UNIT_TILE_HEIGHT);
+ struct osda *result = be_create_osda(tileset_full_tile_width(tileset),
tileset_full_tile_height(tileset));
struct canvas *store = fc_malloc(sizeof(*store));
store->osda = result;
@@ -567,9 +567,9 @@
**************************************************************************/
static struct osda *create_selected_osda(struct osda *osda)
{
- struct osda *result = be_create_osda(UNIT_TILE_WIDTH, UNIT_TILE_HEIGHT);
- struct ct_rect spec={0,0,UNIT_TILE_WIDTH, UNIT_TILE_HEIGHT};
- struct ct_size size={UNIT_TILE_WIDTH, UNIT_TILE_HEIGHT};
+ struct osda *result = be_create_osda(tileset_full_tile_width(tileset),
tileset_full_tile_height(tileset));
+ struct ct_rect spec={0,0,tileset_full_tile_width(tileset),
tileset_full_tile_height(tileset)};
+ struct ct_size size={tileset_full_tile_width(tileset),
tileset_full_tile_height(tileset)};
be_copy_osda_to_osda(result, osda, &size, NULL, NULL);
@@ -813,9 +813,9 @@
int dy = drag_factor * (current_position->y - start_position->y);
int factorx =
- drag_granularity == 0 ? 1 : drag_granularity * NORMAL_TILE_WIDTH;
+ drag_granularity == 0 ? 1 : drag_granularity *
tileset_tile_width(tileset);
int factory =
- drag_granularity == 0 ? 1 : drag_granularity * NORMAL_TILE_HEIGHT;
+ drag_granularity == 0 ? 1 : drag_granularity *
tileset_tile_height(tileset);
dx /= factorx;
dy /= factory;
Index: client/gui-gtk/citydlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/citydlg.c,v
retrieving revision 1.198
diff -u -r1.198 citydlg.c
--- client/gui-gtk/citydlg.c 21 Mar 2005 16:37:52 -0000 1.198
+++ client/gui-gtk/citydlg.c 25 Mar 2005 20:40:58 -0000
@@ -322,9 +322,9 @@
canvas_height = get_citydlg_canvas_height();
if (tileset_is_isometric(tileset)) {
- MAX_UNIT_ROWS = (int) (100 / (UNIT_TILE_HEIGHT));
+ MAX_UNIT_ROWS = (int) (100 / (tileset_full_tile_height(tileset)));
} else {
- MAX_UNIT_ROWS = (int) (100 / (UNIT_TILE_HEIGHT + 6));
+ MAX_UNIT_ROWS = (int) (100 / (tileset_full_tile_height(tileset) + 6));
}
}
@@ -342,7 +342,7 @@
dialog_list = dialog_list_new();
init_citydlg_dimensions();
- NUM_UNITS_SHOWN = (int) (MAX_UNIT_ROWS * 500) / (UNIT_TILE_WIDTH);
+ NUM_UNITS_SHOWN = (int) (MAX_UNIT_ROWS * 500) /
(tileset_full_tile_width(tileset));
/* make the styles */
@@ -669,7 +669,7 @@
/* present and supported units (overview page) */
/* TODO: smarter size VALUE */
- MINI_NUM_UNITS = 225 / UNIT_TILE_WIDTH;
+ MINI_NUM_UNITS = 225 / tileset_full_tile_width(tileset);
pdialog->overview.present_unit_boxes =
fc_malloc(MINI_NUM_UNITS * sizeof(GtkWidget *));
@@ -702,7 +702,7 @@
for (i = 0; i < MINI_NUM_UNITS; i++) {
int unit_height = (tileset_is_isometric(tileset)) ?
- UNIT_TILE_HEIGHT : UNIT_TILE_HEIGHT + UNIT_TILE_HEIGHT / 2;
+ tileset_full_tile_height(tileset) : tileset_full_tile_height(tileset) +
tileset_full_tile_height(tileset) / 2;
pdialog->overview.supported_unit_boxes[i] = gtk_event_box_new();
gtk_widget_set_events(pdialog->overview.supported_unit_boxes[i],
@@ -712,7 +712,7 @@
TRUE, 0);
pdialog->overview.supported_unit_pixmaps[i] =
- gtk_pixcomm_new(root_window, UNIT_TILE_WIDTH, unit_height);
+ gtk_pixcomm_new(root_window, tileset_full_tile_width(tileset),
unit_height);
gtk_container_add(GTK_CONTAINER
(pdialog->overview.supported_unit_boxes[i]),
pdialog->overview.supported_unit_pixmaps[i]);
@@ -769,7 +769,7 @@
0);
pdialog->overview.present_unit_pixmaps[i] =
- gtk_pixcomm_new(root_window, UNIT_TILE_WIDTH, UNIT_TILE_HEIGHT);
+ gtk_pixcomm_new(root_window, tileset_full_tile_width(tileset),
tileset_full_tile_height(tileset));
gtk_container_add(GTK_CONTAINER
(pdialog->overview.present_unit_boxes[i]),
pdialog->overview.present_unit_pixmaps[i]);
@@ -927,11 +927,11 @@
gtk_notebook_append_page(GTK_NOTEBOOK(pdialog->notebook), page, label);
if (tileset_is_isometric(tileset))
- MAX_UNIT_ROWS = (int) (100 / (UNIT_TILE_HEIGHT));
+ MAX_UNIT_ROWS = (int) (100 / (tileset_full_tile_height(tileset)));
else
- MAX_UNIT_ROWS = (int) (100 / (UNIT_TILE_HEIGHT + 6));
+ MAX_UNIT_ROWS = (int) (100 / (tileset_full_tile_height(tileset) + 6));
- NUM_UNITS_SHOWN = (int) (MAX_UNIT_ROWS * 500) / (UNIT_TILE_WIDTH);
+ NUM_UNITS_SHOWN = (int) (MAX_UNIT_ROWS * 500) /
(tileset_full_tile_width(tileset));
/* TODO: One problem. If we use these "intelligent" calculations which
* provide us with suitable amount of units with different sizes of
@@ -994,8 +994,8 @@
num = 0;
pdialog->unit.supported_unit_pixmaps[i] =
- gtk_pixcomm_new(root_window, UNIT_TILE_WIDTH,
- NORMAL_TILE_HEIGHT + NORMAL_TILE_HEIGHT / 2);
+ gtk_pixcomm_new(root_window, tileset_full_tile_width(tileset),
+ tileset_tile_height(tileset) +
tileset_tile_height(tileset) / 2);
gtk_container_add(GTK_CONTAINER(pdialog->unit.supported_unit_boxes[i]),
pdialog->unit.supported_unit_pixmaps[i]);
pdialog->unit.supported_unit_ids[i] = -1;
@@ -1054,7 +1054,7 @@
pdialog->unit.present_unit_pixmaps[i] =
- gtk_pixcomm_new(root_window, UNIT_TILE_WIDTH, UNIT_TILE_HEIGHT);
+ gtk_pixcomm_new(root_window, tileset_full_tile_width(tileset),
tileset_full_tile_height(tileset));
gtk_container_add(GTK_CONTAINER(pdialog->unit.present_unit_boxes[i]),
pdialog->unit.present_unit_pixmaps[i]);
pdialog->unit.present_unit_ids[i] = -1;
@@ -1498,8 +1498,8 @@
gtk_widget_set_events(ebox, GDK_BUTTON_PRESS_MASK);
gtk_box_pack_start(GTK_BOX(hbox), ebox, FALSE, FALSE, 0);
pdialog->citizen_pixmap =
- gtk_pixcomm_new(root_window, SMALL_TILE_WIDTH * NUM_CITIZENS_SHOWN,
- SMALL_TILE_HEIGHT);
+ gtk_pixcomm_new(root_window, tileset_small_sprite_width(tileset) *
NUM_CITIZENS_SHOWN,
+ tileset_small_sprite_height(tileset));
gtk_container_add(GTK_CONTAINER(ebox), pdialog->citizen_pixmap);
gtk_signal_connect(GTK_OBJECT(ebox), "button_press_event",
GTK_SIGNAL_FUNC(citizens_callback), pdialog);
@@ -1647,14 +1647,14 @@
/* If there is not enough space we stack the icons. We draw from left to */
/* right. width is how far we go to the right for each drawn pixmap. The */
/* last icon is always drawn in full, and so has reserved */
- /* SMALL_TILE_WIDTH pixels. */
+ /* tileset_small_sprite_width(tileset) pixels.
*/
if (pcity->size > 1) {
- width = MIN(SMALL_TILE_WIDTH,
- ((NUM_CITIZENS_SHOWN - 1) * SMALL_TILE_WIDTH) /
+ width = MIN(tileset_small_sprite_width(tileset),
+ ((NUM_CITIZENS_SHOWN - 1) *
tileset_small_sprite_width(tileset)) /
(pcity->size - 1));
} else {
- width = SMALL_TILE_WIDTH;
+ width = tileset_small_sprite_width(tileset);
}
pdialog->cwidth = width;
@@ -2635,7 +2635,7 @@
struct city *pcity = pdialog->pcity;
int citnum;
- if (ev->x > (pcity->size - 1) * pdialog->cwidth + SMALL_TILE_WIDTH)
+ if (ev->x > (pcity->size - 1) * pdialog->cwidth +
tileset_small_sprite_width(tileset))
return; /* no citizen that far to the right */
citnum = MIN(pcity->size - 1, ev->x / pdialog->cwidth);
Index: client/gui-gtk/dialogs.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/dialogs.c,v
retrieving revision 1.153
diff -u -r1.153 dialogs.c
--- client/gui-gtk/dialogs.c 25 Mar 2005 18:03:16 -0000 1.153
+++ client/gui-gtk/dialogs.c 25 Mar 2005 20:40:58 -0000
@@ -1574,13 +1574,13 @@
punittemp->name, unit_activity_text(punit));
}
- pix = gtk_pixcomm_new(root_window, UNIT_TILE_WIDTH, UNIT_TILE_HEIGHT);
+ pix = gtk_pixcomm_new(root_window, tileset_full_tile_width(tileset),
tileset_full_tile_height(tileset));
unit_select_commands[i]=gtk_button_new();
gtk_widget_set_sensitive(unit_select_commands[i],
can_unit_do_activity(punit, ACTIVITY_IDLE) );
gtk_widget_set_usize(unit_select_commands[i],
- UNIT_TILE_WIDTH+4, UNIT_TILE_HEIGHT+4);
+ tileset_full_tile_width(tileset)+4,
tileset_full_tile_height(tileset)+4);
gtk_container_add(GTK_CONTAINER(unit_select_commands[i]), pix);
gtk_box_pack_start(GTK_BOX(hbox),unit_select_commands[i],
FALSE, FALSE, 0);
Index: client/gui-gtk/gui_main.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/gui_main.c,v
retrieving revision 1.166
diff -u -r1.166 gui_main.c
--- client/gui-gtk/gui_main.c 21 Mar 2005 16:37:52 -0000 1.166
+++ client/gui-gtk/gui_main.c 25 Mar 2005 20:40:59 -0000
@@ -467,15 +467,15 @@
GtkWidget *table = unit_pixmap_table;
/* 135 below is rough value (could be more intelligent) --dwp */
- num_units_below = 135 / (int) NORMAL_TILE_WIDTH;
+ num_units_below = 135 / (int) tileset_tile_width(tileset);
num_units_below = CLIP(1, num_units_below, MAX_NUM_UNITS_BELOW);
gtk_table_resize(GTK_TABLE(table), 2, num_units_below);
/* Note, we ref this and other widgets here so that we can unref them
* in reset_unit_table. */
- unit_pixmap = gtk_pixcomm_new(root_window, UNIT_TILE_WIDTH,
- UNIT_TILE_HEIGHT);
+ unit_pixmap = gtk_pixcomm_new(root_window, tileset_full_tile_width(tileset),
+ tileset_full_tile_height(tileset));
gtk_widget_ref(unit_pixmap);
gtk_pixcomm_clear(GTK_PIXCOMM(unit_pixmap), TRUE);
unit_pixmap_button = gtk_event_box_new();
@@ -487,8 +487,8 @@
GINT_TO_POINTER(-1));
for(i = 0; i < num_units_below; i++) {
- unit_below_pixmap[i] = gtk_pixcomm_new(root_window, UNIT_TILE_WIDTH,
- UNIT_TILE_HEIGHT);
+ unit_below_pixmap[i] = gtk_pixcomm_new(root_window,
tileset_full_tile_width(tileset),
+ tileset_full_tile_height(tileset));
gtk_widget_ref(unit_below_pixmap[i]);
unit_below_pixmap_button[i] = gtk_event_box_new();
gtk_widget_ref(unit_below_pixmap_button[i]);
@@ -502,7 +502,7 @@
gtk_table_attach_defaults(GTK_TABLE(table), unit_below_pixmap_button[i],
i, i + 1, 1, 2);
gtk_widget_set_usize(unit_below_pixmap[i],
- UNIT_TILE_WIDTH, UNIT_TILE_HEIGHT);
+ tileset_full_tile_width(tileset),
tileset_full_tile_height(tileset));
gtk_pixcomm_clear(GTK_PIXCOMM(unit_below_pixmap[i]), TRUE);
}
@@ -684,7 +684,7 @@
for (i = 0; i < 5; i++) {
frame = gtk_frame_new(NULL);
- gtk_widget_set_usize(frame, SMALL_TILE_WIDTH, SMALL_TILE_HEIGHT);
+ gtk_widget_set_usize(frame, tileset_small_sprite_width(tileset),
tileset_small_sprite_height(tileset));
if (i == 4) {
gtk_table_attach_defaults(GTK_TABLE(table), frame, i, i + 6, 1, 2);
Index: client/gui-gtk/happiness.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/happiness.c,v
retrieving revision 1.21
diff -u -r1.21 happiness.c
--- client/gui-gtk/happiness.c 21 Mar 2005 16:37:52 -0000 1.21
+++ client/gui-gtk/happiness.c 25 Mar 2005 20:40:59 -0000
@@ -158,12 +158,12 @@
int i;
struct citizen_type citizens[MAX_CITY_SIZE];
int num_citizens = pcity->size;
- int pix_width = HAPPINESS_PIX_WIDTH * SMALL_TILE_WIDTH;
- int offset = MIN(SMALL_TILE_WIDTH, pix_width / num_citizens);
- int true_pix_width = (num_citizens - 1) * offset + SMALL_TILE_WIDTH;
+ int pix_width = HAPPINESS_PIX_WIDTH * tileset_small_sprite_width(tileset);
+ int offset = MIN(tileset_small_sprite_width(tileset), pix_width /
num_citizens);
+ int true_pix_width = (num_citizens - 1) * offset +
tileset_small_sprite_width(tileset);
GdkPixmap *happiness_pixmap = gdk_pixmap_new(root_window, true_pix_width,
- SMALL_TILE_HEIGHT, -1);
+
tileset_small_sprite_height(tileset), -1);
struct canvas canvas = {happiness_pixmap};
get_city_citizen_types(pcity, index, citizens);
Index: client/gui-gtk/helpdlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/helpdlg.c,v
retrieving revision 1.74
diff -u -r1.74 helpdlg.c
--- client/gui-gtk/helpdlg.c 22 Jan 2005 19:45:40 -0000 1.74
+++ client/gui-gtk/helpdlg.c 25 Mar 2005 20:40:59 -0000
@@ -477,8 +477,8 @@
gtk_container_add( GTK_CONTAINER( help_frame ), help_box );
- unit_tile = gtk_pixcomm_new(root_window, UNIT_TILE_WIDTH,
- UNIT_TILE_HEIGHT);
+ unit_tile = gtk_pixcomm_new(root_window, tileset_full_tile_width(tileset),
+ tileset_full_tile_height(tileset));
gtk_box_pack_start( GTK_BOX( help_box ), unit_tile, FALSE, FALSE, 0 );
help_itable = gtk_table_new(1, 6, FALSE);
Index: client/gui-gtk/mapview.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/mapview.c,v
retrieving revision 1.241
diff -u -r1.241 mapview.c
--- client/gui-gtk/mapview.c 21 Mar 2005 16:37:52 -0000 1.241
+++ client/gui-gtk/mapview.c 25 Mar 2005 20:40:59 -0000
@@ -501,8 +501,8 @@
int w, w2, ascent;
enum color_std color;
- canvas_x += NORMAL_TILE_WIDTH / 2;
- canvas_y += NORMAL_TILE_HEIGHT;
+ canvas_x += tileset_tile_width(tileset) / 2;
+ canvas_y += tileset_tile_height(tileset);
*width = *height = 0;
@@ -572,7 +572,7 @@
{
struct canvas store = {NULL, p};
- put_unit_city_overlays(punit, &store, 0, NORMAL_TILE_HEIGHT);
+ put_unit_city_overlays(punit, &store, 0, tileset_tile_height(tileset));
}
/**************************************************************************
Index: client/gui-gtk-2.0/citydlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/citydlg.c,v
retrieving revision 1.120
diff -u -r1.120 citydlg.c
--- client/gui-gtk-2.0/citydlg.c 21 Mar 2005 16:37:52 -0000 1.120
+++ client/gui-gtk-2.0/citydlg.c 25 Mar 2005 20:40:59 -0000
@@ -662,8 +662,8 @@
gtk_widget_add_events(ebox, GDK_BUTTON_PRESS_MASK);
gtk_box_pack_start(GTK_BOX(hbox), ebox, FALSE, FALSE, 0);
pdialog->citizen_pixmap =
- gtk_pixcomm_new(SMALL_TILE_WIDTH * NUM_CITIZENS_SHOWN,
- SMALL_TILE_HEIGHT);
+ gtk_pixcomm_new(tileset_small_sprite_width(tileset) * NUM_CITIZENS_SHOWN,
+ tileset_small_sprite_height(tileset));
gtk_misc_set_padding(GTK_MISC(pdialog->citizen_pixmap), 2, 2);
gtk_container_add(GTK_CONTAINER(ebox), pdialog->citizen_pixmap);
g_signal_connect(GTK_OBJECT(ebox), "button_press_event",
@@ -714,7 +714,7 @@
gtk_container_add(GTK_CONTAINER(pdialog->overview.supported_units_frame),
sw);
{
- int unit_height = NORMAL_TILE_HEIGHT * 3 / 2;
+ int unit_height = tileset_tile_height(tileset) * 3 / 2;
align = gtk_alignment_new(0.0, 0.0, 0.0, 0.0);
gtk_widget_set_size_request(align, -1, unit_height);
@@ -743,7 +743,7 @@
gtk_container_add(GTK_CONTAINER(pdialog->overview.present_units_frame), sw);
align = gtk_alignment_new(0.0, 0.0, 0.0, 0.0);
- gtk_widget_set_size_request(align, -1, UNIT_TILE_HEIGHT);
+ gtk_widget_set_size_request(align, -1, tileset_full_tile_height(tileset));
gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(sw), align);
table = gtk_table_new(0, 0, FALSE);
@@ -1375,14 +1375,14 @@
/* If there is not enough space we stack the icons. We draw from left to */
/* right. width is how far we go to the right for each drawn pixmap. The */
/* last icon is always drawn in full, and so has reserved */
- /* SMALL_TILE_WIDTH pixels. */
+ /* tileset_small_sprite_width(tileset) pixels.
*/
if (pcity->size > 1) {
- width = MIN(SMALL_TILE_WIDTH,
- ((NUM_CITIZENS_SHOWN - 1) * SMALL_TILE_WIDTH) /
+ width = MIN(tileset_small_sprite_width(tileset),
+ ((NUM_CITIZENS_SHOWN - 1) *
tileset_small_sprite_width(tileset)) /
(pcity->size - 1));
} else {
- width = SMALL_TILE_WIDTH;
+ width = tileset_small_sprite_width(tileset);
}
pdialog->cwidth = width;
@@ -1676,7 +1676,7 @@
GtkWidget *cmd, *pix;
struct unit_node node;
- int unit_height = NORMAL_TILE_HEIGHT * 3 / 2;
+ int unit_height = tileset_tile_height(tileset) * 3 / 2;
cmd = gtk_button_new();
node.cmd = cmd;
@@ -1685,7 +1685,7 @@
gtk_widget_add_events(cmd,
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK);
- pix = gtk_pixcomm_new(UNIT_TILE_WIDTH, unit_height);
+ pix = gtk_pixcomm_new(tileset_full_tile_width(tileset), unit_height);
node.pix = pix;
gtk_container_add(GTK_CONTAINER(cmd), pix);
@@ -1798,7 +1798,7 @@
gtk_widget_add_events(cmd,
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK);
- pix = gtk_pixcomm_new(UNIT_TILE_WIDTH, UNIT_TILE_HEIGHT);
+ pix = gtk_pixcomm_new(tileset_full_tile_width(tileset),
tileset_full_tile_height(tileset));
node.pix = pix;
gtk_container_add(GTK_CONTAINER(cmd), pix);
@@ -2355,7 +2355,7 @@
return FALSE;
}
- if (ev->x > (pcity->size - 1) * pdialog->cwidth + SMALL_TILE_WIDTH)
+ if (ev->x > (pcity->size - 1) * pdialog->cwidth +
tileset_small_sprite_width(tileset))
return FALSE; /* no citizen that far to the right */
citnum = MIN(pcity->size - 1, ev->x / pdialog->cwidth);
Index: client/gui-gtk-2.0/dialogs.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/dialogs.c,v
retrieving revision 1.95
diff -u -r1.95 dialogs.c
--- client/gui-gtk-2.0/dialogs.c 25 Mar 2005 18:15:13 -0000 1.95
+++ client/gui-gtk-2.0/dialogs.c 25 Mar 2005 20:41:00 -0000
@@ -1296,7 +1296,7 @@
struct unit_type *ptype = unit_type(punit);
pix = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8,
- UNIT_TILE_WIDTH, UNIT_TILE_HEIGHT);
+ tileset_full_tile_width(tileset), tileset_full_tile_height(tileset));
{
struct canvas canvas_store;
Index: client/gui-gtk-2.0/graphics.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/graphics.c,v
retrieving revision 1.42
diff -u -r1.42 graphics.c
--- client/gui-gtk-2.0/graphics.c 25 Mar 2005 18:15:13 -0000 1.42
+++ client/gui-gtk-2.0/graphics.c 25 Mar 2005 20:41:00 -0000
@@ -119,15 +119,15 @@
}
/* Guess */
- width = UNIT_TILE_WIDTH;
- height = UNIT_TILE_HEIGHT;
+ width = tileset_full_tile_width(tileset);
+ height = tileset_full_tile_height(tileset);
}
/* Finally, put a picture of the unit in the tile */
canvas_put_sprite(pcanvas, 0, 0, type->sprite,
(x2 + x1 - width) / 2, (y1 + y2 - height) / 2,
- UNIT_TILE_WIDTH - (x2 + x1 - width) / 2,
- UNIT_TILE_HEIGHT - (y1 + y2 - height) / 2);
+ tileset_full_tile_width(tileset) - (x2 + x1 - width) / 2,
+ tileset_full_tile_height(tileset) - (y1 + y2 - height) / 2);
}
/***************************************************************************
Index: client/gui-gtk-2.0/gui_main.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/gui_main.c,v
retrieving revision 1.116
diff -u -r1.116 gui_main.c
--- client/gui-gtk-2.0/gui_main.c 21 Mar 2005 23:01:12 -0000 1.116
+++ client/gui-gtk-2.0/gui_main.c 25 Mar 2005 20:41:00 -0000
@@ -586,14 +586,14 @@
GtkWidget *table = unit_pixmap_table;
/* 135 below is rough value (could be more intelligent) --dwp */
- num_units_below = 135 / (int) NORMAL_TILE_WIDTH;
+ num_units_below = 135 / (int) tileset_tile_width(tileset);
num_units_below = CLIP(1, num_units_below, MAX_NUM_UNITS_BELOW);
gtk_table_resize(GTK_TABLE(table), 2, num_units_below);
/* Note, we ref this and other widgets here so that we can unref them
* in reset_unit_table. */
- unit_pixmap = gtk_pixcomm_new(UNIT_TILE_WIDTH, UNIT_TILE_HEIGHT);
+ unit_pixmap = gtk_pixcomm_new(tileset_full_tile_width(tileset),
tileset_full_tile_height(tileset));
gtk_widget_ref(unit_pixmap);
gtk_pixcomm_clear(GTK_PIXCOMM(unit_pixmap));
unit_pixmap_button = gtk_event_box_new();
@@ -605,8 +605,8 @@
GINT_TO_POINTER(-1));
for (i = 0; i < num_units_below; i++) {
- unit_below_pixmap[i] = gtk_pixcomm_new(UNIT_TILE_WIDTH,
- UNIT_TILE_HEIGHT);
+ unit_below_pixmap[i] = gtk_pixcomm_new(tileset_full_tile_width(tileset),
+ tileset_full_tile_height(tileset));
gtk_widget_ref(unit_below_pixmap[i]);
unit_below_pixmap_button[i] = gtk_event_box_new();
gtk_widget_ref(unit_below_pixmap_button[i]);
@@ -620,7 +620,7 @@
gtk_table_attach_defaults(GTK_TABLE(table), unit_below_pixmap_button[i],
i, i + 1, 1, 2);
gtk_widget_set_size_request(unit_below_pixmap[i],
- UNIT_TILE_WIDTH, UNIT_TILE_HEIGHT);
+ tileset_full_tile_width(tileset),
tileset_full_tile_height(tileset));
gtk_pixcomm_clear(GTK_PIXCOMM(unit_below_pixmap[i]));
}
@@ -878,7 +878,7 @@
timeout_label = gtk_label_new("");
frame = gtk_frame_new(NULL);
- gtk_widget_set_size_request(frame, SMALL_TILE_WIDTH, SMALL_TILE_HEIGHT);
+ gtk_widget_set_size_request(frame, tileset_small_sprite_width(tileset),
tileset_small_sprite_height(tileset));
gtk_table_attach_defaults(GTK_TABLE(table), frame, 4, 10, 1, 2);
gtk_container_add(GTK_CONTAINER(frame), timeout_label);
Index: client/gui-gtk-2.0/happiness.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/happiness.c,v
retrieving revision 1.19
diff -u -r1.19 happiness.c
--- client/gui-gtk-2.0/happiness.c 21 Mar 2005 16:37:52 -0000 1.19
+++ client/gui-gtk-2.0/happiness.c 25 Mar 2005 20:41:00 -0000
@@ -36,8 +36,8 @@
/* semi-arbitrary number that controls the width of the happiness widget */
#define HAPPINESS_PIX_WIDTH 23
-#define PIXCOMM_WIDTH (HAPPINESS_PIX_WIDTH * SMALL_TILE_WIDTH)
-#define PIXCOMM_HEIGHT (SMALL_TILE_HEIGHT)
+#define PIXCOMM_WIDTH (HAPPINESS_PIX_WIDTH *
tileset_small_sprite_width(tileset))
+#define PIXCOMM_HEIGHT (tileset_small_sprite_height(tileset))
#define NUM_HAPPINESS_MODIFIERS 5
@@ -161,7 +161,7 @@
int i;
struct citizen_type citizens[MAX_CITY_SIZE];
int num_citizens = pcity->size;
- int offset = MIN(SMALL_TILE_WIDTH, PIXCOMM_WIDTH / num_citizens);
+ int offset = MIN(tileset_small_sprite_width(tileset), PIXCOMM_WIDTH /
num_citizens);
get_city_citizen_types(pcity, index, citizens);
Index: client/gui-gtk-2.0/helpdlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/helpdlg.c,v
retrieving revision 1.44
diff -u -r1.44 helpdlg.c
--- client/gui-gtk-2.0/helpdlg.c 19 Dec 2004 16:47:08 -0000 1.44
+++ client/gui-gtk-2.0/helpdlg.c 25 Mar 2005 20:41:00 -0000
@@ -503,7 +503,7 @@
help_box = gtk_vbox_new(FALSE, 5);
gtk_container_add(GTK_CONTAINER(help_frame), help_box);
- unit_tile = gtk_pixcomm_new(UNIT_TILE_WIDTH, UNIT_TILE_HEIGHT);
+ unit_tile = gtk_pixcomm_new(tileset_full_tile_width(tileset),
tileset_full_tile_height(tileset));
gtk_box_pack_start(GTK_BOX(help_box), unit_tile, FALSE, FALSE, 0);
help_itable = gtk_table_new(1, 6, FALSE);
Index: client/gui-gtk-2.0/mapctrl.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/mapctrl.c,v
retrieving revision 1.47
diff -u -r1.47 mapctrl.c
--- client/gui-gtk-2.0/mapctrl.c 23 Feb 2005 19:05:27 -0000 1.47
+++ client/gui-gtk-2.0/mapctrl.c 25 Mar 2005 20:41:01 -0000
@@ -86,15 +86,15 @@
if (x > mapview.width/2) {
/* right part of the map */
x += minx;
- y += miny + (NORMAL_TILE_HEIGHT - alloc->height)/2;
+ y += miny + (tileset_tile_height(tileset) - alloc->height)/2;
y = CLIP(miny, y, maxy - alloc->height);
gtk_window_move(GTK_WINDOW(w), x - alloc->width, y);
} else {
/* left part of the map */
- x += minx + NORMAL_TILE_WIDTH;
- y += miny + (NORMAL_TILE_HEIGHT - alloc->height)/2;
+ x += minx + tileset_tile_width(tileset);
+ y += miny + (tileset_tile_height(tileset) - alloc->height)/2;
y = CLIP(miny, y, maxy - alloc->height);
Index: client/gui-gtk-2.0/mapview.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/mapview.c,v
retrieving revision 1.169
diff -u -r1.169 mapview.c
--- client/gui-gtk-2.0/mapview.c 24 Mar 2005 16:45:52 -0000 1.169
+++ client/gui-gtk-2.0/mapview.c 25 Mar 2005 20:41:01 -0000
@@ -463,7 +463,7 @@
gtk_pixcomm_freeze(p);
- put_unit_city_overlays(punit, &store, 0, NORMAL_TILE_HEIGHT);
+ put_unit_city_overlays(punit, &store, 0, tileset_tile_height(tileset));
gtk_pixcomm_thaw(p);
}
Index: client/gui-mui/graphics.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-mui/graphics.c,v
retrieving revision 1.37
diff -u -r1.37 graphics.c
--- client/gui-mui/graphics.c 11 Mar 2005 17:11:26 -0000 1.37
+++ client/gui-mui/graphics.c 25 Mar 2005 20:41:01 -0000
@@ -143,7 +143,7 @@
*****************************************************************/
int get_normal_tile_height(void)
{
- return NORMAL_TILE_HEIGHT;
+ return tileset_tile_height(tileset);
}
/****************************************************************
@@ -151,7 +151,7 @@
*****************************************************************/
int get_normal_tile_width(void)
{
- return NORMAL_TILE_WIDTH;
+ return tileset_tile_width(tileset);
}
@@ -359,7 +359,7 @@
if (!CyberGfxBase)
mem_flags = MEMF_CHIP;
- if ((iso_fog_mask =
AllocVec(RASSIZE(NORMAL_TILE_WIDTH,NORMAL_TILE_HEIGHT),MEMF_CLEAR)))
+ if ((iso_fog_mask =
AllocVec(RASSIZE(tileset_tile_width(tileset),tileset_tile_height(tileset)),MEMF_CLEAR)))
{
struct RastPort rp;
struct BitMap bmap;
@@ -368,7 +368,7 @@
LONG bpr = GetBitMapAttr(sprite->parent->bitmap, BMA_WIDTH) / 8;
PLANEPTR mask =
(PLANEPTR)(((UWORD*)sprite->parent->mask)+(sprite->offx/16+(sprite->offy)*bpr/2));
- InitBitMap(&bmap,1,NORMAL_TILE_WIDTH,NORMAL_TILE_HEIGHT);
+
InitBitMap(&bmap,1,tileset_tile_width(tileset),tileset_tile_height(tileset));
InitRastPort(&rp);
bmap.Planes[0]=iso_fog_mask;
@@ -376,12 +376,12 @@
SetABPenDrMd(&rp,1,0,JAM1);
/* Blit the black tile */
- BltTemplate(mask,sprite->offx % 16, bpr,
&rp,0,0,NORMAL_TILE_WIDTH,NORMAL_TILE_HEIGHT);
+ BltTemplate(mask,sprite->offx % 16, bpr,
&rp,0,0,tileset_tile_width(tileset),tileset_tile_height(tileset));
SetAPen(&rp,0);
/* Fog the mask */
SetAfPt(&rp,patt,1);
- RectFill(&rp,0,0,NORMAL_TILE_WIDTH-1,NORMAL_TILE_HEIGHT-1);
+
RectFill(&rp,0,0,tileset_tile_width(tileset)-1,tileset_tile_height(tileset)-1);
SetAfPt(&rp,NULL,0);
}
}
@@ -780,7 +780,7 @@
static void fog_tile(struct RastPort *rp, LONG x, LONG y,
LONG ox, LONG oy, LONG width, LONG height)
{
- LONG bpr = (NORMAL_TILE_WIDTH+15)/16*2;
+ LONG bpr = (tileset_tile_width(tileset)+15)/16*2;
PLANEPTR mask = (PLANEPTR)((UWORD*)iso_fog_mask+ox/16+oy*bpr/2);
SetABPenDrMd(rp,GetColorPen(COLOR_STD_BLACK),0,JAM1);
@@ -810,7 +810,7 @@
void put_black_tile(struct RastPort *rp, int canvas_x, int canvas_y)
{
SetAPen(rp, GetColorPen(COLOR_STD_BLACK));
- RectFill(rp, canvas_x, canvas_y, canvas_x + NORMAL_TILE_WIDTH - 1, canvas_y
+ NORMAL_TILE_HEIGHT - 1);
+ RectFill(rp, canvas_x, canvas_y, canvas_x + tileset_tile_width(tileset) - 1,
canvas_y + tileset_tile_height(tileset) - 1);
}
@@ -838,11 +838,11 @@
{
int canvas_src_x, canvas_src_y, canvas_dest_x, canvas_dest_y;
get_canvas_xy(x, y, &canvas_src_x, &canvas_src_y);
- canvas_src_x += NORMAL_TILE_WIDTH/2;
- canvas_src_y += NORMAL_TILE_HEIGHT/2;
+ canvas_src_x += tileset_tile_width(tileset)/2;
+ canvas_src_y += tileset_tile_height(tileset)/2;
DIRSTEP(canvas_dest_x, canvas_dest_y, dir);
- canvas_dest_x = canvas_src_x + (NORMAL_TILE_WIDTH * canvas_dest_x) / 2;
- canvas_dest_y = canvas_src_y + (NORMAL_TILE_WIDTH * canvas_dest_y) / 2;
+ canvas_dest_x = canvas_src_x + (tileset_tile_width(tileset) * canvas_dest_x)
/ 2;
+ canvas_dest_y = canvas_src_y + (tileset_tile_width(tileset) * canvas_dest_y)
/ 2;
SetAPen(rp,GetColorPen(COLOR_STD_CYAN));
Move(rp,canvas_src_x+dest_x, canvas_src_y+dest_y);
@@ -865,7 +865,7 @@
if (solid_bg)
{
SetAPen(rp, GetColorPen(COLOR_STD_BLACK));
- RectFill(rp, x1, y1, x1 + NORMAL_TILE_WIDTH - 1, y1 + NORMAL_TILE_HEIGHT
- 1);
+ RectFill(rp, x1, y1, x1 + tileset_tile_width(tileset) - 1, y1 +
tileset_tile_height(tileset) - 1);
}
else
{
@@ -902,7 +902,7 @@
} else {
SetAPen(rp,GetColorPen(COLOR_STD_BACKGROUND));
}
- RectFill(rp,canvas_x,canvas_y,canvas_x + NORMAL_TILE_WIDTH - 1, canvas_y
+ NORMAL_TILE_HEIGHT - 1);
+ RectFill(rp,canvas_x,canvas_y,canvas_x + tileset_tile_width(tileset) -
1, canvas_y + tileset_tile_height(tileset) - 1);
} else {
/* first tile without mask */
put_sprite(rp, tile_sprs[0], canvas_x, canvas_y);
@@ -927,7 +927,7 @@
SetAPen(rp,GetColorPen(COLOR_STD_BLACK));
}
Move(rp,canvas_x,canvas_y);
- Draw(rp,canvas_x,canvas_y + NORMAL_TILE_HEIGHT-1);
+ Draw(rp,canvas_x,canvas_y + tileset_tile_height(tileset)-1);
/* top side... */
if((map_get_tile(x, y-1))->known &&
@@ -938,7 +938,7 @@
SetAPen(rp,GetColorPen(COLOR_STD_BLACK));
}
Move(rp,canvas_x,canvas_y);
- Draw(rp,canvas_x + NORMAL_TILE_WIDTH-1,canvas_y);
+ Draw(rp,canvas_x + tileset_tile_width(tileset)-1,canvas_y);
}
if (draw_coastline && !draw_terrain) {
@@ -950,7 +950,7 @@
/* left side */
if (is_ocean(t1) ^ is_ocean(t2)) {
Move(rp, canvas_x, canvas_y);
- Draw(rp, canvas_x, canvas_y + NORMAL_TILE_HEIGHT-1);
+ Draw(rp, canvas_x, canvas_y + tileset_tile_height(tileset)-1);
}
}
/* top side */
@@ -959,7 +959,7 @@
t2 = map_get_terrain(x1, y1);
if (is_ocean(t1) ^ is_ocean(t2)) {
Move(rp, canvas_x, canvas_y);
- Draw(rp, canvas_x + NORMAL_TILE_WIDTH-1, canvas_y);
+ Draw(rp, canvas_x + tileset_tile_width(tileset)-1, canvas_y);
}
}
}
@@ -980,7 +980,7 @@
}
/* Some goto lines overlap onto the tile... */
- if (NORMAL_TILE_WIDTH%2 == 0 || NORMAL_TILE_HEIGHT%2 == 0) {
+ if (tileset_tile_width(tileset)%2 == 0 || tileset_tile_height(tileset)%2
== 0) {
int line_x = x - 1;
int line_y = y;
if (normalize_map_pos(&line_x, &line_y)
@@ -1028,16 +1028,16 @@
horizontal line when we refresh the tile below-between. */
get_canvas_xy(src_x, src_y, &canvas_start_x, &canvas_start_y);
get_canvas_xy(dest_x, dest_y, &canvas_end_x, &canvas_end_y);
- canvas_start_x += NORMAL_TILE_WIDTH/2;
- canvas_start_y += NORMAL_TILE_HEIGHT/2-1;
- canvas_end_x += NORMAL_TILE_WIDTH/2;
- canvas_end_y += NORMAL_TILE_HEIGHT/2-1;
+ canvas_start_x += tileset_tile_width(tileset)/2;
+ canvas_start_y += tileset_tile_height(tileset)/2-1;
+ canvas_end_x += tileset_tile_width(tileset)/2;
+ canvas_end_y += tileset_tile_height(tileset)/2-1;
/* somewhat hackish way of solving the problem where draw from a tile on
one side of the screen out of the screen, and the tile we draw to is
found to be on the other side of the screen. */
- if (abs(canvas_end_x - canvas_start_x) > NORMAL_TILE_WIDTH
- || abs(canvas_end_y - canvas_start_y) > NORMAL_TILE_HEIGHT)
+ if (abs(canvas_end_x - canvas_start_x) > tileset_tile_width(tileset)
+ || abs(canvas_end_y - canvas_start_y) > tileset_tile_height(tileset))
return;
/* draw it! */
@@ -1056,8 +1056,8 @@
int offset_x, int offset_y,
int width, int height)
{
- assert(width <= NORMAL_TILE_WIDTH);
- assert(height <= NORMAL_TILE_HEIGHT);
+ assert(width <= tileset_tile_width(tileset));
+ assert(height <= tileset_tile_height(tileset));
put_sprite_overlay_total(rp, sprites.black_tile, canvas_x + offset_x,
canvas_y + offset_y, offset_x, offset_y, width, height);
}
@@ -1165,39 +1165,39 @@
if (!width || !height)
return;
- assert(offset_x == 0 || offset_x == NORMAL_TILE_WIDTH/2);
- assert(offset_y == 0 || offset_y == NORMAL_TILE_HEIGHT/2);
- assert(width == NORMAL_TILE_WIDTH || width == NORMAL_TILE_WIDTH/2);
- assert(height == NORMAL_TILE_HEIGHT || height == NORMAL_TILE_HEIGHT/2);
+ assert(offset_x == 0 || offset_x == tileset_tile_width(tileset)/2);
+ assert(offset_y == 0 || offset_y == tileset_tile_height(tileset)/2);
+ assert(width == tileset_tile_width(tileset) || width ==
tileset_tile_width(tileset)/2);
+ assert(height == tileset_tile_height(tileset) || height ==
tileset_tile_height(tileset)/2);
/* north */
if (dither[0]
- && (offset_x != 0 || width == NORMAL_TILE_WIDTH)
+ && (offset_x != 0 || width == tileset_tile_width(tileset))
&& (offset_y == 0)) {
- put_sprite_overlay_total_with_different_mask(rp, dither[0],
sprites.dither_tile, canvas_x + NORMAL_TILE_WIDTH / 2, canvas_y,
- NORMAL_TILE_WIDTH/2,0,NORMAL_TILE_WIDTH/2,
NORMAL_TILE_HEIGHT/2);
+ put_sprite_overlay_total_with_different_mask(rp, dither[0],
sprites.dither_tile, canvas_x + tileset_tile_width(tileset) / 2, canvas_y,
+
tileset_tile_width(tileset)/2,0,tileset_tile_width(tileset)/2,
tileset_tile_height(tileset)/2);
}
/* south */
if (dither[1] && offset_x == 0
- && (offset_y == NORMAL_TILE_HEIGHT/2 || height == NORMAL_TILE_HEIGHT)) {
+ && (offset_y == tileset_tile_height(tileset)/2 || height ==
tileset_tile_height(tileset))) {
- put_sprite_overlay_total_with_different_mask(rp, dither[1],
sprites.dither_tile, canvas_x, canvas_y + NORMAL_TILE_HEIGHT/2,
- 0,NORMAL_TILE_HEIGHT/2,NORMAL_TILE_WIDTH/2,
NORMAL_TILE_HEIGHT/2);
+ put_sprite_overlay_total_with_different_mask(rp, dither[1],
sprites.dither_tile, canvas_x, canvas_y + tileset_tile_height(tileset)/2,
+
0,tileset_tile_height(tileset)/2,tileset_tile_width(tileset)/2,
tileset_tile_height(tileset)/2);
}
/* east */
if (dither[2]
- && (offset_x != 0 || width == NORMAL_TILE_WIDTH)
- && (offset_y != 0 || height == NORMAL_TILE_HEIGHT)) {
-
put_sprite_overlay_total_with_different_mask(rp,dither[2],sprites.dither_tile,canvas_x+NORMAL_TILE_WIDTH/2,canvas_y+NORMAL_TILE_HEIGHT/2,
-
NORMAL_TILE_WIDTH/2,NORMAL_TILE_HEIGHT/2,NORMAL_TILE_WIDTH/2,
NORMAL_TILE_HEIGHT/2);
+ && (offset_x != 0 || width == tileset_tile_width(tileset))
+ && (offset_y != 0 || height == tileset_tile_height(tileset))) {
+
put_sprite_overlay_total_with_different_mask(rp,dither[2],sprites.dither_tile,canvas_x+tileset_tile_width(tileset)/2,canvas_y+tileset_tile_height(tileset)/2,
+
tileset_tile_width(tileset)/2,tileset_tile_height(tileset)/2,tileset_tile_width(tileset)/2,
tileset_tile_height(tileset)/2);
}
/* west */
if (dither[3] && offset_x == 0 && offset_y == 0) {
put_sprite_overlay_total_with_different_mask(rp,dither[3],sprites.dither_tile,canvas_x,canvas_y,0,0,
- NORMAL_TILE_WIDTH/2, NORMAL_TILE_HEIGHT/2);
+ tileset_tile_width(tileset)/2,
tileset_tile_height(tileset)/2);
}
if(fog)
@@ -1271,8 +1271,8 @@
int dx, dy;
/* top */
- dx = offset_x-NORMAL_TILE_WIDTH/4;
- put_overlay_tile_draw(rp, canvas_x + NORMAL_TILE_WIDTH/4,
+ dx = offset_x-tileset_tile_width(tileset)/4;
+ put_overlay_tile_draw(rp, canvas_x + tileset_tile_width(tileset)/4,
canvas_y, coasts[0],
MAX(0, dx),
offset_y,
@@ -1280,29 +1280,29 @@
height,
fog);
/* bottom */
- dx = offset_x-NORMAL_TILE_WIDTH/4;
- dy = offset_y-NORMAL_TILE_HEIGHT/2;
- put_overlay_tile_draw(rp, canvas_x + NORMAL_TILE_WIDTH/4,
- canvas_y + NORMAL_TILE_HEIGHT/2, coasts[1],
+ dx = offset_x-tileset_tile_width(tileset)/4;
+ dy = offset_y-tileset_tile_height(tileset)/2;
+ put_overlay_tile_draw(rp, canvas_x + tileset_tile_width(tileset)/4,
+ canvas_y + tileset_tile_height(tileset)/2,
coasts[1],
MAX(0, dx),
MAX(0, dy),
MAX(0, width-MAX(0, -dx)),
MAX(0, height-MAX(0, -dy)),
fog);
/* left */
- dy = offset_y-NORMAL_TILE_HEIGHT/4;
+ dy = offset_y-tileset_tile_height(tileset)/4;
put_overlay_tile_draw(rp, canvas_x,
- canvas_y + NORMAL_TILE_HEIGHT/4, coasts[2],
+ canvas_y + tileset_tile_height(tileset)/4,
coasts[2],
offset_x,
MAX(0, dy),
width,
MAX(0, height-MAX(0, -dy)),
fog);
/* right */
- dx = offset_x-NORMAL_TILE_WIDTH/2;
- dy = offset_y-NORMAL_TILE_HEIGHT/4;
- put_overlay_tile_draw(rp, canvas_x + NORMAL_TILE_WIDTH/2,
- canvas_y + NORMAL_TILE_HEIGHT/4, coasts[3],
+ dx = offset_x-tileset_tile_width(tileset)/2;
+ dy = offset_y-tileset_tile_height(tileset)/4;
+ put_overlay_tile_draw(rp, canvas_x + tileset_tile_width(tileset)/2,
+ canvas_y + tileset_tile_height(tileset)/4, coasts[3],
MAX(0, dx),
MAX(0, dy),
MAX(0, width-MAX(0, -dx)),
@@ -1333,12 +1333,12 @@
drawn by the tiles underneath. */
SetAPen(rp,GetColorPen(COLOR_STD_BLACK));
if (draw & D_M_R) {
- Move(rp,canvas_x+NORMAL_TILE_WIDTH/2-1, canvas_y);
- Draw(rp,canvas_x+NORMAL_TILE_WIDTH-1, canvas_y+NORMAL_TILE_HEIGHT/2-1);
+ Move(rp,canvas_x+tileset_tile_width(tileset)/2-1, canvas_y);
+ Draw(rp,canvas_x+tileset_tile_width(tileset)-1,
canvas_y+tileset_tile_height(tileset)/2-1);
}
if (draw & D_M_L) {
- Move(rp, canvas_x, canvas_y + NORMAL_TILE_HEIGHT/2-1);
- Draw(rp, canvas_x+NORMAL_TILE_WIDTH/2, canvas_y);
+ Move(rp, canvas_x, canvas_y + tileset_tile_height(tileset)/2-1);
+ Draw(rp, canvas_x+tileset_tile_width(tileset)/2, canvas_y);
}
}
@@ -1350,16 +1350,16 @@
if (normalize_map_pos(&x1, &y1)) {
t2 = map_get_terrain(x1, y1);
if (draw & D_M_R && (is_ocean(t1) ^ is_ocean(t2))) {
- Move(rp, canvas_x + NORMAL_TILE_WIDTH/2, canvas_y);
- Draw(rp, canvas_x + NORMAL_TILE_WIDTH, canvas_y+NORMAL_TILE_HEIGHT/2);
+ Move(rp, canvas_x + tileset_tile_width(tileset)/2, canvas_y);
+ Draw(rp, canvas_x + tileset_tile_width(tileset),
canvas_y+tileset_tile_height(tileset)/2);
}
}
x1 = x-1; y1 = y;
if (normalize_map_pos(&x1, &y1)) {
t2 = map_get_terrain(x1, y1);
if (draw & D_M_L && (is_ocean(t1) ^ is_ocean(t2))) {
- Move(rp, canvas_x, canvas_y + NORMAL_TILE_HEIGHT/2);
- Draw(rp, canvas_x+NORMAL_TILE_WIDTH/2, canvas_y);
+ Move(rp, canvas_x, canvas_y + tileset_tile_height(tileset)/2);
+ Draw(rp, canvas_x+tileset_tile_width(tileset)/2, canvas_y);
}
}
}
@@ -1367,13 +1367,13 @@
/*** City and various terrain improvements ***/
if (pcity && draw_cities) {
put_city_draw(pcity, rp,
- canvas_x, canvas_y - NORMAL_TILE_HEIGHT/2,
+ canvas_x, canvas_y - tileset_tile_height(tileset)/2,
offset_x, offset_y_unit,
width, height_unit, fog);
}
if (contains_special(special, S_AIRBASE) && draw_fortress_airbase)
put_overlay_tile_draw(rp,
- canvas_x, canvas_y-NORMAL_TILE_HEIGHT/2,
+ canvas_x, canvas_y-tileset_tile_height(tileset)/2,
sprites.tx.airbase,
offset_x, offset_y_unit,
width, height_unit, fog);
@@ -1394,12 +1394,12 @@
/* Not fogged as it would be unreadable */
if (pcity && draw_cities) {
if (pcity->size>=10)
- put_overlay_tile_draw(rp, canvas_x, canvas_y-NORMAL_TILE_HEIGHT/2,
+ put_overlay_tile_draw(rp, canvas_x,
canvas_y-tileset_tile_height(tileset)/2,
sprites.city.size_tens[pcity->size/10],
offset_x, offset_y_unit,
width, height_unit, 0);
- put_overlay_tile_draw(rp, canvas_x, canvas_y-NORMAL_TILE_HEIGHT/2,
+ put_overlay_tile_draw(rp, canvas_x,
canvas_y-tileset_tile_height(tileset)/2,
sprites.city.size[pcity->size%10],
offset_x, offset_y_unit,
width, height_unit, 0);
@@ -1408,12 +1408,12 @@
/*** Unit ***/
if (punit && (draw_units || (punit == pfocus && draw_focus_unit))) {
put_unit_draw(punit, rp,
- canvas_x, canvas_y - NORMAL_TILE_HEIGHT/2,
+ canvas_x, canvas_y - tileset_tile_height(tileset)/2,
offset_x, offset_y_unit,
width, height_unit);
if (!pcity && unit_list_size(&map_get_tile(x, y)->units) > 1)
put_overlay_tile_draw(rp,
- canvas_x, canvas_y-NORMAL_TILE_HEIGHT/2,
+ canvas_x, canvas_y-tileset_tile_height(tileset)/2,
sprites.unit.stack,
offset_x, offset_y_unit,
width, height_unit, fog);
@@ -1421,7 +1421,7 @@
if (contains_special(special, S_FORTRESS) && draw_fortress_airbase)
put_overlay_tile_draw(rp,
- canvas_x, canvas_y-NORMAL_TILE_HEIGHT/2,
+ canvas_x, canvas_y-tileset_tile_height(tileset)/2,
sprites.tx.fortress,
offset_x, offset_y_unit,
width, height_unit, fog);
@@ -1443,23 +1443,23 @@
}
freelog(LOG_DEBUG, "putting %d,%d draw %x", x, y, draw);
- width = (draw & D_TMB_L) && (draw & D_TMB_R) ? NORMAL_TILE_WIDTH :
NORMAL_TILE_WIDTH/2;
+ width = (draw & D_TMB_L) && (draw & D_TMB_R) ? tileset_tile_width(tileset) :
tileset_tile_width(tileset)/2;
if (!(draw & D_TMB_L))
- offset_x = NORMAL_TILE_WIDTH/2;
+ offset_x = tileset_tile_width(tileset)/2;
else
offset_x = 0;
height = 0;
- if (draw & D_M_LR) height += NORMAL_TILE_HEIGHT/2;
- if (draw & D_B_LR) height += NORMAL_TILE_HEIGHT/2;
+ if (draw & D_M_LR) height += tileset_tile_height(tileset)/2;
+ if (draw & D_B_LR) height += tileset_tile_height(tileset)/2;
if (draw & D_T_LR)
- height_unit = height + NORMAL_TILE_HEIGHT/2;
+ height_unit = height + tileset_tile_height(tileset)/2;
else
height_unit = height;
- offset_y = (draw & D_M_LR) ? 0 : NORMAL_TILE_HEIGHT/2;
+ offset_y = (draw & D_M_LR) ? 0 : tileset_tile_height(tileset)/2;
if (!(draw & D_T_LR))
- offset_y_unit = (draw & D_M_LR) ? NORMAL_TILE_HEIGHT/2 :
NORMAL_TILE_HEIGHT;
+ offset_y_unit = (draw & D_M_LR) ? tileset_tile_height(tileset)/2 :
tileset_tile_height(tileset);
else
offset_y_unit = 0;
@@ -1482,6 +1482,6 @@
{
put_tile_iso(rp, x, y, canvas_x, canvas_y, citymode,
0, 0, 0,
- NORMAL_TILE_WIDTH, NORMAL_TILE_HEIGHT, UNIT_TILE_HEIGHT,
+ tileset_tile_width(tileset), tileset_tile_height(tileset),
tileset_full_tile_height(tileset),
D_FULL);
}
Index: client/gui-mui/helpdlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-mui/helpdlg.c,v
retrieving revision 1.38
diff -u -r1.38 helpdlg.c
--- client/gui-mui/helpdlg.c 14 Mar 2005 20:26:24 -0000 1.38
+++ client/gui-mui/helpdlg.c 25 Mar 2005 20:41:01 -0000
@@ -541,8 +541,8 @@
Child, HGroup,
Child, HSpace(0),
Child, help_unit_sprite = SpriteObject,
- MUIA_FixWidth, UNIT_TILE_WIDTH,
- MUIA_FixHeight, UNIT_TILE_HEIGHT,
+ MUIA_FixWidth, tileset_full_tile_width(tileset),
+ MUIA_FixHeight, tileset_full_tile_height(tileset),
MUIA_Sprite_Transparent, TRUE,
End,
Child, HSpace(0),
@@ -876,8 +876,8 @@
Child, HSpace(0),
Child, TextObject, MUIA_Text_Contents, "", End,
Child, SpriteObject, MUIA_Sprite_Sprite,
tile->sprite[NUM_DIRECTION_NSEW - 1],
- MUIA_FixWidth, NORMAL_TILE_WIDTH,
- MUIA_FixHeight, NORMAL_TILE_HEIGHT,
+ MUIA_FixWidth, tileset_tile_width(tileset),
+ MUIA_FixHeight, tileset_tile_height(tileset),
End,
Child, TextObject, MUIA_Text_Contents, buf, End,
Child, HSpace(0),
@@ -898,8 +898,8 @@
Child, SpriteObject,
MUIA_Sprite_Sprite, tile->sprite[NUM_DIRECTION_NSEW - 1],
MUIA_Sprite_OverlaySprite, tile->special[0].sprite,
- MUIA_FixWidth, NORMAL_TILE_WIDTH,
- MUIA_FixHeight, NORMAL_TILE_HEIGHT,
+ MUIA_FixWidth, tileset_tile_width(tileset),
+ MUIA_FixHeight, tileset_tile_height(tileset),
End,
Child, TextObject, MUIA_Text_Contents, buf, End,
Child, HSpace(0),
@@ -919,8 +919,8 @@
Child, SpriteObject,
MUIA_Sprite_Sprite, tile->sprite[NUM_DIRECTION_NSEW - 1],
MUIA_Sprite_OverlaySprite, tile->special[1].sprite,
- MUIA_FixWidth, NORMAL_TILE_WIDTH,
- MUIA_FixHeight, NORMAL_TILE_HEIGHT,
+ MUIA_FixWidth, tileset_tile_width(tileset),
+ MUIA_FixHeight, tileset_tile_height(tileset),
End,
Child, TextObject, MUIA_Text_Contents, buf, End,
Child, HSpace(0),
Index: client/gui-mui/mapclass.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-mui/mapclass.c,v
retrieving revision 1.105
diff -u -r1.105 mapclass.c
--- client/gui-mui/mapclass.c 11 Mar 2005 17:11:26 -0000 1.105
+++ client/gui-mui/mapclass.c 25 Mar 2005 20:41:02 -0000
@@ -466,8 +466,8 @@
rp = _rp(o);
- canvas_x += NORMAL_TILE_WIDTH / 2;
- canvas_y += NORMAL_TILE_HEIGHT;
+ canvas_x += tileset_tile_width(tileset) / 2;
+ canvas_y += tileset_tile_height(tileset);
GetRPAttrs(rp, RPTAG_Font, &org_font, TAG_DONE);
SetFont(rp, new_font);
@@ -530,8 +530,8 @@
diff_x = old_canvas_x - new_canvas_x;
diff_y = old_canvas_y - new_canvas_y;
- w = UNIT_TILE_WIDTH + abs(diff_x);
- h = UNIT_TILE_HEIGHT + abs(diff_y);
+ w = tileset_full_tile_width(tileset) + abs(diff_x);
+ h = tileset_full_tile_height(tileset) + abs(diff_y);
this_x = MIN(old_canvas_x,new_canvas_x);
this_y = MIN(old_canvas_y,new_canvas_y);
@@ -576,8 +576,8 @@
get_canvas_xy(data->explode_unit->x, data->explode_unit->y, &canvas_x,
&canvas_y);
- w = MAX(0,MIN(NORMAL_TILE_WIDTH, _mwidth(o)-canvas_x));
- h = MAX(0,MIN(NORMAL_TILE_HEIGHT, _mheight(o)-canvas_y));
+ w = MAX(0,MIN(tileset_tile_width(tileset), _mwidth(o)-canvas_x));
+ h = MAX(0,MIN(tileset_tile_height(tileset), _mheight(o)-canvas_y));
anim_timer = renew_timer_start(anim_timer, TIMER_USER, TIMER_ACTIVE);
@@ -587,7 +587,7 @@
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);
+ put_sprite_overlay(data->unit_layer->rp, sprites.explode.unit[i],
tileset_tile_width(tileset)/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(tileset) */
MyBltBitMapRastPort(data->map_bitmap, canvas_x, canvas_y,
@@ -821,12 +821,12 @@
if (data->overview_object)
set(data->overview_object, MUIA_Overview_RadarPicture,
data->radar_gfx_sprite->picture);
- if ((data->unit_bitmap = AllocBitMap(UNIT_TILE_WIDTH * 3, UNIT_TILE_HEIGHT
* 3, GetBitMapAttr(_screen(o)->RastPort.BitMap, BMA_DEPTH), BMF_MINPLANES,
_screen(o)->RastPort.BitMap)))
+ if ((data->unit_bitmap = AllocBitMap(tileset_full_tile_width(tileset) * 3,
tileset_full_tile_height(tileset) * 3,
GetBitMapAttr(_screen(o)->RastPort.BitMap, BMA_DEPTH), BMF_MINPLANES,
_screen(o)->RastPort.BitMap)))
{
if ((data->unit_layerinfo = NewLayerInfo()))
{
InstallLayerInfoHook(data->unit_layerinfo, LAYERS_NOBACKFILL);
- if ((data->unit_layer = CreateBehindHookLayer(data->unit_layerinfo,
data->unit_bitmap, 0, 0, UNIT_TILE_WIDTH * 3 - 1, UNIT_TILE_HEIGHT * 3 - 1,
LAYERSIMPLE, LAYERS_NOBACKFILL, NULL)))
+ if ((data->unit_layer = CreateBehindHookLayer(data->unit_layerinfo,
data->unit_bitmap, 0, 0, tileset_full_tile_width(tileset) * 3 - 1,
tileset_full_tile_height(tileset) * 3 - 1, LAYERSIMPLE, LAYERS_NOBACKFILL,
NULL)))
{
if (render_sprites(dh))
{
@@ -1050,8 +1050,8 @@
draw_shadowed_string(map_canvas->window, main_font,
toplevel->style->black_gc,
toplevel->style->white_gc,
- canvas_x + NORMAL_TILE_WIDTH / 2 - w / 2,
- canvas_y + NORMAL_TILE_HEIGHT,
+ canvas_x + tileset_tile_width(tileset) / 2 - w / 2,
+ canvas_y + tileset_tile_height(tileset),
boom); */
} else
@@ -1238,7 +1238,7 @@
if (abs(dx) < width && abs(dy) < height && data->map_shown)
{
ScrollRaster(data->map_layer->rp,
- dx * NORMAL_TILE_WIDTH, dy * NORMAL_TILE_HEIGHT,
+ dx * tileset_tile_width(tileset), dy *
tileset_tile_height(tileset),
0, 0, _mwidth(o) - 1, _mheight(o) - 1);
if (abs(dx) < width && dx)
@@ -1384,16 +1384,16 @@
get_canvas_xy(x, y, &canvas_start_x, &canvas_start_y); /* top left
corner */
/* top left corner in isometric view */
- canvas_start_x -= height * NORMAL_TILE_WIDTH/2;
+ canvas_start_x -= height * tileset_tile_width(tileset)/2;
/* because of where get_canvas_xy() sets canvas_x */
- canvas_start_x += NORMAL_TILE_WIDTH/2;
+ canvas_start_x += tileset_tile_width(tileset)/2;
/* And because units fill a little extra */
- canvas_start_y -= NORMAL_TILE_HEIGHT/2;
+ canvas_start_y -= tileset_tile_height(tileset)/2;
- w = (height + width) * NORMAL_TILE_WIDTH/2;
- h = (height + width) * NORMAL_TILE_HEIGHT/2 + NORMAL_TILE_HEIGHT/2;
+ w = (height + width) * tileset_tile_width(tileset)/2;
+ h = (height + width) * tileset_tile_height(tileset)/2 +
tileset_tile_height(tileset)/2;
if (canvas_start_x <0)
{
@@ -1854,18 +1854,18 @@
/* Clear old sprite. */
gdk_draw_pixmap(map_canvas->window, civ_gc, map_canvas_store, old_canvas_x,
- old_canvas_y, old_canvas_x, old_canvas_y, UNIT_TILE_WIDTH,
- UNIT_TILE_HEIGHT);
+ old_canvas_y, old_canvas_x, old_canvas_y,
tileset_full_tile_width(tileset),
+ tileset_full_tile_height(tileset));
/* Draw the new sprite. */
gdk_draw_pixmap(single_tile_pixmap, civ_gc, map_canvas_store, new_canvas_x,
- new_canvas_y, 0, 0, UNIT_TILE_WIDTH, UNIT_TILE_HEIGHT);
+ new_canvas_y, 0, 0, tileset_full_tile_width(tileset),
tileset_full_tile_height(tileset));
put_unit_pixmap(punit, single_tile_pixmap, 0, 0);
/* Write to screen. */
gdk_draw_pixmap(map_canvas->window, civ_gc, single_tile_pixmap, 0, 0,
- new_canvas_x, new_canvas_y, UNIT_TILE_WIDTH,
- UNIT_TILE_HEIGHT);
+ new_canvas_x, new_canvas_y, tileset_full_tile_width(tileset),
+ tileset_full_tile_height(tileset));
/* Flush. */
gdk_flush();
@@ -2179,24 +2179,24 @@
/* top --> right */
SetAPen(rp, data->red_color);
- Move(rp, canvas_x + NORMAL_TILE_WIDTH / 2 - 1, canvas_y);
- Draw(rp, canvas_x + NORMAL_TILE_WIDTH - 1,
- canvas_y + NORMAL_TILE_HEIGHT / 2 - 1);
+ Move(rp, canvas_x + tileset_tile_width(tileset) / 2 - 1, canvas_y);
+ Draw(rp, canvas_x + tileset_tile_width(tileset) - 1,
+ canvas_y + tileset_tile_height(tileset) / 2 - 1);
/* top --> left */
- Move(rp, canvas_x + NORMAL_TILE_WIDTH / 2, canvas_y);
- Draw(rp, canvas_x, canvas_y + NORMAL_TILE_HEIGHT / 2 - 1);
+ Move(rp, canvas_x + tileset_tile_width(tileset) / 2, canvas_y);
+ Draw(rp, canvas_x, canvas_y + tileset_tile_height(tileset) / 2 - 1);
/* bottom --> right */
- Move(rp, canvas_x + NORMAL_TILE_WIDTH / 2 - 1,
- canvas_y + NORMAL_TILE_HEIGHT - 1);
- Draw(rp, canvas_x + NORMAL_TILE_WIDTH - 1,
- canvas_y + NORMAL_TILE_HEIGHT / 2);
+ Move(rp, canvas_x + tileset_tile_width(tileset) / 2 - 1,
+ canvas_y + tileset_tile_height(tileset) - 1);
+ Draw(rp, canvas_x + tileset_tile_width(tileset) - 1,
+ canvas_y + tileset_tile_height(tileset) / 2);
/* bottom --> left */
- Move(rp, canvas_x + NORMAL_TILE_WIDTH / 2,
- canvas_y + NORMAL_TILE_HEIGHT - 1);
- Draw(rp, canvas_x, canvas_y + NORMAL_TILE_HEIGHT / 2);
+ Move(rp, canvas_x + tileset_tile_width(tileset) / 2,
+ canvas_y + tileset_tile_height(tileset) - 1);
+ Draw(rp, canvas_x, canvas_y + tileset_tile_height(tileset) / 2);
}
} city_map_checked_iterate_end;
} else
@@ -2783,8 +2783,8 @@
static ULONG Unit_AskMinMax(struct IClass * cl, Object * o, struct
MUIP_AskMinMax * msg)
{
struct Unit_Data *data = (struct Unit_Data *) INST_DATA(cl, o);
- LONG w = UNIT_TILE_WIDTH;
- LONG h = UNIT_TILE_HEIGHT;
+ LONG w = tileset_full_tile_width(tileset);
+ LONG h = tileset_full_tile_height(tileset);
DoSuperMethodA(cl, o, (Msg) msg);
if (data->upkeep)
Index: client/gui-sdl/citydlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-sdl/citydlg.c,v
retrieving revision 1.51
diff -u -r1.51 citydlg.c
--- client/gui-sdl/citydlg.c 11 Mar 2005 17:11:26 -0000 1.51
+++ client/gui-sdl/citydlg.c 25 Mar 2005 20:41:02 -0000
@@ -636,7 +636,7 @@
int i, step;
SDL_Rect dest;
SDL_Surface *pSurf =
- create_surf(UNIT_TILE_WIDTH, UNIT_TILE_HEIGHT, SDL_SWSURFACE);
+ create_surf(tileset_full_tile_width(tileset),
tileset_full_tile_height(tileset), SDL_SWSURFACE);
put_unit_pixmap_draw(pUnit, pSurf, 0, 3);
@@ -1280,12 +1280,12 @@
} else {
if(is_city_report_open()) {
assert(pSellected_Widget != NULL);
- if (pSellected_Widget->size.x + NORMAL_TILE_WIDTH +
+ if (pSellected_Widget->size.x + tileset_tile_width(tileset) +
ww + DOUBLE_FRAME_WH > pWindow->dst->w)
{
pWindow->size.x = pSellected_Widget->size.x - ww - DOUBLE_FRAME_WH;
} else {
- pWindow->size.x = pSellected_Widget->size.x + NORMAL_TILE_WIDTH;
+ pWindow->size.x = pSellected_Widget->size.x +
tileset_tile_width(tileset);
}
pWindow->size.y = pSellected_Widget->size.y +
Index: client/gui-sdl/dialogs.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-sdl/dialogs.c,v
retrieving revision 1.55
diff -u -r1.55 dialogs.c
--- client/gui-sdl/dialogs.c 10 Feb 2005 18:35:16 -0000 1.55
+++ client/gui-sdl/dialogs.c 25 Mar 2005 20:41:03 -0000
@@ -116,7 +116,7 @@
int canvas_x, canvas_y;
if (tile_to_canvas_pos(&canvas_x, &canvas_y, x, y)) {
- if (canvas_x + NORMAL_TILE_WIDTH + window_width >= pWindow->dst->w)
+ if (canvas_x + tileset_tile_width(tileset) + window_width >=
pWindow->dst->w)
{
if (canvas_x - window_width < 0) {
pWindow->size.x = (pWindow->dst->w - window_width) / 2;
@@ -124,10 +124,10 @@
pWindow->size.x = canvas_x - window_width;
}
} else {
- pWindow->size.x = canvas_x + NORMAL_TILE_WIDTH;
+ pWindow->size.x = canvas_x + tileset_tile_width(tileset);
}
- canvas_y += (NORMAL_TILE_HEIGHT - window_height) / 2;
+ canvas_y += (tileset_tile_height(tileset) - window_height) / 2;
if (canvas_y + window_height >= pWindow->dst->h)
{
pWindow->size.y = pWindow->dst->h - window_height - 1;
@@ -991,7 +991,7 @@
pStr->style |= SF_CENTER;
pBuf = create_iconlabel(pSurf, pWindow->dst, pStr, WF_FREE_THEME);
- pBuf->size.h += NORMAL_TILE_HEIGHT / 2;
+ pBuf->size.h += tileset_tile_height(tileset) / 2;
add_to_gui_list(ID_LABEL, pBuf);
Index: client/gui-sdl/graphics.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-sdl/graphics.c,v
retrieving revision 1.36
diff -u -r1.36 graphics.c
--- client/gui-sdl/graphics.c 11 Mar 2005 17:11:26 -0000 1.36
+++ client/gui-sdl/graphics.c 25 Mar 2005 20:41:03 -0000
@@ -913,9 +913,9 @@
mapview.width = iWidth;
mapview.height = iHeight;
- if (NORMAL_TILE_WIDTH > 0) {
- mapview.tile_width = (iWidth - 1) / NORMAL_TILE_WIDTH + 1;
- mapview.tile_height = (iHeight - 1) / NORMAL_TILE_HEIGHT + 1;
+ if (tileset_tile_width(tileset) > 0) {
+ mapview.tile_width = (iWidth - 1) / tileset_tile_width(tileset) + 1;
+ mapview.tile_height = (iHeight - 1) / tileset_tile_height(tileset) + 1;
}
FREESURFACE(Main.map);
Index: client/gui-sdl/gui_dither.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-sdl/gui_dither.c,v
retrieving revision 1.5
diff -u -r1.5 gui_dither.c
--- client/gui-sdl/gui_dither.c 20 Nov 2004 21:27:17 -0000 1.5
+++ client/gui-sdl/gui_dither.c 25 Mar 2005 20:41:03 -0000
@@ -37,7 +37,7 @@
static void dither_north8(SDL_Surface * pDither, SDL_Surface * pMask,
SDL_Surface * pDest)
{
- register Uint32 step = NORMAL_TILE_WIDTH / 2, h = 0, w = 0;
+ register Uint32 step = tileset_tile_width(tileset) / 2, h = 0, w = 0;
Uint8 *pDither_Pixel = (Uint8 *) pDither->pixels + step;
Uint8 *pMask_Pixel = (Uint8 *) pMask->pixels + step;
Uint8 *pDest_Pixel = (Uint8 *) pDest->pixels + step;
@@ -59,7 +59,7 @@
w = 0;
- if (++h >= NORMAL_TILE_HEIGHT / 2) {
+ if (++h >= tileset_tile_height(tileset) / 2) {
break;
}
}
@@ -72,7 +72,7 @@
static void dither_north16(SDL_Surface * pDither, SDL_Surface * pMask,
SDL_Surface * pDest)
{
- register Uint32 step = NORMAL_TILE_WIDTH / 2, h = 0, w = 0;
+ register Uint32 step = tileset_tile_width(tileset) / 2, h = 0, w = 0;
Uint16 *pDither_Pixel = (Uint16 *) pDither->pixels + step;
Uint16 *pMask_Pixel = (Uint16 *) pMask->pixels + step;
Uint16 *pDest_Pixel = (Uint16 *) pDest->pixels + step;
@@ -95,7 +95,7 @@
w = 0;
- if (++h >= NORMAL_TILE_HEIGHT / 2) {
+ if (++h >= tileset_tile_height(tileset) / 2) {
break;
}
}
@@ -108,7 +108,7 @@
static void dither_north24(SDL_Surface * pDither, SDL_Surface * pMask,
SDL_Surface * pDest)
{
- register Uint32 step = NORMAL_TILE_WIDTH / 2;
+ register Uint32 step = tileset_tile_width(tileset) / 2;
register Uint32 h = 0, w = 0;
Uint8 *pDither_Pixel, *pMask_Pixel, *pDest_Pixel;
@@ -135,7 +135,7 @@
w = 0;
- if (++h >= NORMAL_TILE_HEIGHT / 2) {
+ if (++h >= tileset_tile_height(tileset) / 2) {
break;
}
}
@@ -145,7 +145,7 @@
static void dither_north32(SDL_Surface * pDither, SDL_Surface * pMask,
SDL_Surface * pDest)
{
- register Uint32 step = NORMAL_TILE_WIDTH / 2, h = 0, w = 0;
+ register Uint32 step = tileset_tile_width(tileset) / 2, h = 0, w = 0;
Uint32 *pDither_Pixel = (Uint32 *) pDither->pixels + step;
Uint32 *pMask_Pixel = (Uint32 *) pMask->pixels + step;
Uint32 *pDest_Pixel = (Uint32 *) pDest->pixels + step;
@@ -168,7 +168,7 @@
w = 0;
- if (++h >= NORMAL_TILE_HEIGHT / 2) {
+ if (++h >= tileset_tile_height(tileset) / 2) {
break;
}
}
@@ -210,8 +210,8 @@
static void dither_south8(SDL_Surface * pDither, SDL_Surface * pMask,
SDL_Surface * pDest)
{
- register Uint16 step = NORMAL_TILE_WIDTH / 2;
- register Uint16 h = NORMAL_TILE_WIDTH * (NORMAL_TILE_HEIGHT / 2), w = 0;
+ register Uint16 step = tileset_tile_width(tileset) / 2;
+ register Uint16 h = tileset_tile_width(tileset) *
(tileset_tile_height(tileset) / 2), w = 0;
Uint8 *pDither_Pixel = (Uint8 *) pDither->pixels + h;
Uint8 *pMask_Pixel = (Uint8 *) pMask->pixels + h;
@@ -237,7 +237,7 @@
w = 0;
- if (++h >= NORMAL_TILE_HEIGHT / 2) {
+ if (++h >= tileset_tile_height(tileset) / 2) {
break;
}
}
@@ -250,8 +250,8 @@
static void dither_south16(SDL_Surface * pDither, SDL_Surface * pMask,
SDL_Surface * pDest)
{
- register Uint32 step = NORMAL_TILE_WIDTH / 2;
- register Uint32 h = NORMAL_TILE_WIDTH * (NORMAL_TILE_HEIGHT / 2), w = 0;
+ register Uint32 step = tileset_tile_width(tileset) / 2;
+ register Uint32 h = tileset_tile_width(tileset) *
(tileset_tile_height(tileset) / 2), w = 0;
Uint16 *pDither_Pixel = (Uint16 *) pDither->pixels + h;
Uint16 *pMask_Pixel = (Uint16 *) pMask->pixels + h;
@@ -277,7 +277,7 @@
w = 0;
- if (++h >= NORMAL_TILE_HEIGHT / 2) {
+ if (++h >= tileset_tile_height(tileset) / 2) {
break;
}
}
@@ -290,8 +290,8 @@
static void dither_south24(SDL_Surface * pDither, SDL_Surface * pMask,
SDL_Surface * pDest)
{
- register Uint32 step = (NORMAL_TILE_WIDTH / 2);
- register Uint32 h = NORMAL_TILE_WIDTH * (NORMAL_TILE_HEIGHT / 2), w = 0;
+ register Uint32 step = (tileset_tile_width(tileset) / 2);
+ register Uint32 h = tileset_tile_width(tileset) *
(tileset_tile_height(tileset) / 2), w = 0;
Uint8 *pDither_Pixel, *pMask_Pixel, *pDest_Pixel;
step *= 3;
@@ -321,7 +321,7 @@
w = 0;
- if (++h >= NORMAL_TILE_HEIGHT / 2) {
+ if (++h >= tileset_tile_height(tileset) / 2) {
break;
}
}
@@ -334,8 +334,8 @@
static void dither_south32(SDL_Surface * pDither, SDL_Surface * pMask,
SDL_Surface * pDest)
{
- register Uint32 step = NORMAL_TILE_WIDTH / 2;
- register Uint32 h = NORMAL_TILE_WIDTH * (NORMAL_TILE_HEIGHT / 2), w = 0;
+ register Uint32 step = tileset_tile_width(tileset) / 2;
+ register Uint32 h = tileset_tile_width(tileset) *
(tileset_tile_height(tileset) / 2), w = 0;
Uint32 *pDither_Pixel = (Uint32 *) pDither->pixels + h;
Uint32 *pMask_Pixel = (Uint32 *) pMask->pixels + h;
@@ -361,7 +361,7 @@
w = 0;
- if (++h >= NORMAL_TILE_HEIGHT / 2) {
+ if (++h >= tileset_tile_height(tileset) / 2) {
break;
}
}
@@ -404,8 +404,8 @@
static void dither_east8(SDL_Surface * pDither, SDL_Surface * pMask,
SDL_Surface * pDest)
{
- register Uint16 step = NORMAL_TILE_WIDTH / 2;
- register Uint16 h = NORMAL_TILE_WIDTH * (NORMAL_TILE_HEIGHT / 2), w = 0;
+ register Uint16 step = tileset_tile_width(tileset) / 2;
+ register Uint16 h = tileset_tile_width(tileset) *
(tileset_tile_height(tileset) / 2), w = 0;
Uint8 *pDither_Pixel = (Uint8 *) pDither->pixels + h + step;
Uint8 *pMask_Pixel = (Uint8 *) pMask->pixels + h + step;
@@ -431,7 +431,7 @@
w = 0;
- if (++h > NORMAL_TILE_HEIGHT / 2) {
+ if (++h > tileset_tile_height(tileset) / 2) {
break;
}
}
@@ -444,8 +444,8 @@
static void dither_east16(SDL_Surface * pDither, SDL_Surface * pMask,
SDL_Surface * pDest)
{
- register Uint16 step = NORMAL_TILE_WIDTH / 2;
- register Uint16 h = NORMAL_TILE_WIDTH * (NORMAL_TILE_HEIGHT / 2), w = 0;
+ register Uint16 step = tileset_tile_width(tileset) / 2;
+ register Uint16 h = tileset_tile_width(tileset) *
(tileset_tile_height(tileset) / 2), w = 0;
Uint16 *pDither_Pixel = (Uint16 *) pDither->pixels + h + step;
Uint16 *pMask_Pixel = (Uint16 *) pMask->pixels + h + step;
@@ -471,7 +471,7 @@
w = 0;
- if (++h >= NORMAL_TILE_HEIGHT / 2) {
+ if (++h >= tileset_tile_height(tileset) / 2) {
break;
}
}
@@ -484,8 +484,8 @@
static void dither_east24(SDL_Surface * pDither, SDL_Surface * pMask,
SDL_Surface * pDest)
{
- register Uint32 step = NORMAL_TILE_WIDTH / 2;
- register Uint32 h = NORMAL_TILE_WIDTH * (NORMAL_TILE_HEIGHT / 2), w = 0;
+ register Uint32 step = tileset_tile_width(tileset) / 2;
+ register Uint32 h = tileset_tile_width(tileset) *
(tileset_tile_height(tileset) / 2), w = 0;
Uint8 *pDither_Pixel, *pMask_Pixel, *pDest_Pixel;
step *= 3;
@@ -515,7 +515,7 @@
w = 0;
- if (++h >= NORMAL_TILE_HEIGHT / 2) {
+ if (++h >= tileset_tile_height(tileset) / 2) {
break;
}
}
@@ -528,8 +528,8 @@
static void dither_east32(SDL_Surface * pDither, SDL_Surface * pMask,
SDL_Surface * pDest)
{
- register Uint32 step = NORMAL_TILE_WIDTH / 2;
- register Uint32 h = NORMAL_TILE_WIDTH * (NORMAL_TILE_HEIGHT / 2), w = 0;
+ register Uint32 step = tileset_tile_width(tileset) / 2;
+ register Uint32 h = tileset_tile_width(tileset) *
(tileset_tile_height(tileset) / 2), w = 0;
Uint32 *pDither_Pixel = (Uint32 *) pDither->pixels + h + step;
Uint32 *pMask_Pixel = (Uint32 *) pMask->pixels + h + step;
@@ -555,7 +555,7 @@
w = 0;
- if (++h >= NORMAL_TILE_HEIGHT / 2) {
+ if (++h >= tileset_tile_height(tileset) / 2) {
break;
}
}
@@ -597,7 +597,7 @@
static void dither_west8(SDL_Surface * pDither, SDL_Surface * pMask,
SDL_Surface * pDest)
{
- register Uint32 step = NORMAL_TILE_WIDTH / 2;
+ register Uint32 step = tileset_tile_width(tileset) / 2;
register Uint32 h = 0, w = 0;
Uint8 *pDither_Pixel = (Uint8 *) pDither->pixels;
@@ -622,7 +622,7 @@
w = 0;
- if (++h >= NORMAL_TILE_HEIGHT / 2) {
+ if (++h >= tileset_tile_height(tileset) / 2) {
break;
}
}
@@ -635,7 +635,7 @@
static void dither_west16(SDL_Surface * pDither, SDL_Surface * pMask,
SDL_Surface * pDest)
{
- register Uint32 step = NORMAL_TILE_WIDTH / 2;
+ register Uint32 step = tileset_tile_width(tileset) / 2;
register Uint32 h = 0, w = 0;
Uint16 *pDither_Pixel = (Uint16 *) pDither->pixels;
@@ -660,7 +660,7 @@
w = 0;
- if (++h > NORMAL_TILE_HEIGHT / 2) {
+ if (++h > tileset_tile_height(tileset) / 2) {
break;
}
}
@@ -673,7 +673,7 @@
static void dither_west24(SDL_Surface * pDither, SDL_Surface * pMask,
SDL_Surface * pDest)
{
- register Uint32 step = NORMAL_TILE_WIDTH / 2;
+ register Uint32 step = tileset_tile_width(tileset) / 2;
register Uint32 h = 0, w = 0;
Uint8 *pDither_Pixel = (Uint8 *) pDither->pixels;
@@ -700,7 +700,7 @@
w = 0;
- if (++h > NORMAL_TILE_HEIGHT / 2) {
+ if (++h > tileset_tile_height(tileset) / 2) {
break;
}
}
@@ -713,7 +713,7 @@
static void dither_west32(SDL_Surface * pDither, SDL_Surface * pMask,
SDL_Surface * pDest)
{
- register Uint32 step = NORMAL_TILE_WIDTH / 2;
+ register Uint32 step = tileset_tile_width(tileset) / 2;
register Uint32 h = 0, w = 0;
Uint32 *pDither_Pixel = (Uint32 *) pDither->pixels;
@@ -738,7 +738,7 @@
w = 0;
- if (++h > NORMAL_TILE_HEIGHT / 2) {
+ if (++h > tileset_tile_height(tileset) / 2) {
break;
}
}
Index: client/gui-sdl/gui_main.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-sdl/gui_main.c,v
retrieving revision 1.54
diff -u -r1.54 gui_main.c
--- client/gui-sdl/gui_main.c 11 Mar 2005 17:11:26 -0000 1.54
+++ client/gui-sdl/gui_main.c 25 Mar 2005 20:41:03 -0000
@@ -886,9 +886,9 @@
draw_intro_gfx();
mapview.tile_width = (mapview.width - 1)
- / NORMAL_TILE_WIDTH + 1;
+ / tileset_tile_width(tileset) + 1;
mapview.tile_height = (mapview.height - 1)
- / NORMAL_TILE_HEIGHT + 1;
+ / tileset_tile_height(tileset) + 1;
flush_all();
Index: client/gui-sdl/mapview.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-sdl/mapview.c,v
retrieving revision 1.81
diff -u -r1.81 mapview.c
--- client/gui-sdl/mapview.c 11 Mar 2005 17:11:27 -0000 1.81
+++ client/gui-sdl/mapview.c 25 Mar 2005 20:41:04 -0000
@@ -78,7 +78,7 @@
extern bool do_cursor_animation;
static Uint32 Amask;
-static int HALF_NORMAL_TILE_HEIGHT, HALF_NORMAL_TILE_WIDTH;
+static int HALF_tileset_tile_height(tileset), HALF_tileset_tile_width(tileset);
static SDL_Surface *pTmpSurface;
@@ -827,8 +827,8 @@
aunit->hp, pUType->hp,
pHome_City ? pHome_City->name : _("None"));
- pBuf_Surf = create_surf(UNIT_TILE_WIDTH,
- UNIT_TILE_HEIGHT, SDL_SWSURFACE);
+ pBuf_Surf = create_surf(tileset_full_tile_width(tileset),
+ tileset_full_tile_height(tileset),
SDL_SWSURFACE);
put_unit_pixmap_draw(aunit, pBuf_Surf, 0, 0);
@@ -1162,7 +1162,7 @@
pText->bgcol = color_bg;
}
- canvas_y += NORMAL_TILE_HEIGHT;
+ canvas_y += tileset_tile_height(tileset);
if (draw_city_names) {
if (draw_city_growth && pCity->owner == game.player_idx) {
@@ -1284,7 +1284,7 @@
if (clear_area.w)
{
- clear_area.x = canvas_x + (NORMAL_TILE_WIDTH - clear_area.w) / 2;
+ clear_area.x = canvas_x + (tileset_tile_width(tileset) - clear_area.w) /
2;
}
if (pCity_Size)
@@ -1373,7 +1373,7 @@
if (pCity_Name)
{
SDL_SetAlpha(pCity_Name, 0x0, 0x0);
- dst.x = canvas_x + (NORMAL_TILE_WIDTH - pCity_Name->w) / 2;
+ dst.x = canvas_x + (tileset_tile_width(tileset) - pCity_Name->w) / 2;
dst.y = canvas_y;
SDL_BlitSurface(pCity_Name, NULL, pDest, &dst);
canvas_y += pCity_Name->h;
@@ -1382,7 +1382,7 @@
if (pCity_Prod)
{
SDL_SetAlpha(pCity_Prod, 0x0, 0x0);
- dst.x = canvas_x + (NORMAL_TILE_WIDTH - pCity_Prod->w) / 2;
+ dst.x = canvas_x + (tileset_tile_width(tileset) - pCity_Prod->w) / 2;
dst.y = canvas_y;
SDL_BlitSurface(pCity_Prod, NULL, pDest, &dst);
}
@@ -1708,7 +1708,7 @@
if (fog && !full_ocean) {
des.x = 0;
- des.y = HALF_NORMAL_TILE_HEIGHT;
+ des.y = HALF_tileset_tile_height(tileset);
pBufSurface = pTmpSurface;
} else {
des.x = map_x;
@@ -1724,11 +1724,11 @@
if (draw_terrain) {
for (i = 0; i < count; i++) {
if (pTile_sprs[i].sprite) {
- if (GET_SURF(pTile_sprs[i].sprite)->w - NORMAL_TILE_WIDTH > 0
- || GET_SURF(pTile_sprs[i].sprite)->h - NORMAL_TILE_HEIGHT > 0) {
- des.x -= ((GET_SURF(pTile_sprs[i].sprite)->w - NORMAL_TILE_WIDTH) /
2); /* center */
+ if (GET_SURF(pTile_sprs[i].sprite)->w - tileset_tile_width(tileset) > 0
+ || GET_SURF(pTile_sprs[i].sprite)->h - tileset_tile_height(tileset)
> 0) {
+ des.x -= ((GET_SURF(pTile_sprs[i].sprite)->w -
tileset_tile_width(tileset)) / 2); /* center */
/* this allow drawing of civ3 bigger tiles */
- des.y -= (GET_SURF(pTile_sprs[i].sprite)->h - NORMAL_TILE_HEIGHT);
+ des.y -= (GET_SURF(pTile_sprs[i].sprite)->h -
tileset_tile_height(tileset));
SDL_BlitSurface(GET_SURF(pTile_sprs[i].sprite), NULL, pBufSurface,
&des);
} else {
SDL_BlitSurface(GET_SURF(pTile_sprs[i].sprite), NULL, pBufSurface,
&des);
@@ -1806,7 +1806,7 @@
the buttom lines will be drawn by the tiles underneath. */
SDL_BlitSurface(pMapGrid[color1][0], NULL, pBufSurface, &des);
des = dst;
- des.x += HALF_NORMAL_TILE_WIDTH;
+ des.x += HALF_tileset_tile_width(tileset);
SDL_BlitSurface(pMapGrid[color2][1], NULL, pBufSurface, &des);
des = dst;
}
@@ -1860,7 +1860,7 @@
if (pCity && draw_cities) {
put_city_pixmap_draw(pCity, pBufSurface,
- des.x, des.y - HALF_NORMAL_TILE_HEIGHT);
+ des.x, des.y - HALF_tileset_tile_height(tileset));
}
if (sdl_contains_special(special, S_AIRBASE) && draw_fortress_airbase) {
@@ -1898,10 +1898,10 @@
/*** Unit ***/
if (pUnit && (draw_units || (pUnit == pFocus && draw_focus_unit))) {
put_unit_pixmap_draw(pUnit, pBufSurface, des.x,
- des.y - HALF_NORMAL_TILE_HEIGHT);
+ des.y - HALF_tileset_tile_height(tileset));
if (!pCity && unit_list_size(&(pTile->units)) > 1) {
- des.y -= HALF_NORMAL_TILE_HEIGHT;
+ des.y -= HALF_tileset_tile_height(tileset);
SDL_BlitSurface(GET_SURF(sprites.unit.stack), NULL, pBufSurface, &des);
des = dst;
}
@@ -1919,7 +1919,7 @@
get_game_colorRGB(COLOR_STD_FOG_OF_WAR));
des.x = map_x;
- des.y = map_y - HALF_NORMAL_TILE_HEIGHT;
+ des.y = map_y - HALF_tileset_tile_height(tileset);
SDL_BlitSurface(pBufSurface, NULL, pDest, &des);
/* clear pBufSurface */
@@ -1961,7 +1961,7 @@
if (draw_units && (pUnit = get_unit_in_focus())) {
if(tile_to_canvas_pos(&canvas_x, &canvas_y, pUnit->x, pUnit->y)) {
area.x = canvas_x;
- area.y = canvas_y - HALF_NORMAL_TILE_HEIGHT;
+ area.y = canvas_y - HALF_tileset_tile_height(tileset);
backup = area;
if (!reset_anim
&& pUnit == pPrevUnit && pUnit->type == pPrevUnit->type
@@ -1970,13 +1970,13 @@
SDL_BlitSurface(pBlinkSurfaceA, NULL, Main.map, &area);
area = backup;
/* blit frame of animation */
- area.y += HALF_NORMAL_TILE_HEIGHT;
+ area.y += HALF_tileset_tile_height(tileset);
SDL_BlitSurface(pAnim->Focus[frame++], NULL, Main.map, &area);
area = backup;
/* blit unit graphic */
SDL_BlitSurface(pBlinkSurfaceB, NULL, Main.map, &area);
- flush_mapcanvas(area.x, area.y, UNIT_TILE_WIDTH, UNIT_TILE_HEIGHT);
+ flush_mapcanvas(area.x, area.y, tileset_full_tile_width(tileset),
tileset_full_tile_height(tileset));
} else {
@@ -1993,8 +1993,8 @@
}
/* refresh clear area */
- area.w = UNIT_TILE_WIDTH;
- area.h = UNIT_TILE_HEIGHT;
+ area.w = tileset_full_tile_width(tileset);
+ area.h = tileset_full_tile_height(tileset);
SDL_BlitSurface(Main.map, &area, pBlinkSurfaceA, NULL);
area = backup;
@@ -2008,11 +2008,11 @@
if(normalize_map_pos(&next_x, &next_y)) {
if(draw_cities && (pCity = map_get_city(next_x, next_y))) {
put_city_pixmap_draw(pCity, pBlinkSurfaceB,
- -HALF_NORMAL_TILE_WIDTH, HALF_NORMAL_TILE_HEIGHT);
+ -HALF_tileset_tile_width(tileset),
HALF_tileset_tile_height(tileset));
} else {
put_unit_pixmap_draw(get_drawable_unit(next_x, next_y, 0),
- pBlinkSurfaceB, -HALF_NORMAL_TILE_WIDTH,
- HALF_NORMAL_TILE_HEIGHT);
+ pBlinkSurfaceB,
-HALF_tileset_tile_width(tileset),
+
HALF_tileset_tile_height(tileset));
}
}
@@ -2022,15 +2022,15 @@
if(normalize_map_pos(&next_x, &next_y)) {
if((pCity = map_get_city(next_x, next_y)) && draw_cities) {
put_city_pixmap_draw(pCity, pBlinkSurfaceB,
- HALF_NORMAL_TILE_WIDTH, HALF_NORMAL_TILE_HEIGHT);
+ HALF_tileset_tile_width(tileset),
HALF_tileset_tile_height(tileset));
} else {
put_unit_pixmap_draw(get_drawable_unit(next_x, next_y, 0),
- pBlinkSurfaceB, HALF_NORMAL_TILE_WIDTH,
- HALF_NORMAL_TILE_HEIGHT);
+ pBlinkSurfaceB,
HALF_tileset_tile_width(tileset),
+
HALF_tileset_tile_height(tileset));
if(!pCity &&
unit_list_size(&map_get_tile(next_x, next_y)->units) > 1) {
blit_entire_src(GET_SURF(sprites.unit.stack), pBlinkSurfaceB,
- HALF_NORMAL_TILE_WIDTH, HALF_NORMAL_TILE_HEIGHT);
+ HALF_tileset_tile_width(tileset),
HALF_tileset_tile_height(tileset));
}
}
}
@@ -2040,15 +2040,15 @@
next_y = pUnit->y + 1;
if(normalize_map_pos(&next_x, &next_y)) {
if(draw_cities && (pCity = map_get_city(next_x, next_y))) {
- put_city_pixmap_draw(pCity, pBlinkSurfaceB, 0, NORMAL_TILE_HEIGHT);
+ put_city_pixmap_draw(pCity, pBlinkSurfaceB, 0,
tileset_tile_height(tileset));
} else {
put_unit_pixmap_draw(get_drawable_unit(next_x, next_y, 0),
- pBlinkSurfaceB, 0, NORMAL_TILE_HEIGHT);
+ pBlinkSurfaceB, 0,
tileset_tile_height(tileset));
}
}
/* draw focus animation frame */
- area.y += HALF_NORMAL_TILE_HEIGHT;
+ area.y += HALF_tileset_tile_height(tileset);
SDL_BlitSurface(pAnim->Focus[frame++], NULL, Main.map, &area);
area = backup;
@@ -2156,12 +2156,12 @@
int draw_map_grid_backup = draw_map_grid;
int sx, sy, row0, real_col = pCity->x, real_row = pCity->y;
- Sint16 x0 = 3 * NORMAL_TILE_WIDTH / 2;
+ Sint16 x0 = 3 * tileset_tile_width(tileset) / 2;
Sint16 y0 = 0;
SDL_Surface *pTile = NULL;
SDL_Surface *pDest = create_surf(get_citydlg_canvas_width(),
get_citydlg_canvas_height()
- + HALF_NORMAL_TILE_HEIGHT, SDL_SWSURFACE);
+ + HALF_tileset_tile_height(tileset),
SDL_SWSURFACE);
real_col -= 2;
real_row -= 2;
correction_map_pos((int *) &real_col, (int *) &real_row);
@@ -2175,19 +2175,19 @@
for (; col < CITY_MAP_SIZE; col++) {
for (row = 0; row < CITY_MAP_SIZE; row++) {
#if 1
- sx = x0 + (col - row) * HALF_NORMAL_TILE_WIDTH;
- sy = y0 + (row + col) * HALF_NORMAL_TILE_HEIGHT;
+ sx = x0 + (col - row) * HALF_tileset_tile_width(tileset);
+ sy = y0 + (row + col) * HALF_tileset_tile_height(tileset);
#else
/* ugly hack for speed. Assumes:
- * NORMAL_TILE_WIDTH == 64
- * NORMAL_TILE_HEIGHT == 32 */
+ * tileset_tile_width(tileset) == 64
+ * tileset_tile_height(tileset) == 32 */
sx = x0 + ((col - row) << 5);
sy = y0 + ((row + col) << 4);
#endif
- if (sx > -NORMAL_TILE_WIDTH && sx < pDest->w + NORMAL_TILE_WIDTH
- && sy > -NORMAL_TILE_HEIGHT
- && sy < pDest->h + NORMAL_TILE_HEIGHT) {
+ if (sx > -tileset_tile_width(tileset) && sx < pDest->w +
tileset_tile_width(tileset)
+ && sy > -tileset_tile_height(tileset)
+ && sy < pDest->h + tileset_tile_height(tileset)) {
dest.x = sx;
dest.y = sy;
if ((!col && !row) ||
@@ -2214,11 +2214,11 @@
NULL, pTmpSurface, NULL);
SDL_SetColorKey(pTmpSurface, SDL_SRCCOLORKEY,
- getpixel(pTmpSurface, HALF_NORMAL_TILE_WIDTH,
- HALF_NORMAL_TILE_HEIGHT));
+ getpixel(pTmpSurface,
HALF_tileset_tile_width(tileset),
+ HALF_tileset_tile_height(tileset)));
/* create pTile */
- pTile = create_surf(NORMAL_TILE_WIDTH,
- NORMAL_TILE_HEIGHT, SDL_SWSURFACE);
+ pTile = create_surf(tileset_tile_width(tileset),
+ tileset_tile_height(tileset), SDL_SWSURFACE);
/* fill pTile with RED */
SDL_FillRect(pTile, NULL,
@@ -2270,7 +2270,7 @@
SDL_Surface *pTile = NULL;
SDL_Surface *pDest = create_surf(get_citydlg_canvas_width(),
get_citydlg_canvas_height()
- + HALF_NORMAL_TILE_HEIGHT, SDL_SWSURFACE);
+ + HALF_tileset_tile_height(tileset), SDL_SWSURFACE);
/* turn off drawing units */
@@ -2286,12 +2286,12 @@
&& tile_get_known(map_x, map_y)
&& city_to_canvas_pos(&canvas_x, &canvas_y, city_x, city_y)) {
draw_map_cell(pDest, canvas_x,
- canvas_y + HALF_NORMAL_TILE_HEIGHT, map_x, map_y, 1);
+ canvas_y + HALF_tileset_tile_height(tileset), map_x, map_y,
1);
if (get_worker_city(pCity, city_x, city_y) == C_TILE_UNAVAILABLE)
{
- SDL_Rect dest = {canvas_x, canvas_y + HALF_NORMAL_TILE_HEIGHT,
NORMAL_TILE_WIDTH, NORMAL_TILE_HEIGHT};
+ SDL_Rect dest = {canvas_x, canvas_y +
HALF_tileset_tile_height(tileset), tileset_tile_width(tileset),
tileset_tile_height(tileset)};
if (!pTile) {
/* fill pTile with Mask Color */
@@ -2303,11 +2303,11 @@
NULL, pTmpSurface, NULL);
SDL_SetColorKey(pTmpSurface, SDL_SRCCOLORKEY,
- getpixel(pTmpSurface, HALF_NORMAL_TILE_WIDTH,
- HALF_NORMAL_TILE_HEIGHT));
+ getpixel(pTmpSurface,
HALF_tileset_tile_width(tileset),
+ HALF_tileset_tile_height(tileset)));
/* create pTile */
- pTile = create_surf(NORMAL_TILE_WIDTH,
- NORMAL_TILE_HEIGHT, SDL_SWSURFACE);
+ pTile = create_surf(tileset_tile_width(tileset),
+ tileset_tile_height(tileset), SDL_SWSURFACE);
/* fill pTile with RED */
SDL_FillRect(pTile, NULL,
@@ -2373,7 +2373,7 @@
if (get_worker_city(pCity, city_x, city_y) == C_TILE_UNAVAILABLE)
{
SDL_Color used = {255, 0, 0, 96};
- SDL_Rect dest = {canvas_x, canvas_y, NORMAL_TILE_WIDTH,
NORMAL_TILE_HEIGHT};
+ SDL_Rect dest = {canvas_x, canvas_y, tileset_tile_width(tileset),
tileset_tile_height(tileset)};
SDL_FillRectAlpha(pDest, &dest, &used);
}
}
@@ -2402,8 +2402,8 @@
**************************************************************************/
SDL_Surface * get_terrain_surface(int x , int y)
{
- SDL_Surface *pSurf = create_surf(UNIT_TILE_WIDTH,
- UNIT_TILE_HEIGHT,
+ SDL_Surface *pSurf = create_surf(tileset_full_tile_width(tileset),
+ tileset_full_tile_height(tileset),
SDL_SWSURFACE);
bool fg = draw_fog_of_war,
ci = draw_cities ,
@@ -2431,7 +2431,7 @@
SDL_Client_Flags &= ~CF_DRAW_MAP_DITHER;
- draw_map_cell(pSurf, 0, NORMAL_TILE_HEIGHT / 2, x , y , 0);
+ draw_map_cell(pSurf, 0, tileset_tile_height(tileset) / 2, x , y , 0);
SDL_SetColorKey(pSurf , SDL_SRCCOLORKEY|SDL_RLEACCEL , 0x0);
@@ -2461,28 +2461,28 @@
**************************************************************************/
static SDL_Surface * create_ocean_tile(void)
{
- SDL_Surface *pOcean = create_surf(NORMAL_TILE_WIDTH ,
- NORMAL_TILE_HEIGHT ,
+ SDL_Surface *pOcean = create_surf(tileset_tile_width(tileset) ,
+ tileset_tile_height(tileset) ,
SDL_SWSURFACE);
SDL_Rect des = { 0 , 0 , 0, 0 };
SDL_Surface *pBuf[4];
/* top */
des.y = 0;
- des.x = NORMAL_TILE_WIDTH / 4;
+ des.x = tileset_tile_width(tileset) / 4;
SDL_BlitSurface(pBuf[0], NULL, pOcean, &des);
/* bottom */
- des.y = NORMAL_TILE_HEIGHT / 2;
+ des.y = tileset_tile_height(tileset) / 2;
SDL_BlitSurface(pBuf[1], NULL, pOcean, &des);
/* left */
des.x = 0;
- des.y = NORMAL_TILE_HEIGHT / 4;
+ des.y = tileset_tile_height(tileset) / 4;
SDL_BlitSurface(pBuf[2], NULL, pOcean, &des);
/* right */
- des.x = NORMAL_TILE_WIDTH / 2;
+ des.x = tileset_tile_width(tileset) / 2;
SDL_BlitSurface(pBuf[3], NULL, pOcean, &des);
SDL_SetColorKey(pOcean, SDL_SRCCOLORKEY|SDL_RLEACCEL, 0x0);
@@ -2532,10 +2532,10 @@
static void init_dither_tiles(void)
{
Terrain_type_id terrain;
- int i , w = NORMAL_TILE_WIDTH / 2, h = NORMAL_TILE_HEIGHT / 2;
+ int i , w = tileset_tile_width(tileset) / 2, h =
tileset_tile_height(tileset) / 2;
SDL_Rect src = { 0 , 0 , w , h };
- SDL_Surface *pTerrain_Surface, *pBuf = create_surf(NORMAL_TILE_WIDTH,
- NORMAL_TILE_HEIGHT, SDL_SWSURFACE);
+ SDL_Surface *pTerrain_Surface, *pBuf =
create_surf(tileset_tile_width(tileset),
+ tileset_tile_height(tileset),
SDL_SWSURFACE);
Uint32 color = SDL_MapRGB(pBuf->format, 255, 0, 255);
SDL_FillRect(pBuf, NULL, color);
SDL_SetColorKey(pBuf, SDL_SRCCOLORKEY, color);
@@ -2642,8 +2642,8 @@
void tmp_map_surfaces_init(void)
{
- HALF_NORMAL_TILE_HEIGHT = NORMAL_TILE_HEIGHT / 2;
- HALF_NORMAL_TILE_WIDTH = NORMAL_TILE_WIDTH / 2;
+ HALF_tileset_tile_height(tileset) = tileset_tile_height(tileset) / 2;
+ HALF_tileset_tile_width(tileset) = tileset_tile_width(tileset) / 2;
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
Amask = 0x000000ff;
@@ -2656,8 +2656,8 @@
if(tileset_is_isometric(tileset)) {
/* =========================== */
- pTmpSurface = create_surf(UNIT_TILE_WIDTH,
- UNIT_TILE_HEIGHT,
+ pTmpSurface = create_surf(tileset_full_tile_width(tileset),
+ tileset_full_tile_height(tileset),
SDL_SWSURFACE);
SDL_SetAlpha(pTmpSurface, 0x0, 0x0);
@@ -2675,8 +2675,8 @@
pOcean_Tile = create_ocean_tile();
- pOcean_Foged_Tile = create_surf(NORMAL_TILE_WIDTH ,
- NORMAL_TILE_HEIGHT ,
+ pOcean_Foged_Tile = create_surf(tileset_tile_width(tileset) ,
+ tileset_tile_height(tileset) ,
SDL_SWSURFACE);
SDL_BlitSurface(pOcean_Tile , NULL , pOcean_Foged_Tile, NULL);
@@ -2687,30 +2687,30 @@
/* =========================================================== */
/* create black grid */
- pMapGrid[0][0] = create_surf(NORMAL_TILE_WIDTH / 2,
- NORMAL_TILE_HEIGHT / 2, SDL_SWSURFACE);
- pMapGrid[0][1] = create_surf(NORMAL_TILE_WIDTH / 2,
- NORMAL_TILE_HEIGHT / 2, SDL_SWSURFACE);
+ pMapGrid[0][0] = create_surf(tileset_tile_width(tileset) / 2,
+ tileset_tile_height(tileset) / 2,
SDL_SWSURFACE);
+ pMapGrid[0][1] = create_surf(tileset_tile_width(tileset) / 2,
+ tileset_tile_height(tileset) / 2,
SDL_SWSURFACE);
putline(pMapGrid[0][0], 0, pMapGrid[0][0]->h, pMapGrid[0][0]->w, 0, 64);
putline(pMapGrid[0][1], 0, 0, pMapGrid[0][1]->w, pMapGrid[0][1]->h, 64);
SDL_SetColorKey(pMapGrid[0][0] , SDL_SRCCOLORKEY|SDL_RLEACCEL, 0x0);
SDL_SetColorKey(pMapGrid[0][1] , SDL_SRCCOLORKEY|SDL_RLEACCEL, 0x0);
/* create white grid */
- pMapGrid[1][0] = create_surf(NORMAL_TILE_WIDTH / 2,
- NORMAL_TILE_HEIGHT / 2, SDL_SWSURFACE);
- pMapGrid[1][1] = create_surf(NORMAL_TILE_WIDTH / 2,
- NORMAL_TILE_HEIGHT / 2, SDL_SWSURFACE);
+ pMapGrid[1][0] = create_surf(tileset_tile_width(tileset) / 2,
+ tileset_tile_height(tileset) / 2,
SDL_SWSURFACE);
+ pMapGrid[1][1] = create_surf(tileset_tile_width(tileset) / 2,
+ tileset_tile_height(tileset) / 2,
SDL_SWSURFACE);
putline(pMapGrid[1][0], 0, pMapGrid[1][0]->h, pMapGrid[1][0]->w, 0,
0xffffffff);
putline(pMapGrid[1][1], 0, 0, pMapGrid[1][1]->w, pMapGrid[1][1]->h,
0xffffffff);
SDL_SetColorKey(pMapGrid[1][0] , SDL_SRCCOLORKEY|SDL_RLEACCEL, 0x0);
SDL_SetColorKey(pMapGrid[1][1] , SDL_SRCCOLORKEY|SDL_RLEACCEL, 0x0);
/* create red grid */
- pMapGrid[2][0] = create_surf(NORMAL_TILE_WIDTH / 2,
- NORMAL_TILE_HEIGHT / 2, SDL_SWSURFACE);
- pMapGrid[2][1] = create_surf(NORMAL_TILE_WIDTH / 2,
- NORMAL_TILE_HEIGHT / 2, SDL_SWSURFACE);
+ pMapGrid[2][0] = create_surf(tileset_tile_width(tileset) / 2,
+ tileset_tile_height(tileset) / 2,
SDL_SWSURFACE);
+ pMapGrid[2][1] = create_surf(tileset_tile_width(tileset) / 2,
+ tileset_tile_height(tileset) / 2,
SDL_SWSURFACE);
putline(pMapGrid[2][0], 0, pMapGrid[2][0]->h, pMapGrid[2][0]->w, 0,
SDL_MapRGB(pMapGrid[2][0]->format, 255, 0,0));
putline(pMapGrid[2][1], 0, 0, pMapGrid[2][1]->w, pMapGrid[2][1]->h,
@@ -2719,10 +2719,10 @@
SDL_SetColorKey(pMapGrid[2][1] , SDL_SRCCOLORKEY|SDL_RLEACCEL, 0x0);
pBlinkSurfaceA =
- create_surf(UNIT_TILE_WIDTH, UNIT_TILE_HEIGHT, SDL_SWSURFACE);
+ create_surf(tileset_full_tile_width(tileset),
tileset_full_tile_height(tileset), SDL_SWSURFACE);
pBlinkSurfaceB =
- create_surf(UNIT_TILE_WIDTH, UNIT_TILE_HEIGHT, SDL_SWSURFACE);
+ create_surf(tileset_full_tile_width(tileset),
tileset_full_tile_height(tileset), SDL_SWSURFACE);
#ifdef SDL_CVS
SDL_SetColorKey(pBlinkSurfaceB , SDL_SRCCOLORKEY|SDL_RLEACCEL, 0x0);
Index: client/gui-sdl/repodlgs.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-sdl/repodlgs.c,v
retrieving revision 1.41
diff -u -r1.41 repodlgs.c
--- client/gui-sdl/repodlgs.c 11 Dec 2004 10:34:46 -0000 1.41
+++ client/gui-sdl/repodlgs.c 25 Mar 2005 20:41:04 -0000
@@ -573,7 +573,7 @@
} unit_type_iterate_end;
pUnitsDlg->pBeginWidgetList = pBuf;
- w = (UNIT_TILE_WIDTH * 2 + name_w + 15) +
+ w = (tileset_full_tile_width(tileset) * 2 + name_w + 15) +
(4 * pText1->w + 46) + (pText2->w + 16) + (pText5->w + 6) + 2;
if(count) {
pUnitsDlg->pBeginActiveWidgetList = pBuf;
@@ -618,7 +618,7 @@
/* totals background and label */
dst.x = FRAME_WH + 2;
dst.y = h - ( pText3->h + 2 ) - 2 - FRAME_WH;
- dst.w = name_w + UNIT_TILE_WIDTH * 2 + 5;
+ dst.w = name_w + tileset_full_tile_width(tileset) * 2 + 5;
dst.h = pText3->h + 2;
SDL_FillRectAlpha(pWindow->theme, &dst, &color);
@@ -626,14 +626,14 @@
dst.x + dst.w, dst.y + dst.h - 1, 0xFF000000);
dst.y += 1;
- dst.x += ((name_w + UNIT_TILE_WIDTH * 2 + 5) - pText3->w) / 2;
+ dst.x += ((name_w + tileset_full_tile_width(tileset) * 2 + 5) - pText3->w) /
2;
SDL_BlitSurface(pText3, NULL, pWindow->theme, &dst);
FREESURFACE(pText3);
/* total active widget */
pBuf = pBuf->prev;
pBuf->size.x = pWindow->size.x + FRAME_WH + name_w +
- UNIT_TILE_WIDTH * 2 + 17;
+ tileset_full_tile_width(tileset) * 2 + 17;
pBuf->size.y = pWindow->size.y + dst.y;
/* total shields cost widget */
@@ -659,7 +659,7 @@
/* units background and labels */
dst.x = FRAME_WH + 2;
dst.y = WINDOW_TILE_HIGH + 2;
- dst.w = name_w + UNIT_TILE_WIDTH * 2 + 5;
+ dst.w = name_w + tileset_full_tile_width(tileset) * 2 + 5;
dst.h = pText4->h + 2;
SDL_FillRectAlpha(pWindow->theme, &dst, &color);
@@ -667,12 +667,12 @@
dst.x + dst.w, dst.y + dst.h - 1, 0xFF000000);
dst.y += 1;
- dst.x += ((name_w + UNIT_TILE_WIDTH * 2 + 5)- pText4->w) / 2;
+ dst.x += ((name_w + tileset_full_tile_width(tileset) * 2 + 5)- pText4->w) /
2;
SDL_BlitSurface(pText4, NULL, pWindow->theme, &dst);
FREESURFACE(pText4);
/* active count background and label */
- dst.x = FRAME_WH + 2 + name_w + UNIT_TILE_WIDTH * 2 + 15;
+ dst.x = FRAME_WH + 2 + name_w + tileset_full_tile_width(tileset) * 2 + 15;
dst.y = WINDOW_TILE_HIGH + 2;
dst.w = pText1->w + 6;
dst.h = h - WINDOW_TILE_HIGH - 2 - FRAME_WH - 2;
@@ -769,14 +769,14 @@
pBuf = pBuf->prev;
while(TRUE)
{
- pBuf->size.x = start_x + (mod ? UNIT_TILE_WIDTH : 0);
+ pBuf->size.x = start_x + (mod ? tileset_full_tile_width(tileset) : 0);
pBuf->size.y = start_y;
hh = pBuf->size.h;
mod ^= 1;
pBuf = pBuf->prev;
pBuf->size.w = name_w;
- pBuf->size.x = start_x + UNIT_TILE_WIDTH * 2 + 5;
+ pBuf->size.x = start_x + tileset_full_tile_width(tileset) * 2 + 5;
pBuf->size.y = start_y + (hh - pBuf->size.h) / 2;
pBuf = pBuf->prev;
Index: client/gui-win32/citydlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-win32/citydlg.c,v
retrieving revision 1.98
diff -u -r1.98 citydlg.c
--- client/gui-win32/citydlg.c 23 Mar 2005 22:27:10 -0000 1.98
+++ client/gui-win32/citydlg.c 25 Mar 2005 20:41:05 -0000
@@ -309,9 +309,9 @@
RECT rc;
pdialog->present_unit_ids[i]=0;
rc.top=pdialog->present_y;
- rc.left=pdialog->pop_x+i*(SMALL_TILE_WIDTH+NORMAL_TILE_WIDTH);
- rc.right=rc.left+NORMAL_TILE_WIDTH;
- rc.bottom=rc.top+SMALL_TILE_HEIGHT+NORMAL_TILE_HEIGHT;
+
rc.left=pdialog->pop_x+i*(tileset_small_sprite_width(tileset)+tileset_tile_width(tileset));
+ rc.right=rc.left+tileset_tile_width(tileset);
+
rc.bottom=rc.top+tileset_small_sprite_height(tileset)+tileset_tile_height(tileset);
FillRect(hdc, &rc,
(HBRUSH)GetClassLong(pdialog->mainwindow,GCL_HBRBACKGROUND));
}
@@ -320,7 +320,7 @@
unit_list_iterate(plist, punit) {
put_unit(punit, &store,
- pdialog->pop_x + i * (SMALL_TILE_WIDTH + NORMAL_TILE_WIDTH),
+ pdialog->pop_x + i * (tileset_small_sprite_width(tileset) +
tileset_tile_width(tileset)),
pdialog->present_y);
pdialog->present_unit_ids[i] = punit->id;
i++;
@@ -356,9 +356,9 @@
RECT rc;
pdialog->support_unit_ids[i]=0;
rc.top=pdialog->supported_y;
- rc.left=pdialog->pop_x+i*(SMALL_TILE_WIDTH+NORMAL_TILE_WIDTH);
- rc.right=rc.left+NORMAL_TILE_WIDTH;
- rc.bottom=rc.top+SMALL_TILE_HEIGHT+NORMAL_TILE_HEIGHT;
+
rc.left=pdialog->pop_x+i*(tileset_small_sprite_width(tileset)+tileset_tile_width(tileset));
+ rc.right=rc.left+tileset_tile_width(tileset);
+
rc.bottom=rc.top+tileset_small_sprite_height(tileset)+tileset_tile_height(tileset);
FillRect(hdc, &rc,
(HBRUSH)GetClassLong(pdialog->mainwindow,GCL_HBRBACKGROUND));
}
@@ -367,10 +367,10 @@
unit_list_iterate(plist, punit) {
put_unit(punit, &store,
- pdialog->pop_x + i * (SMALL_TILE_WIDTH + NORMAL_TILE_WIDTH),
+ pdialog->pop_x + i * (tileset_small_sprite_width(tileset) +
tileset_tile_width(tileset)),
pdialog->supported_y);
put_unit_city_overlays(punit, &store,
- pdialog->pop_x + i * (SMALL_TILE_WIDTH + NORMAL_TILE_WIDTH),
+ pdialog->pop_x + i * (tileset_small_sprite_width(tileset) +
tileset_tile_width(tileset)),
pdialog->supported_y);
pdialog->support_unit_ids[i] = punit->id;
i++;
@@ -514,14 +514,14 @@
for (i = 0; i < pcity->size && i < NUM_CITIZENS_SHOWN; i++) {
draw_sprite(get_citizen_sprite(tileset, citizens[i], i, pcity), hdcsrc,
- SMALL_TILE_WIDTH * i, 0);
+ tileset_small_sprite_width(tileset) * i, 0);
}
if (i<NUM_CITIZENS_SHOWN) {
- rc.left=i*SMALL_TILE_WIDTH;
- rc.right=NUM_CITIZENS_SHOWN*SMALL_TILE_WIDTH;
+ rc.left=i*tileset_small_sprite_width(tileset);
+ rc.right=NUM_CITIZENS_SHOWN*tileset_small_sprite_width(tileset);
rc.top=0;
- rc.bottom=SMALL_TILE_HEIGHT;
+ rc.bottom=tileset_small_sprite_height(tileset);
FillRect(hdcsrc,&rc,
(HBRUSH)GetClassLong(pdialog->mainwindow,GCL_HBRBACKGROUND));
FrameRect(hdcsrc,&rc,
@@ -529,8 +529,8 @@
}
BitBlt(hdc,pdialog->pop_x,pdialog->pop_y,
- NUM_CITIZENS_SHOWN*SMALL_TILE_WIDTH,
- SMALL_TILE_HEIGHT,
+ NUM_CITIZENS_SHOWN*tileset_small_sprite_width(tileset),
+ tileset_small_sprite_height(tileset),
hdcsrc,0,0,SRCCOPY);
SelectObject(hdcsrc,oldbit);
DeleteDC(hdcsrc);
@@ -581,7 +581,7 @@
static void supported_minsize(LPPOINT minsize,void *data)
{
- minsize->y=SMALL_TILE_HEIGHT+NORMAL_TILE_HEIGHT;
+ minsize->y=tileset_small_sprite_height(tileset)+tileset_tile_height(tileset);
minsize->x=1; /* just a dummy value */
}
@@ -604,7 +604,7 @@
static void present_minsize(POINT * minsize,void *data)
{
- minsize->y=SMALL_TILE_HEIGHT+NORMAL_TILE_HEIGHT;
+ minsize->y=tileset_small_sprite_height(tileset)+tileset_tile_height(tileset);
minsize->x=1; /* just a dummy value */
}
@@ -736,16 +736,16 @@
pdialog->pop_y=15;
pdialog->pop_x=20;
pdialog->supported_y=pdialog->map.y+pdialog->map_h+12;
-
pdialog->present_y=pdialog->supported_y+NORMAL_TILE_HEIGHT+12+4+SMALL_TILE_HEIGHT;
- ybut=pdialog->present_y+NORMAL_TILE_HEIGHT+12+4+SMALL_TILE_HEIGHT;
+
pdialog->present_y=pdialog->supported_y+tileset_tile_height(tileset)+12+4+tileset_small_sprite_height(tileset);
+
ybut=pdialog->present_y+tileset_tile_height(tileset)+12+4+tileset_small_sprite_height(tileset);
hdc=GetDC(pdialog->mainwindow);
pdialog->map_bmp = CreateCompatibleBitmap(hdc, city_map_width,
city_map_height);
pdialog->citizen_bmp=CreateCompatibleBitmap(hdc,
NUM_CITIZENS_SHOWN*
- SMALL_TILE_WIDTH,
- SMALL_TILE_HEIGHT);
+
tileset_small_sprite_width(tileset),
+
tileset_small_sprite_height(tileset));
ReleaseDC(pdialog->mainwindow,hdc);
pdialog->full_win=fcwin_vbox_new(hWnd,FALSE);
@@ -1567,12 +1567,12 @@
/* click on citizens */
if ((!is_overview)&&
- (y>=pdialog->pop_y)&&(y<(pdialog->pop_y+SMALL_TILE_HEIGHT)))
+
(y>=pdialog->pop_y)&&(y<(pdialog->pop_y+tileset_small_sprite_height(tileset))))
{
xr=x-pdialog->pop_x;
if (x>=0)
{
- xr/=SMALL_TILE_WIDTH;
+ xr/=tileset_small_sprite_width(tileset);
if (xr<NUM_CITIZENS_SHOWN)
{
city_dlg_click_citizens(pdialog,xr);
@@ -1599,18 +1599,18 @@
}
xr=x-pdialog->pop_x;
if (xr<0) return;
- if (xr%(NORMAL_TILE_WIDTH+SMALL_TILE_WIDTH)>NORMAL_TILE_WIDTH)
+ if
(xr%(tileset_tile_width(tileset)+tileset_small_sprite_width(tileset))>tileset_tile_width(tileset))
return;
- xr/=(NORMAL_TILE_WIDTH+SMALL_TILE_WIDTH);
+ xr/=(tileset_tile_width(tileset)+tileset_small_sprite_width(tileset));
/* click on present units */
- if ((y>=pdialog->present_y)&&(y<(pdialog->present_y+NORMAL_TILE_HEIGHT)))
+ if
((y>=pdialog->present_y)&&(y<(pdialog->present_y+tileset_tile_height(tileset))))
{
city_dlg_click_present(pdialog,xr);
return;
}
if ((y>=pdialog->supported_y)&&
- (y<(pdialog->supported_y+NORMAL_TILE_HEIGHT+SMALL_TILE_HEIGHT)))
+
(y<(pdialog->supported_y+tileset_tile_height(tileset)+tileset_small_sprite_height(tileset))))
{
city_dlg_click_supported(pdialog,xr);
return;
@@ -1735,7 +1735,7 @@
hdcsrc = CreateCompatibleDC(NULL);
old=SelectObject(hdcsrc,pdialog->citizen_bmp);
BitBlt(hdc,pdialog->pop_x,pdialog->pop_y,
- SMALL_TILE_WIDTH*NUM_CITIZENS_SHOWN,SMALL_TILE_HEIGHT,
+
tileset_small_sprite_width(tileset)*NUM_CITIZENS_SHOWN,tileset_small_sprite_height(tileset),
hdcsrc,0,0,SRCCOPY);
SelectObject(hdcsrc,old);
DeleteDC(hdcsrc);
Index: client/gui-win32/dialogs.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-win32/dialogs.c,v
retrieving revision 1.64
diff -u -r1.64 dialogs.c
--- client/gui-win32/dialogs.c 23 Mar 2005 22:27:10 -0000 1.64
+++ client/gui-win32/dialogs.c 25 Mar 2005 20:41:05 -0000
@@ -752,16 +752,16 @@
max_width=rc.right-rc.left;
if ((rc.bottom-rc.top)>max_height)
max_height=rc.bottom-rc.top;
- unit_select_bitmaps[i]=CreateCompatibleBitmap(hdc,UNIT_TILE_WIDTH,
- UNIT_TILE_HEIGHT);
+
unit_select_bitmaps[i]=CreateCompatibleBitmap(hdc,tileset_full_tile_width(tileset),
+
tileset_full_tile_height(tileset));
}
ReleaseDC(unit_select_main,hdc);
old=SelectObject(unitsel_dc,unit_select_bitmaps[0]);
- max_width+=UNIT_TILE_WIDTH;
+ max_width+=tileset_full_tile_width(tileset);
max_width+=4;
- if (max_height<UNIT_TILE_WIDTH)
+ if (max_height<tileset_full_tile_width(tileset))
{
- max_height=UNIT_TILE_HEIGHT;
+ max_height=tileset_full_tile_height(tileset);
}
max_height+=4;
for (i=0;i<n;i++)
@@ -784,24 +784,24 @@
unit_activity_text(punit));
unit_select_labels[i]=CreateWindow("STATIC",buffer,
WS_CHILD | WS_VISIBLE | SS_LEFT,
- (i/r)*max_width+UNIT_TILE_WIDTH,
+
(i/r)*max_width+tileset_full_tile_width(tileset),
(i%r)*max_height,
- max_width-UNIT_TILE_WIDTH,
+
max_width-tileset_full_tile_width(tileset),
max_height,
unit_select_main,
NULL,
freecivhinst,
NULL);
SelectObject(unitsel_dc,unit_select_bitmaps[i]);
- BitBlt(unitsel_dc,0,0,UNIT_TILE_WIDTH,UNIT_TILE_HEIGHT,NULL,
+
BitBlt(unitsel_dc,0,0,tileset_full_tile_width(tileset),tileset_full_tile_height(tileset),NULL,
0,0,WHITENESS);
put_unit(punit,&canvas_store,0,0);
unit_select_but[i]=CreateWindow("BUTTON",NULL,
WS_CHILD | WS_VISIBLE | BS_BITMAP,
(i/r)*max_width,
(i%r)*max_height,
- UNIT_TILE_WIDTH,
- UNIT_TILE_HEIGHT,
+ tileset_full_tile_width(tileset),
+ tileset_full_tile_height(tileset),
unit_select_main,
(HMENU)(UNITSELECT_UNITS_BASE+i),
freecivhinst,
Index: client/gui-win32/gui_main.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-win32/gui_main.c,v
retrieving revision 1.48
diff -u -r1.48 gui_main.c
--- client/gui-win32/gui_main.c 23 Mar 2005 22:27:10 -0000 1.48
+++ client/gui-win32/gui_main.c 25 Mar 2005 20:41:05 -0000
@@ -195,9 +195,9 @@
if ((x>overview_win_x)&&(x<overview_win_x+overview_win_width)
&&(y>overview_win_y)&&(y<overview_win_y+overview_win_height))
overview_handle_rbut(x-overview_win_x,y-overview_win_y);
- else if ((x<10*SMALL_TILE_WIDTH)&&(y>taxinfoline_y)
- &&(y<taxinfoline_y+2*SMALL_TILE_HEIGHT))
- indicator_handle_but(x/SMALL_TILE_WIDTH);
+ else if ((x<10*tileset_small_sprite_width(tileset))&&(y>taxinfoline_y)
+ &&(y<taxinfoline_y+2*tileset_small_sprite_height(tileset)))
+ indicator_handle_but(x/tileset_small_sprite_width(tileset));
}
/**************************************************************************
@@ -284,8 +284,8 @@
**************************************************************************/
static void taxinfoline_minsize(POINT * minsize,void *data)
{
- minsize->x=10*SMALL_TILE_WIDTH;
- minsize->y=1*SMALL_TILE_HEIGHT;
+ minsize->x=10*tileset_small_sprite_width(tileset);
+ minsize->y=1*tileset_small_sprite_height(tileset);
}
/**************************************************************************
@@ -293,8 +293,8 @@
**************************************************************************/
static void indicator_line_minsize(POINT *minsize, void *data)
{
- minsize->x=4*SMALL_TILE_WIDTH;
- minsize->y=1*SMALL_TILE_HEIGHT;
+ minsize->x=4*tileset_small_sprite_width(tileset);
+ minsize->y=1*tileset_small_sprite_height(tileset);
}
/**************************************************************************
@@ -311,7 +311,7 @@
{
RECT rc;
rc=*newsize;
- rc.bottom+=SMALL_TILE_HEIGHT;
+ rc.bottom+=tileset_small_sprite_height(tileset);
InvalidateRect(root_window,newsize,TRUE);
taxinfoline_y=newsize->top;
@@ -354,8 +354,8 @@
**************************************************************************/
static void map_minsize(POINT * minsize, void *data)
{
- minsize->x=NORMAL_TILE_WIDTH+15;
- minsize->y=NORMAL_TILE_HEIGHT+15;
+ minsize->x=tileset_tile_width(tileset)+15;
+ minsize->y=tileset_tile_height(tileset)+15;
}
/**************************************************************************
@@ -371,7 +371,7 @@
if ((mx==map_win_x)&&(map_win_y==my)&&
(map_win_width==mw)&&(map_win_height==mh))
return;
- if ((mw<(2*NORMAL_TILE_WIDTH))||(mh<(2*NORMAL_TILE_HEIGHT))) {
+ if
((mw<(2*tileset_tile_width(tileset)))||(mh<(2*tileset_tile_height(tileset)))) {
return;
}
map_win_x=mx;
Index: client/gui-win32/happiness.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-win32/happiness.c,v
retrieving revision 1.11
diff -u -r1.11 happiness.c
--- client/gui-win32/happiness.c 21 Mar 2005 16:37:53 -0000 1.11
+++ client/gui-win32/happiness.c 25 Mar 2005 20:41:05 -0000
@@ -64,8 +64,8 @@
**************************************************************************/
static void bmp_row_minsize(POINT *minsize, void *data)
{
- minsize->x=HAPPINESS_PIX_WIDTH*SMALL_TILE_WIDTH;
- minsize->y=SMALL_TILE_HEIGHT;
+ minsize->x=HAPPINESS_PIX_WIDTH*tileset_small_sprite_width(tileset);
+ minsize->y=tileset_small_sprite_height(tileset);
}
/**************************************************************************
@@ -106,8 +106,8 @@
for(i=0;i<NUM_HAPPINESS_MODIFIERS;i++) {
dlg->mod_bmp[i]=
CreateCompatibleBitmap(hdc,
- HAPPINESS_PIX_WIDTH*SMALL_TILE_WIDTH,
- SMALL_TILE_HEIGHT);
+
HAPPINESS_PIX_WIDTH*tileset_small_sprite_width(tileset),
+ tileset_small_sprite_height(tileset));
}
ReleaseDC(win,hdc);
return dlg;
@@ -137,8 +137,8 @@
for(i=0;i<NUM_HAPPINESS_MODIFIERS;i++) {
old=SelectObject(hdcsrc,dlg->mod_bmp[i]);
BitBlt(hdc,dlg->mod_bmp_pos[i].x,dlg->mod_bmp_pos[i].y,
- HAPPINESS_PIX_WIDTH*SMALL_TILE_WIDTH,
- SMALL_TILE_HEIGHT,hdcsrc,0,0,SRCCOPY);
+ HAPPINESS_PIX_WIDTH*tileset_small_sprite_width(tileset),
+ tileset_small_sprite_height(tileset),hdcsrc,0,0,SRCCOPY);
SelectObject(hdcsrc,old);
}
DeleteDC(hdcsrc);
@@ -295,15 +295,15 @@
int i;
struct citizen_type citizens[MAX_CITY_SIZE];
int num_citizens = pcity->size;
- int pix_width = HAPPINESS_PIX_WIDTH * SMALL_TILE_WIDTH;
- int offset = MIN(SMALL_TILE_WIDTH, pix_width / num_citizens);
- /* int true_pix_width = (num_citizens - 1) * offset + SMALL_TILE_WIDTH; */
+ int pix_width = HAPPINESS_PIX_WIDTH * tileset_small_sprite_width(tileset);
+ int offset = MIN(tileset_small_sprite_width(tileset), pix_width /
num_citizens);
+ /* int true_pix_width = (num_citizens - 1) * offset +
tileset_small_sprite_width(tileset); */
hdc=CreateCompatibleDC(NULL);
old=SelectObject(hdc,bmp);
rc.left=0;
rc.top=0;
rc.right=pix_width;
- rc.bottom=SMALL_TILE_HEIGHT;
+ rc.bottom=tileset_small_sprite_height(tileset);
FillRect(hdc,&rc,(HBRUSH)GetClassLong(root_window,GCL_HBRBACKGROUND));
get_city_citizen_types(pcity, index, citizens);
Index: client/gui-win32/helpdlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-win32/helpdlg.c,v
retrieving revision 1.26
diff -u -r1.26 helpdlg.c
--- client/gui-win32/helpdlg.c 14 Mar 2005 20:26:24 -0000 1.26
+++ client/gui-win32/helpdlg.c 25 Mar 2005 20:41:05 -0000
@@ -313,8 +313,8 @@
**************************************************************************/
static void unit_minsize(POINT *min,void *data)
{
- min->x=UNIT_TILE_WIDTH;
- min->y=UNIT_TILE_HEIGHT;
+ min->x=tileset_full_tile_width(tileset);
+ min->y=tileset_full_tile_height(tileset);
}
/*************************************************************************
@@ -651,8 +651,8 @@
RECT rc;
rc.top=unitpos.y;
rc.left=unitpos.x;
- rc.bottom=unitpos.y+UNIT_TILE_HEIGHT;
- rc.right=unitpos.x+UNIT_TILE_WIDTH;
+ rc.bottom=unitpos.y+tileset_full_tile_height(tileset);
+ rc.right=unitpos.x+tileset_full_tile_width(tileset);
/* Give tile a background color, based on the type of unit */
switch (get_unit_type(i)->move_type) {
Index: client/gui-win32/mapview.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-win32/mapview.c,v
retrieving revision 1.152
diff -u -r1.152 mapview.c
--- client/gui-win32/mapview.c 23 Mar 2005 22:27:10 -0000 1.152
+++ client/gui-win32/mapview.c 25 Mar 2005 20:41:05 -0000
@@ -125,13 +125,13 @@
d=0;
for(;d<(game.player_ptr->economic.luxury)/10;d++)
draw_sprite(get_tax_sprite(tileset, O_LUXURY), hdc,
- SMALL_TILE_WIDTH*d,taxinfoline_y);/* elvis tile */
+ tileset_small_sprite_width(tileset)*d,taxinfoline_y);/* elvis
tile */
for(;d<(game.player_ptr->economic.science+game.player_ptr->economic.luxury)/10;d++)
draw_sprite(get_tax_sprite(tileset, O_SCIENCE), hdc,
- SMALL_TILE_WIDTH*d,taxinfoline_y); /* scientist tile */
+ tileset_small_sprite_width(tileset)*d,taxinfoline_y); /*
scientist tile */
for(;d<10;d++)
draw_sprite(get_tax_sprite(tileset, O_GOLD), hdc,
- SMALL_TILE_WIDTH*d,taxinfoline_y); /* taxman tile */
+ tileset_small_sprite_width(tileset)*d,taxinfoline_y); /* taxman
tile */
}
/**************************************************************************
@@ -250,7 +250,7 @@
hdc=GetDC(root_window);
for(i=0;i<4;i++)
- draw_sprite(indicator_sprite[i],hdc,i*SMALL_TILE_WIDTH,indicator_y);
+
draw_sprite(indicator_sprite[i],hdc,i*tileset_small_sprite_width(tileset),indicator_y);
ReleaseDC(root_window,hdc);
}
@@ -468,8 +468,8 @@
old=SelectObject(hdctest,bmp);
else
DeleteObject(SelectObject(hdctest,bmp));
- BitBlt(hdc,i*SMALL_TILE_WIDTH,indicator_y,
- SMALL_TILE_WIDTH,SMALL_TILE_HEIGHT,
+ BitBlt(hdc,i*tileset_small_sprite_width(tileset),indicator_y,
+
tileset_small_sprite_width(tileset),tileset_small_sprite_height(tileset),
hdctest,0,0,SRCCOPY);
}
SelectObject(hdctest,old);
Index: client/gui-win32/sprite.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-win32/sprite.c,v
retrieving revision 1.1
diff -u -r1.1 sprite.c
--- client/gui-win32/sprite.c 23 Mar 2005 22:27:10 -0000 1.1
+++ client/gui-win32/sprite.c 25 Mar 2005 20:41:05 -0000
@@ -326,12 +326,12 @@
if (fogmask) {
DeleteObject(fogmask);
}
- stipple = CreateCompatibleBitmap(hdc, NORMAL_TILE_WIDTH, NORMAL_TILE_HEIGHT);
- fogmask = CreateCompatibleBitmap(hdc, NORMAL_TILE_WIDTH, NORMAL_TILE_HEIGHT);
+ stipple = CreateCompatibleBitmap(hdc, tileset_tile_width(tileset),
tileset_tile_height(tileset));
+ fogmask = CreateCompatibleBitmap(hdc, tileset_tile_width(tileset),
tileset_tile_height(tileset));
old = SelectObject(hdc, stipple);
- BitBlt(hdc, 0, 0, NORMAL_TILE_WIDTH, NORMAL_TILE_HEIGHT, NULL, 0, 0,
BLACKNESS);
- for(x = 0; x < NORMAL_TILE_WIDTH; x++) {
- for(y = 0; y < NORMAL_TILE_HEIGHT; y++) {
+ BitBlt(hdc, 0, 0, tileset_tile_width(tileset), tileset_tile_height(tileset),
NULL, 0, 0, BLACKNESS);
+ for(x = 0; x < tileset_tile_width(tileset); x++) {
+ for(y = 0; y < tileset_tile_height(tileset); y++) {
if ((x + y) & 1) {
SetPixel(hdc, x, y, RGB(255, 255, 255));
}
Index: client/gui-xaw/citydlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/citydlg.c,v
retrieving revision 1.135
diff -u -r1.135 citydlg.c
--- client/gui-xaw/citydlg.c 21 Mar 2005 16:37:54 -0000 1.135
+++ client/gui-xaw/citydlg.c 25 Mar 2005 20:41:06 -0000
@@ -493,7 +493,7 @@
struct citizen_type c = {.type = CITIZEN_SPECIALIST,
.spec_type = DEFAULT_SPECIALIST};
- if (NORMAL_TILE_HEIGHT<45) dummy_improvement_list[5]=0;
+ if (tileset_tile_height(tileset)<45) dummy_improvement_list[5]=0;
if (concise_city_production) {
dummy_improvement_list[0] = "XXXXXXXXXXXXXXXXXXXXXXXXXXXX";
@@ -714,8 +714,8 @@
pixcommWidgetClass,
pdialog->main_form,
XtNfromVert, pdialog->support_unit_label,
- XtNwidth, UNIT_TILE_WIDTH,
- XtNheight, 3 * NORMAL_TILE_HEIGHT / 2,
+ XtNwidth, tileset_full_tile_width(tileset),
+ XtNheight, 3 * tileset_tile_height(tileset) / 2,
NULL);
pdialog->present_unit_label=
@@ -731,8 +731,8 @@
pixcommWidgetClass,
pdialog->main_form,
XtNfromVert, pdialog->present_unit_label,
- XtNwidth, UNIT_TILE_WIDTH,
- XtNheight, UNIT_TILE_HEIGHT,
+ XtNwidth, tileset_full_tile_width(tileset),
+ XtNheight, tileset_full_tile_height(tileset),
NULL);
@@ -911,7 +911,7 @@
} else {
pdialog->num_citizens_shown=DEFAULT_NUM_CITIZENS;
pdialog->num_units_shown=DEFAULT_NUM_UNITS;
- if (NORMAL_TILE_HEIGHT<45) {
+ if (tileset_tile_height(tileset)<45) {
pdialog->num_citizens_shown-=5;
pdialog->num_units_shown+=3;
}
@@ -957,8 +957,8 @@
XtNfromVert, pdialog->support_unit_label,
XtNfromHoriz,
(XtArgVal)pdialog->support_unit_pixcomms[i-1],
- XtNwidth, UNIT_TILE_WIDTH,
- XtNheight, 3 * NORMAL_TILE_HEIGHT / 2,
+ XtNwidth, tileset_full_tile_width(tileset),
+ XtNheight, 3 * tileset_tile_height(tileset) / 2,
NULL);
}
@@ -981,8 +981,8 @@
XtNfromVert, pdialog->present_unit_label,
XtNfromHoriz,
(XtArgVal)pdialog->support_unit_pixcomms[i-1],
- XtNwidth, UNIT_TILE_WIDTH,
- XtNheight, UNIT_TILE_HEIGHT,
+ XtNwidth, tileset_full_tile_width(tileset),
+ XtNheight, tileset_full_tile_height(tileset),
NULL);
}
Index: client/gui-xaw/dialogs.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/dialogs.c,v
retrieving revision 1.109
diff -u -r1.109 dialogs.c
--- client/gui-xaw/dialogs.c 22 Jan 2005 19:45:41 -0000 1.109
+++ client/gui-xaw/dialogs.c 25 Mar 2005 20:41:06 -0000
@@ -1477,11 +1477,11 @@
unit_activity_text(punit));
unit_select_pixmaps[i]=XCreatePixmap(display, XtWindow(map_canvas),
- UNIT_TILE_WIDTH, UNIT_TILE_HEIGHT,
+ tileset_full_tile_width(tileset),
tileset_full_tile_height(tileset),
display_depth);
XFillRectangle(display, unit_select_pixmaps[i], fill_bg_gc,
- 0, 0, UNIT_TILE_WIDTH, UNIT_TILE_HEIGHT);
+ 0, 0, tileset_full_tile_width(tileset),
tileset_full_tile_height(tileset));
store.pixmap = unit_select_pixmaps[i];
put_unit(punit, &store, 0, 0);
Index: client/gui-xaw/graphics.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/graphics.c,v
retrieving revision 1.60
diff -u -r1.60 graphics.c
--- client/gui-xaw/graphics.c 21 Mar 2005 16:37:54 -0000 1.60
+++ client/gui-xaw/graphics.c 25 Mar 2005 20:41:06 -0000
@@ -498,7 +498,7 @@
enum color_std bg_color;
pm=XCreatePixmap(display, root_window,
- UNIT_TILE_WIDTH, UNIT_TILE_HEIGHT, display_depth);
+ tileset_full_tile_width(tileset),
tileset_full_tile_height(tileset), display_depth);
/* Give tile a background color, based on the type of unit */
switch (get_unit_type(i)->move_type) {
@@ -510,7 +510,7 @@
}
XSetForeground(display, fill_bg_gc, colors_standard[bg_color]);
XFillRectangle(display, pm, fill_bg_gc, 0,0,
- UNIT_TILE_WIDTH, UNIT_TILE_HEIGHT);
+ tileset_full_tile_width(tileset),
tileset_full_tile_height(tileset));
/* If we're using flags, put one on the tile */
if(!solid_color_behind_units) {
Index: client/gui-xaw/gui_main.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/gui_main.c,v
retrieving revision 1.110
diff -u -r1.110 gui_main.c
--- client/gui-xaw/gui_main.c 21 Mar 2005 16:37:54 -0000 1.110
+++ client/gui-xaw/gui_main.c 25 Mar 2005 20:41:07 -0000
@@ -426,7 +426,7 @@
}
/* 135 below is rough value (could be more intelligent) --dwp */
- num_units_below = 135 / UNIT_TILE_WIDTH;
+ num_units_below = 135 / tileset_full_tile_width(tileset);
num_units_below = MIN(num_units_below,MAX_NUM_UNITS_BELOW);
num_units_below = MAX(num_units_below,1);
@@ -478,7 +478,7 @@
for(i=0; i<num_units_below; i++)
unit_below_pixmap[i]=XCreatePixmap(display, XtWindow(overview_canvas),
- UNIT_TILE_WIDTH, UNIT_TILE_HEIGHT,
+ tileset_full_tile_width(tileset),
tileset_full_tile_height(tileset),
display_depth);
set_indicator_icons(client_research_sprite(),
@@ -589,8 +589,8 @@
econ_label[i] = XtVaCreateManagedWidget("econlabels",
commandWidgetClass,
left_column_form,
- XtNwidth, SMALL_TILE_WIDTH,
- XtNheight, SMALL_TILE_HEIGHT,
+ XtNwidth,
tileset_small_sprite_width(tileset),
+ XtNheight,
tileset_small_sprite_height(tileset),
i?XtNfromHoriz:NULL,
i?econ_label[i-1]:NULL,
XtNhorizDistance, econ_label_space,
@@ -628,7 +628,7 @@
commandWidgetClass,
left_column_form,
XtNwidth, econ_label_count*
-
(SMALL_TILE_WIDTH+econ_label_space),
+
(tileset_small_sprite_width(tileset)+econ_label_space),
NULL));
@@ -640,8 +640,8 @@
unit_pix_canvas = XtVaCreateManagedWidget("unitpixcanvas",
pixcommWidgetClass,
left_column_form,
- XtNwidth, UNIT_TILE_WIDTH,
- XtNheight, UNIT_TILE_HEIGHT,
+ XtNwidth,
tileset_full_tile_width(tileset),
+ XtNheight,
tileset_full_tile_height(tileset),
NULL);
for(i=0; i<num_units_below; i++) {
@@ -652,9 +652,9 @@
pixcommWidgetClass,
left_column_form,
XtNwidth,
- UNIT_TILE_WIDTH,
+
tileset_full_tile_width(tileset),
XtNheight,
- UNIT_TILE_HEIGHT,
+
tileset_full_tile_height(tileset),
NULL);
XtAddCallback(unit_below_canvas[i], XtNcallback, unit_icon_callback,
(XtPointer)i);
Index: client/gui-xaw/helpdlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/helpdlg.c,v
retrieving revision 1.57
diff -u -r1.57 helpdlg.c
--- client/gui-xaw/helpdlg.c 19 Dec 2004 18:53:14 -0000 1.57
+++ client/gui-xaw/helpdlg.c 25 Mar 2005 20:41:07 -0000
@@ -490,8 +490,8 @@
XtVaCreateManagedWidget("helpunittile",
labelWidgetClass,
help_right_form,
- XtNwidth, UNIT_TILE_WIDTH,
- XtNheight, UNIT_TILE_HEIGHT,
+ XtNwidth, tileset_full_tile_width(tileset),
+ XtNheight, tileset_full_tile_height(tileset),
NULL);
XtAddCallback(help_unit_tile,
XtNdestroyCallback,free_bitmap_destroy_callback,
Index: client/gui-xaw/mapctrl.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/mapctrl.c,v
retrieving revision 1.92
diff -u -r1.92 mapctrl.c
--- client/gui-xaw/mapctrl.c 4 Oct 2004 05:26:31 -0000 1.92
+++ client/gui-xaw/mapctrl.c 25 Mar 2005 20:41:07 -0000
@@ -138,11 +138,11 @@
*cross_head = ptile;
cross_head++;
- xin /= NORMAL_TILE_WIDTH;
- xin *= NORMAL_TILE_WIDTH;
- yin /= NORMAL_TILE_HEIGHT;
- yin *= NORMAL_TILE_HEIGHT;
- xin += (NORMAL_TILE_WIDTH / 2);
+ xin /= tileset_tile_width(tileset);
+ xin *= tileset_tile_width(tileset);
+ yin /= tileset_tile_height(tileset);
+ yin *= tileset_tile_height(tileset);
+ xin += (tileset_tile_width(tileset) / 2);
XtTranslateCoords(map_canvas, xin, yin, &x, &y);
dw = XDisplayWidth (display, screen_number);
dh = XDisplayHeight (display, screen_number);
Index: client/gui-xaw/mapview.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/mapview.c,v
retrieving revision 1.198
diff -u -r1.198 mapview.c
--- client/gui-xaw/mapview.c 21 Mar 2005 16:37:54 -0000 1.198
+++ client/gui-xaw/mapview.c 25 Mar 2005 20:41:07 -0000
@@ -709,10 +709,10 @@
/* wipe the slate clean */
XSetForeground(display, fill_bg_gc, colors_standard[COLOR_STD_WHITE]);
- XFillRectangle(display, pm, fill_bg_gc, 0, NORMAL_TILE_WIDTH,
- NORMAL_TILE_HEIGHT, NORMAL_TILE_HEIGHT+SMALL_TILE_HEIGHT);
+ XFillRectangle(display, pm, fill_bg_gc, 0, tileset_tile_width(tileset),
+ tileset_tile_height(tileset),
tileset_tile_height(tileset)+tileset_small_sprite_height(tileset));
- put_unit_city_overlays(punit, &store, 0, NORMAL_TILE_HEIGHT);
+ put_unit_city_overlays(punit, &store, 0, tileset_tile_height(tileset));
}
/**************************************************************************
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] (PR#12653) remove NORMAL_TILE_WIDTH and other tileset macros,
Jason Short <=
|
|