[Freeciv-Dev] Re: (PR#10168) add put_city() and put_terrain()
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: |
undisclosed-recipients: ; |
Subject: |
[Freeciv-Dev] Re: (PR#10168) add put_city() and put_terrain() |
From: |
"Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx> |
Date: |
Fri, 17 Sep 2004 13:47:59 -0700 |
Reply-to: |
rt@xxxxxxxxxxx |
<URL: http://rt.freeciv.org/Ticket/Display.html?id=10168 >
Jason Short wrote:
> <URL: http://rt.freeciv.org/Ticket/Display.html?id=10168 >
>
> This patch adds a put_city() and put_terrain() functions to
> mapview_common. These are needed by gui-ftwl. However there's no way
> to test them since gui-ftwl crashes claiming it's missing a theme.
This patch improves the function comments.
jason
? drawn_sprites.diff
? freeciv.spec
? ftwl.diff
? settler_recursion_crash
? client/tilespec.diff
Index: client/mapview_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/mapview_common.c,v
retrieving revision 1.147
diff -u -r1.147 mapview_common.c
--- client/mapview_common.c 17 Sep 2004 20:45:03 -0000 1.147
+++ client/mapview_common.c 17 Sep 2004 20:47:25 -0000
@@ -823,7 +823,8 @@
}
/**************************************************************************
- Draw the given unit onto the canvas store at the given location.
+ Draw the given unit onto the canvas store at the given location. The
+ area of drawing is UNIT_TILE_HEIGHT x UNIT_TILE_WIDTH.
**************************************************************************/
void put_unit(struct unit *punit,
struct canvas *pcanvas, int canvas_x, int canvas_y)
@@ -837,6 +838,41 @@
count, drawn_sprites, FALSE);
}
+/**************************************************************************
+ Draw the given city onto the canvas store at the given location. The
+ area of drawing is UNIT_TILE_HEIGHT x UNIT_TILE_WIDTH.
+**************************************************************************/
+void put_city(struct city *pcity,
+ struct canvas *pcanvas, int canvas_x, int canvas_y)
+{
+ struct drawn_sprite drawn_sprites[40];
+ int count = fill_sprite_array(drawn_sprites, -1, -1, NULL,
+ NULL, pcity, FALSE);
+
+ canvas_y += (UNIT_TILE_HEIGHT - NORMAL_TILE_HEIGHT);
+ put_drawn_sprites(pcanvas, canvas_x, canvas_y,
+ count, drawn_sprites, FALSE);
+}
+
+/**************************************************************************
+ 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
+ most tiles are not this tall).
+**************************************************************************/
+void put_terrain(int map_x, int map_y,
+ struct canvas *pcanvas, int canvas_x, int canvas_y)
+{
+ struct drawn_sprite drawn_sprites[40];
+ struct tile *ptile = map_get_tile(map_x, map_y);
+ int count = fill_sprite_array(drawn_sprites, map_x, map_y, ptile,
+ NULL, NULL, FALSE);
+
+ /* Use full tile height, even for terrains. */
+ canvas_y += (UNIT_TILE_HEIGHT - NORMAL_TILE_HEIGHT);
+ put_drawn_sprites(pcanvas, canvas_x, canvas_y,
+ count, drawn_sprites, FALSE);
+}
+
/****************************************************************************
Draw food, shield, and trade output values on the tile.
Index: client/mapview_common.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/mapview_common.h,v
retrieving revision 1.75
diff -u -r1.75 mapview_common.h
--- client/mapview_common.h 15 Sep 2004 19:49:09 -0000 1.75
+++ client/mapview_common.h 17 Sep 2004 20:47:25 -0000
@@ -142,6 +142,10 @@
void put_unit(struct unit *punit,
struct canvas *pcanvas, int canvas_x, int canvas_y);
+void put_city(struct city *pcity,
+ struct canvas *pcanvas, int canvas_x, int canvas_y);
+void put_terrain(int map_x, int map_y,
+ struct canvas *pcanvas, int canvas_x, int canvas_y);
void put_city_tile_output(struct city *pcity, int city_x, int city_y,
struct canvas *pcanvas,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] Re: (PR#10168) add put_city() and put_terrain(),
Jason Short <=
|
|