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: freeciv-dev@xxxxxxxxxxx (Freeciv developers)
Subject: [Freeciv-Dev] Re: semi-quick tile_is_known patch (and dicussion of memory bloat)
From: Reinier Post <rp@xxxxxxxxxx>
Date: Sat, 27 Oct 2001 21:00:23 +0200

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.

[...]

> 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]