Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2001:
[Freeciv-Dev] Re: proposal for minor change in tilespec.c, map.c
Home

[Freeciv-Dev] Re: proposal for minor change in tilespec.c, map.c

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Reinier Post <rp@xxxxxxxxxx>
Cc: Freeciv developers <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] Re: proposal for minor change in tilespec.c, map.c
From: Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 28 Aug 2001 10:41:47 +0200
Reply-to: rf13@xxxxxxxxxxxxxxxxxxxxxx

On Tue, Aug 28, 2001 at 09:51:11AM +0200, Reinier Post wrote:
> On Mon, Aug 27, 2001 at 10:45:40AM -0500, Mike Kaufman wrote:
> > 
> > in my quest for smaller code base and greater maintainability, I would
> > like to get rid of tilespec.c from civworld/ and use the original one in
> > client/
> > 
> > The main reason I want to do this is that I need to make approx 150 bytes
> > of changes to a 50k file.
> > 
> > The issue: unfortuately for me, "ptile->known" is used for different
> > things in the client and in the server. I need to use them both. A way to
> > do this in tilespec.c without copying and changing it is to hijack
> > tile_is_known().
> 
> Just a general remark: isn't the proper way to handle this a separation
> of client-specific and server-specific fields in the common/ structs?
> E.g. you could have a struct tile, struct client_tile and struct
> server_tile where the latter two would share, or point to, the former.

I think this is a good idea. Here is a part of some old patch:

diff -ruN -X freeciv/diff_ignore freeciv/common/player.h 
freeciv.mod2/common/player.h
--- freeciv/common/player.h     Wed Sep  6 23:41:16 2000
+++ freeciv.mod2/common/player.h        Wed Jan 17 11:24:13 2001
@@ -152,12 +152,17 @@
   int future_tech;
   struct player_ai ai;
   int is_connected;                   /* observers don't count */
-  struct connection *current_conn;     /* non-null while handling packet */
   struct conn_list connections;               /* will replace conn */
   struct worklist worklists[MAX_NUM_WORKLISTS];
   struct player_tile *private_map;
   unsigned int gives_shared_vision; /* bitvector those that give you shared 
vision */
   unsigned int really_gives_vision; /* takes into account that p3 may see what 
p1 has via p2 */
+
+  /*
+   * SERVER ONLY: the values of the following variables are
+   * meaningless on the client.
+   */
+  struct connection *current_conn;     /* non-null while handling packet */
 };

 void player_init(struct player *plr);

I have also attached another one were I started this. I think the idea
is worth persuading.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 "Are you saying that you actually used the Classpath Java AWT classes in 
  addition to the GTK peers and got them to display something?
  Wow.  That's way better than I did and I wrote the code!"
    -- Aaron M. Renn in the classpath mailing list

Attachment: struct_reordering
Description: Text document


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