Complete.Org: Mailing Lists: Archives: freeciv-dev: October 2001:
[Freeciv-Dev] Re: semi-quick tile_is_known patch (and dicussion of memor
Home

[Freeciv-Dev] Re: semi-quick tile_is_known patch (and dicussion of memor

[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: semi-quick tile_is_known patch (and dicussion of memory bloat)
From: Mike Kaufman <mkaufman@xxxxxxxxxxxxxx>
Date: Sat, 27 Oct 2001 19:29:42 -0500

On Sat, Oct 27, 2001 at 09:00:23PM +0200, Reinier Post wrote:
> On Sat, Oct 27, 2001 at 11:07:26AM -0500, Mike Kaufman wrote:
> 
> > The Problem: civworld uses both---at the same time. Since it is now a
> > scenario editor, you can create multiple players each with different
> > knowledge of the map. so you need ptile->known as a bit vector, but it
> > also draws to a gui, so you need ptile->known as an enum known_type.
> 
> Seems like a case of a common data item that shouldn't be common.
> 
> > Solutions: 
> 
> [...]
> > 
> > 4. do what Reiner suggests in the thread above. create 
> >    struct client_tile and struct server_tile and put shared fields in a 
> >    struct tile.
> 
> I really think this is the only proper way to do it.
> The data structures in common/ should really represent the data
> that the server shares with the clients.

hmm, maybe you could give me your thinking on how to actually implement
this. I may not be envisioning well, but as I think about it, I'm
thinking that civworld would get totally screwed over by this. (ok,
maybe not _totally_)

so are you thinking about 2 new structs in map.h or new files
client/climap.[ch] and server/sermap.[ch]?

-mike

> 
> [...]
> 
> > For 4, this is probably the best in the long run, as it would save
> > memory and all the aformentioned problems. I notice now as I'm looking
> > and the tile struct that "unsigned sent" and "int assigned" are not used
> > in the client, _and_ ptile->worked is allocated as a struct city when it
> > seems that all the clients do is check if it's NULL?
> 
> Yes, that kind of thing seems to happen everywhere, please don't feel
> obliged to be holier than the rest of the coders here.
> 
> > (That can't be
> > right) so already, the client is allocating a lot more memory
> > than it really needs to.
> 
> Only because adding a new field to a common/ struct is usually
> easier than setting up a new data structure ...
> 
> > -mike
> 
> -- 
> Reinier


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