Complete.Org: Mailing Lists: Archives: freeciv-dev: April 2003:
[Freeciv-Dev] Re: (PR#3948) don't send NODRAW tiles
Home

[Freeciv-Dev] Re: (PR#3948) don't send NODRAW tiles

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients:;
Subject: [Freeciv-Dev] Re: (PR#3948) don't send NODRAW tiles
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 13 Apr 2003 02:08:42 -0700
Reply-to: rt@xxxxxxxxxxxxxx

a-l@xxxxxxx wrote:
> On Mon, 7 Apr 2003 01:23:31 -0700
> "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx> wrote:
> 
>>The server sends extra tiles to the client - every unknown tile that is 
>>adjacent to a known tile will be sent.
> 
> I'm quite sure that info is also sent for unknown tiles that are
> adjacent to the tiles that are adjacent to unknown tiles, when
> you move a unit to explore.

I'm not quite sure what this means, but if you're saying that tile info 
may be duplicated then I agree with you.

Anyway, attached is the same patch but with a new capability.  I think 
it is ready for inclusion.

jason

Index: client/tilespec.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/tilespec.c,v
retrieving revision 1.117
diff -u -r1.117 tilespec.c
--- client/tilespec.c   2003/04/09 20:47:43     1.117
+++ client/tilespec.c   2003/04/13 09:05:47
@@ -1341,7 +1341,8 @@
   for (dir = 0; dir < 8; dir++) {
     int x1, y1;
 
-    if (MAPSTEP(x1, y1, map_x, map_y, dir)) {
+    if (MAPSTEP(x1, y1, map_x, map_y, dir)
+       && tile_get_known(x1, y1) != TILE_UNKNOWN) {
       tspecial_near[dir] = map_get_special(x1, y1);
       ttype_near[dir] = map_get_terrain(x1, y1);
 
@@ -1351,7 +1352,7 @@
        ttype_near[dir] = T_GRASSLAND;
       }
     } else {
-      /* We draw the edges of the map as if the same terrain just
+      /* We draw the edges of the (known) map as if the same terrain just
        * continued off the edge of the map. */
       tspecial_near[dir] = S_NO_SPECIAL;
       ttype_near[dir] = *ttype;
Index: common/capstr.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/capstr.c,v
retrieving revision 1.130
diff -u -r1.130 capstr.c
--- common/capstr.c     2003/04/04 15:47:48     1.130
+++ common/capstr.c     2003/04/13 09:05:47
@@ -77,7 +77,7 @@
 #define CAPABILITY "+1.14.0 conn_info +occupied team tech_impr_gfx " \
                    "city_struct_minor_cleanup obsolete_last class_legend " \
                    "+impr_req +waste +fastfocus +continent +small_dipl " \
-                   "+no_nation_selected"
+                   "+no_nation_selected +no_extra_tiles"
 /* "+1.14.0" is protocol for 1.14.0 release.
  *
  * "conn_info" is sending the conn_id field. To preserve compatability
@@ -115,6 +115,9 @@
  *
  * "no_nation_selected" means that -1 (NO_NATION_SELECTED) is used for
  * players who have no assigned nation (rather than MAX_NUM_NATIONS).
+ *
+ * "no_extra_tiles" means that the extra, unknown (NODRAW) tiles will not be
+ * sent to clients (previously used to help with drawing the terrain).
  */
 
 void init_our_capability(void)
Index: common/map.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/map.c,v
retrieving revision 1.137
diff -u -r1.137 map.c
--- common/map.c        2003/04/03 04:13:49     1.137
+++ common/map.c        2003/04/13 09:05:48
@@ -209,7 +209,6 @@
   ptile->special  = S_NO_SPECIAL;
   ptile->known    = 0;
   ptile->continent = 0;
-  ptile->sent     = 0;
   ptile->city     = NULL;
   unit_list_init(&ptile->units);
   ptile->worked   = NULL; /* pointer to city working tile */
Index: common/map.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/map.h,v
retrieving revision 1.143
diff -u -r1.143 map.h
--- common/map.h        2003/04/04 15:47:49     1.143
+++ common/map.h        2003/04/13 09:05:48
@@ -55,9 +55,6 @@
   unsigned int known;   /* A bitvector on the server side, an
                           enum known_type on the client side.
                           Player_no is index */
-  unsigned int sent;    /* Indicates if  the client know the tile
-                          as TILE_KNOWN_NODRAW. A bitvector like known.
-                          Not used on the client side. */
   int assigned; /* these can save a lot of CPU usage -- Syela */
   struct city *worked;      /* city working tile, or NULL if none */
   unsigned short continent;
Index: server/maphand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/maphand.c,v
retrieving revision 1.121
diff -u -r1.121 maphand.c
--- server/maphand.c    2003/04/12 18:24:42     1.121
+++ server/maphand.c    2003/04/13 09:05:50
@@ -47,12 +47,6 @@
                                                 int x, int y);
 static void send_tile_info_always(struct player *pplayer,
                                  struct conn_list *dest, int x, int y);
-static void send_NODRAW_tiles(struct player *pplayer,
-                             struct conn_list *dest, int x, int y, int len);
-static bool map_get_sent(int x, int y, struct player *pplayer);
-static void map_set_sent(int x, int y, struct player *pplayer);
-static void map_clear_sent(int x, int y, struct player *pplayer);
-static void set_unknown_tiles_to_unsent(struct player *pplayer);
 static void shared_vision_change_seen(int x, int y, struct player *pplayer, 
int change);
 static int map_get_seen(int x, int y, struct player *pplayer);
 static void map_change_own_seen(int x, int y, struct player *pplayer,
@@ -293,12 +287,6 @@
   int tiles_sent;
 
   if (!dest) dest = &game.game_connections;
-  
-  conn_list_iterate(*dest, pconn) {
-    if (pconn->player) {
-      set_unknown_tiles_to_unsent(pconn->player);
-    }
-  } conn_list_iterate_end;
 
   /* send whole map piece by piece to each player to balance the load
      of the send buffers better */
@@ -323,7 +311,6 @@
       if (!pplayer) {
        send_tile_info_always(pplayer, &pconn->self, x, y);
       } else if (map_get_known(x, y, pplayer)) {
-       send_NODRAW_tiles(pplayer, &pconn->self, x, y, 0);
        send_tile_info_always(pplayer, &pconn->self, x, y);
       }
     } conn_list_iterate_end;
@@ -489,7 +476,6 @@
   bool old_known = map_get_known(x, y, pplayer);
 
   freelog(LOG_DEBUG, "really unfogging %d,%d\n", x, y);
-  send_NODRAW_tiles(pplayer, &pplayer->connections, x, y, 0);
 
   map_set_known(x, y, pplayer);
 
@@ -554,24 +540,6 @@
 }
 
 /**************************************************************************
-  Send KNOWN_NODRAW tiles as required by pplayer, to specified connections.
-  We send only the unknown tiles around the square with length len.
-  pplayer must not be NULL.
-**************************************************************************/
-static void send_NODRAW_tiles(struct player *pplayer, struct conn_list *dest,
-                             int x, int y, int len)
-{
-  conn_list_do_buffer(dest);
-  square_iterate(x, y, len+1, abs_x, abs_y) {
-    if (!map_get_sent(abs_x, abs_y, pplayer)) {
-      send_tile_info_always(pplayer, dest, abs_x, abs_y);
-      map_set_sent(abs_x, abs_y, pplayer);
-    }
-  } square_iterate_end;
-  conn_list_do_unbuffer(dest);
-}
-
-/**************************************************************************
 ...
 **************************************************************************/
 static void really_fog_area(struct player *pplayer, int x, int y)
@@ -731,7 +699,6 @@
 
   freelog(LOG_DEBUG, "Showing %i,%i", x, y);
 
-  send_NODRAW_tiles(pplayer, &pplayer->connections, x, y, 0);
   if (!map_get_known_and_seen(x, y, pplayer)) {
     map_set_known(x, y, pplayer);
 
@@ -897,40 +864,6 @@
 }
 
 /***************************************************************
-...
-***************************************************************/
-static void map_set_sent(int x, int y, struct player *pplayer)
-{
-  map_get_tile(x, y)->sent |= (1u<<pplayer->player_no);
-}
-
-/***************************************************************
-...
-***************************************************************/
-static void map_clear_sent(int x, int y, struct player *pplayer)
-{
-  map_get_tile(x, y)->sent &= ~(1u<<pplayer->player_no);
-}
-
-/***************************************************************
-...
-***************************************************************/
-static bool map_get_sent(int x, int y, struct player *pplayer)
-{
-  return TEST_BIT(map_get_tile(x, y)->sent, pplayer->player_no);
-}
-
-/***************************************************************
-...
-***************************************************************/
-static void set_unknown_tiles_to_unsent(struct player *pplayer)
-{
-  whole_map_iterate(x, y) {
-    map_clear_sent(x, y, pplayer);
-  } whole_map_iterate_end;
-}
-
-/***************************************************************
   Allocate space for map, and initialise the tiles.
   Uses current map.xsize and map.ysize.
 ****************************************************************/
@@ -1047,7 +980,6 @@
       dest_tile->terrain = from_tile->terrain;
       dest_tile->special = from_tile->special;
       dest_tile->last_updated = from_tile->last_updated;
-      send_NODRAW_tiles(pdest, &pdest->connections, x, y, 0);
       send_tile_info_always(pdest, &pdest->connections, x, y);
        
       /* update and send city knowledge */
Index: server/savegame.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/savegame.c,v
retrieving revision 1.114
diff -u -r1.114 savegame.c
--- server/savegame.c   2003/02/17 22:49:28     1.114
+++ server/savegame.c   2003/04/13 09:05:51
@@ -392,12 +392,6 @@
 
 
   map.have_specials = TRUE;
-
-  /* Should be handled as part of send_all_know_tiles,
-     but do it here too for safety */
-  whole_map_iterate(x, y) {
-    map_get_tile(x, y)->sent = 0;
-  } whole_map_iterate_end;
 }
 
 /***************************************************************

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