Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2005:
[Freeciv-Dev] Re: (PR#12158) draw city outlines
Home

[Freeciv-Dev] Re: (PR#12158) draw city outlines

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] Re: (PR#12158) draw city outlines
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 9 Feb 2005 10:41:35 -0800
Reply-to: bugs@xxxxxxxxxxx

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

Mateusz Stefek wrote:
> <URL: http://bugs.freeciv.org/Ticket/Display.html?id=12158 >
> 
> City outlines cover enemy territory as seen in
> http://freeciv.org/~matusik/outlines.png
> This is wrong IMO

I'm not sure that I agree.  For instance when using settlers you want 
not only the full border of the settlers but also of all your cities, 
since any city the settlers founds will change the borders.

However here is a patch that changes it (not too hard).

-jason

Index: client/mapview_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/mapview_common.c,v
retrieving revision 1.182
diff -u -r1.182 mapview_common.c
--- client/mapview_common.c     9 Feb 2005 17:15:17 -0000       1.182
+++ client/mapview_common.c     9 Feb 2005 18:41:11 -0000
@@ -1417,6 +1417,23 @@
 }
 
 /****************************************************************************
+  Return TRUE if the tile is within the city radius of one of the player's
+  cities, and can be worked by the player.
+****************************************************************************/
+static bool player_workable_and_in_city_radius(const struct player *pplayer,
+                                              const struct tile *ptile)
+{
+  struct player *powner = map_get_owner(ptile);
+
+  /* Borders are considered but not units.  This function is intended to be
+   * used by the drawing code not the backend. */
+  if (powner && powner != pplayer) {
+    return FALSE;
+  }
+  return player_in_city_radius(pplayer, ptile);
+}
+
+/****************************************************************************
    Draw the map grid around the given map tile at the given canvas position.
 ****************************************************************************/
 static void tile_draw_map_grid(struct canvas *pcanvas,
@@ -1448,8 +1465,8 @@
       if (tile2
          && get_tile_boundaries(dir, 0, 1,
                                 &start_x, &start_y, &end_x, &end_y)) {
-       if (XOR(player_in_city_radius(game.player_ptr, ptile),
-               player_in_city_radius(game.player_ptr, tile2))) {
+       if (XOR(player_workable_and_in_city_radius(game.player_ptr, ptile),
+               player_workable_and_in_city_radius(game.player_ptr, tile2))) {
          color = COLOR_STD_WHITE;
        } else if ((pfocus = get_unit_in_focus())
                   && unit_flag(pfocus, F_CITIES)

[Prev in Thread] Current Thread [Next in Thread]