[Freeciv-Dev] (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] (PR#10168) add put_city() and put_terrain() | 
 
| 
From:  | 
"Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx> | 
 
| 
Date:  | 
Fri, 17 Sep 2004 13:35:41 -0700 | 
 
| 
Reply-to:  | 
rt@xxxxxxxxxxx | 
 
 
 
<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 depends on PR#10163.
jason
 diff -u client/mapview_common.c client/mapview_common.c
--- client/mapview_common.c     17 Sep 2004 08:12:01 -0000
+++ client/mapview_common.c     17 Sep 2004 20:33:14 -0000
@@ -837,6 +837,38 @@
                    count, drawn_sprites, FALSE);
 }
 
+/**************************************************************************
+  Draw the given unit onto the canvas store at the given location.
+**************************************************************************/
+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 unit onto the canvas store at the given location.
+**************************************************************************/
+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.
 
only in patch2:
unchanged:
--- client/mapview_common.h     15 Sep 2004 19:49:09 -0000      1.75
+++ client/mapview_common.h     17 Sep 2004 20:33:14 -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] (PR#10168) add put_city() and put_terrain(),
Jason Short <=
  
 
 | 
 |