Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2005:
[Freeciv-Dev] (PR#12265) make citymode a city pointer
Home

[Freeciv-Dev] (PR#12265) make citymode a city pointer

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#12265) make citymode a city pointer
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 15 Feb 2005 10:05:28 -0800
Reply-to: bugs@xxxxxxxxxxx

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

This patch turns the boolean citymode parameter into a city structure. 
It's pretty straightforward since in many cases the two are still 
interchangable.  Nobody uses the city value...yet.

-jason

Index: client/citydlg_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/citydlg_common.c,v
retrieving revision 1.60
diff -u -r1.60 citydlg_common.c
--- client/citydlg_common.c     4 Feb 2005 02:12:32 -0000       1.60
+++ client/citydlg_common.c     15 Feb 2005 18:02:59 -0000
@@ -176,7 +176,7 @@
   mapview_layer_iterate(layer) {
     citydlg_known_iterate(pcity, city_x, city_y,
                          ptile, canvas_x, canvas_y) {
-      put_one_tile(pcanvas, layer, ptile, canvas_x, canvas_y, TRUE);
+      put_one_tile(pcanvas, layer, ptile, canvas_x, canvas_y, pcity);
     } citydlg_known_iterate_end;
   } mapview_layer_iterate_end;
 
Index: client/mapview_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/mapview_common.c,v
retrieving revision 1.189
diff -u -r1.189 mapview_common.c
--- client/mapview_common.c     14 Feb 2005 17:52:56 -0000      1.189
+++ client/mapview_common.c     15 Feb 2005 18:03:00 -0000
@@ -60,6 +60,10 @@
 static void dirty_overview(void);
 static void flush_dirty_overview(void);
 
+static void tile_draw_grid(struct canvas *pcanvas, const struct tile *ptile,
+                          int canvas_x, int canvas_y,
+                          const struct city *citymode);
+
 enum update_type {
   /* Masks */
   UPDATE_NONE = 0,
@@ -919,7 +923,8 @@
                            const struct tile_edge *pedge,
                            const struct tile_corner *pcorner,
                            const struct unit *punit, struct city *pcity,
-                           int canvas_x, int canvas_y, bool citymode)
+                           int canvas_x, int canvas_y,
+                           const struct city *citymode)
 {
   struct drawn_sprite tile_sprs[80];
   int count = fill_sprite_array(tile_sprs, layer, ptile, pedge, pcorner,
@@ -941,7 +946,7 @@
   canvas_y += (UNIT_TILE_HEIGHT - NORMAL_TILE_HEIGHT);
   mapview_layer_iterate(layer) {
     put_one_element(pcanvas, layer, NULL, NULL, NULL,
-                   punit, NULL, canvas_x, canvas_y, FALSE);
+                   punit, NULL, canvas_x, canvas_y, NULL);
   } mapview_layer_iterate_end;
 }
 
@@ -956,7 +961,7 @@
   mapview_layer_iterate(layer) {
     put_one_element(pcanvas, layer,
                    NULL, NULL, NULL, NULL, pcity,
-                   canvas_x, canvas_y, FALSE);
+                   canvas_x, canvas_y, NULL);
   } mapview_layer_iterate_end;
 }
 
@@ -972,7 +977,7 @@
   canvas_y += (UNIT_TILE_HEIGHT - NORMAL_TILE_HEIGHT);
   mapview_layer_iterate(layer) {
     put_one_element(pcanvas, layer, ptile, NULL, NULL, NULL, NULL,
-                   canvas_x, canvas_y, FALSE);
+                   canvas_x, canvas_y, NULL);
   } mapview_layer_iterate_end;
 }
 
@@ -1537,8 +1542,9 @@
    Draw the grid lines of the given map tile at the given canvas position
    in isometric view.  (This include the map grid, borders, and coastline).
 ****************************************************************************/
-void tile_draw_grid(struct canvas *pcanvas, const struct tile *ptile,
-                   int canvas_x, int canvas_y, bool citymode)
+static void tile_draw_grid(struct canvas *pcanvas, const struct tile *ptile,
+                          int canvas_x, int canvas_y,
+                          const struct city *citymode)
 {
   tile_draw_map_grid(pcanvas, ptile, canvas_x, canvas_y);
   tile_draw_borders(pcanvas, ptile, canvas_x, canvas_y);
@@ -1550,8 +1556,8 @@
   Draw some or all of a tile onto the canvas.
 **************************************************************************/
 void put_one_tile(struct canvas *pcanvas, enum mapview_layer layer,
-                 struct tile *ptile,
-                 int canvas_x, int canvas_y, bool citymode)
+                 struct tile *ptile, int canvas_x, int canvas_y,
+                 const struct city *citymode)
 {
   if (tile_get_known(ptile) != TILE_UNKNOWN) {
     put_one_element(pcanvas, layer, ptile, NULL, NULL,
@@ -1621,13 +1627,13 @@
                     height + (is_isometric ? (NORMAL_TILE_HEIGHT / 2) : 0),
                     ptile, pedge, pcorner, cx, cy) {
       if (ptile) {
-       put_one_tile(mapview.store, layer, ptile, cx, cy, FALSE);
+       put_one_tile(mapview.store, layer, ptile, cx, cy, NULL);
       } else if (pedge) {
        put_one_element(mapview.store, layer, NULL, pedge, NULL,
-                       NULL, NULL, cx, cy, FALSE);
+                       NULL, NULL, cx, cy, NULL);
       } else if (pcorner) {
        put_one_element(mapview.store, layer, NULL, NULL, pcorner,
-                       NULL, NULL, cx, cy, FALSE);
+                       NULL, NULL, cx, cy, NULL);
       } else {
        /* This can happen, for instance for unreal tiles. */
       }
Index: client/mapview_common.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/mapview_common.h,v
retrieving revision 1.93
diff -u -r1.93 mapview_common.h
--- client/mapview_common.h     14 Feb 2005 17:52:56 -0000      1.93
+++ client/mapview_common.h     15 Feb 2005 18:03:00 -0000
@@ -251,10 +251,8 @@
 void put_nuke_mushroom_pixmaps(struct tile *ptile);
 
 void put_one_tile(struct canvas *pcanvas, enum mapview_layer layer,
-                 struct tile *ptile,
-                 int canvas_x, int canvas_y, bool citymode);
-void tile_draw_grid(struct canvas *pcanvas, const struct tile *ptile,
-                   int canvas_x, int canvas_y, bool citymode);
+                 struct tile *ptile, int canvas_x, int canvas_y,
+                 const struct city *citymode);
 
 void update_map_canvas(int canvas_x, int canvas_y, int width, int height);
 void update_map_canvas_visible(void);
Index: client/tilespec.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/tilespec.c,v
retrieving revision 1.236
diff -u -r1.236 tilespec.c
--- client/tilespec.c   13 Feb 2005 19:09:05 -0000      1.236
+++ client/tilespec.c   15 Feb 2005 18:03:01 -0000
@@ -2759,7 +2759,7 @@
                      const struct tile_edge *pedge,
                      const struct tile_corner *pcorner,
                      const struct unit *punit, const struct city *pcity,
-                     bool citymode)
+                     const struct city *citymode)
 {
   Terrain_type_id ttype, ttype_near[8];
   enum tile_special_type tspecial, tspecial_near[8];
@@ -3196,7 +3196,8 @@
 /**********************************************************************
 ...
 ***********************************************************************/
-struct unit *get_drawable_unit(struct tile *ptile, bool citymode)
+struct unit *get_drawable_unit(struct tile *ptile,
+                              const struct city *citymode)
 {
   struct unit *punit = find_visible_unit(ptile);
   struct unit *pfocus = get_unit_in_focus();
Index: client/tilespec.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/tilespec.h,v
retrieving revision 1.103
diff -u -r1.103 tilespec.h
--- client/tilespec.h   13 Feb 2005 19:09:05 -0000      1.103
+++ client/tilespec.h   15 Feb 2005 18:03:01 -0000
@@ -63,7 +63,7 @@
 
     struct {
       const struct tile *tile;
-      bool citymode;
+      const struct city *citymode;
     } grid;
 
     struct {
@@ -133,7 +133,7 @@
                      const struct tile_edge *pedge,
                      const struct tile_corner *pcorner,
                      const struct unit *punit, const struct city *pcity,
-                     bool citymode);
+                     const struct city *citymode);
 
 enum color_std player_color(const struct player *pplayer);
 enum color_std overview_tile_color(struct tile *ptile);
@@ -141,7 +141,8 @@
 double get_focus_unit_toggle_timeout(void);
 void reset_focus_unit_state(void);
 void toggle_focus_unit_state(void);
-struct unit *get_drawable_unit(struct tile *ptile, bool citymode);
+struct unit *get_drawable_unit(struct tile *ptile,
+                              const struct city *citymode);
 
 
 /* This the way directional indices are now encoded: */

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#12265) make citymode a city pointer, Jason Short <=