[Freeciv-Dev] (PR#11525) merge put_one_tile
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=11525 >
This patch:
- Merges put_one_tile and put_one_tile_iso. (put_one_tile used to draw
black tiles but this isn't needed. Once it's dropped the two functions
are identical.)
- Drops put_tile and put_tile_iso. These were only called in one place
anyway, and with the above merge this is too simple to warrant a
separate function.
-jason
Index: client/citydlg_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/citydlg_common.c,v
retrieving revision 1.51
diff -u -r1.51 citydlg_common.c
--- client/citydlg_common.c 30 Nov 2004 08:37:02 -0000 1.51
+++ client/citydlg_common.c 15 Dec 2004 08:12:07 -0000
@@ -175,11 +175,7 @@
citydlg_known_iterate(pcity, city_x, city_y,
ptile, canvas_x, canvas_y) {
- if (is_isometric) {
- put_one_tile_iso(pcanvas, ptile, canvas_x, canvas_y, TRUE);
- } else {
- put_one_tile(pcanvas, ptile, canvas_x, canvas_y, TRUE);
- }
+ put_one_tile(pcanvas, ptile, canvas_x, canvas_y, TRUE);
} citydlg_known_iterate_end;
/* We have to put the output afterwards or it will be covered
Index: client/mapview_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/mapview_common.c,v
retrieving revision 1.165
diff -u -r1.165 mapview_common.c
--- client/mapview_common.c 15 Dec 2004 07:58:44 -0000 1.165
+++ client/mapview_common.c 15 Dec 2004 08:12:08 -0000
@@ -1303,41 +1303,6 @@
}
}
-/**************************************************************************
- Draw the given map tile at the given canvas position in non-isometric
- view.
-**************************************************************************/
-void put_one_tile(struct canvas *pcanvas, struct tile *ptile,
- int canvas_x, int canvas_y, bool citymode)
-{
- if (tile_get_known(ptile) != TILE_UNKNOWN) {
- /* FIXME: These two functions should be merged. */
- put_one_tile_iso(pcanvas, ptile, canvas_x, canvas_y, citymode);
- } else {
- /* tile is unknown */
- canvas_put_rectangle(pcanvas, COLOR_STD_BLACK,
- canvas_x, canvas_y,
- NORMAL_TILE_WIDTH, NORMAL_TILE_HEIGHT);
- }
-}
-
-/**************************************************************************
- Draw the unique tile for the given map position, in non-isometric view.
- The coordinates have not been normalized, and are not guaranteed to be
- real (we have to draw unreal tiles too).
-**************************************************************************/
-static void put_tile(struct tile *ptile)
-{
- int canvas_x, canvas_y;
-
- if (tile_to_canvas_pos(&canvas_x, &canvas_y, ptile)) {
- freelog(LOG_DEBUG, "putting (%d,%d) at (%d,%d)",
- TILE_XY(ptile), canvas_x, canvas_y);
- put_one_tile(mapview_canvas.store, ptile,
- canvas_x, canvas_y, FALSE);
- }
-}
-
/****************************************************************************
Draw the map grid around the given map tile at the given canvas position.
****************************************************************************/
@@ -1449,10 +1414,10 @@
}
/**************************************************************************
- Draw some or all of a tile onto the canvas, in iso-view.
+ Draw some or all of a tile onto the canvas.
**************************************************************************/
-void put_one_tile_iso(struct canvas *pcanvas, struct tile *ptile,
- int canvas_x, int canvas_y, bool citymode)
+void put_one_tile(struct canvas *pcanvas, struct tile *ptile,
+ int canvas_x, int canvas_y, bool citymode)
{
struct drawn_sprite tile_sprs[80];
int count = fill_sprite_array(tile_sprs, ptile,
@@ -1466,25 +1431,6 @@
}
/**************************************************************************
- Draw the unique tile for the given map position, in isometric view.
- The coordinates have not been normalized, and are not guaranteed to be
- real (we have to draw unreal tiles too).
-**************************************************************************/
-static void put_tile_iso(struct tile *ptile)
-{
- int canvas_x, canvas_y;
-
- if (tile_to_canvas_pos(&canvas_x, &canvas_y, ptile)) {
- freelog(LOG_DEBUG, "putting (%d,%d) at (%d,%d)",
- TILE_XY(ptile), canvas_x, canvas_y);
-
- put_one_tile_iso(mapview_canvas.store,
- ptile, canvas_x, canvas_y,
- FALSE);
- }
-}
-
-/**************************************************************************
Update (refresh) the map canvas starting at the given tile (in map
coordinates) and with the given dimensions (also in map coordinates).
@@ -1540,23 +1486,16 @@
canvas_put_rectangle(mapview_canvas.store, COLOR_STD_BLACK,
canvas_x, canvas_y, width, height);
- /* FIXME: we don't have to draw black (unknown) tiles since they're already
- * cleared. */
- if (is_isometric) {
- gui_rect_iterate(gui_x0, gui_y0, width, height + NORMAL_TILE_HEIGHT / 2,
- ptile) {
- put_tile_iso(ptile);
- } gui_rect_iterate_end;
- } else {
- /* not isometric */
- gui_rect_iterate(gui_x0, gui_y0, width, height, ptile) {
- /*
- * We don't normalize until later because we want to draw
- * black tiles for unreal positions.
- */
- put_tile(ptile);
- } gui_rect_iterate_end;
- }
+ gui_rect_iterate(gui_x0, gui_y0, width,
+ height + (is_isometric ? (NORMAL_TILE_HEIGHT / 2) : 0),
+ ptile) {
+ int cx, cy;
+
+ if (tile_get_known(ptile) != TILE_UNKNOWN
+ && tile_to_canvas_pos(&cx, &cy, ptile)) {
+ put_one_tile(mapview_canvas.store, ptile, cx, cy, FALSE);
+ }
+ } gui_rect_iterate_end;
/* Draw the goto lines on top of the whole thing. This is done last as
* we want it completely on top.
Index: client/mapview_common.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/mapview_common.h,v
retrieving revision 1.82
diff -u -r1.82 mapview_common.h
--- client/mapview_common.h 9 Dec 2004 21:28:53 -0000 1.82
+++ client/mapview_common.h 15 Dec 2004 08:12:08 -0000
@@ -181,8 +181,6 @@
void put_one_tile(struct canvas *pcanvas, struct tile *ptile,
int canvas_x, int canvas_y, bool citymode);
-void put_one_tile_iso(struct canvas *pcanvas, struct tile *ptile,
- int canvas_x, int canvas_y, bool citymode);
void tile_draw_grid(struct canvas *pcanvas, struct tile *ptile,
int canvas_x, int canvas_y, bool citymode);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] (PR#11525) merge put_one_tile,
Jason Short <=
|
|