Complete.Org: Mailing Lists: Archives: freeciv-dev: August 1999:
[Freeciv-Dev] tilespec, and sprite pointers
Home

[Freeciv-Dev] tilespec, and sprite pointers

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] tilespec, and sprite pointers
From: David Pfitzner <dwp@xxxxxxxxxxxxxx>
Date: Fri, 20 Aug 1999 13:13:35 +1000 (EST)

David Pfitzner wrote:

> This is just a note that I'm currently working on "tilespec":
> a system where the list of graphics files in a tileset, and
> the contents and layout of each file, are given by a set of 
> "spec" files which are read by the freeciv client.

Sorry, I would post more information and preliminary patches
about this, but I've been working on it at home and haven't
had a chance to upload stuff yet...

In the meantime, there is a general coding issue with my
current patch I would like to mention.  

In current Freeciv, "sprites" are gui-dependent things, and 
should only appear in gui-dependent code.  However my current 
tilespec patch uses "struct Sprite*" in gui-indepedent code
as a pointer to an opaque type.  (Including in common/ code, 
to put sprite pointers in unit_type, tile_type and race 
structs, though of course only used in the client.)

I _think_ this is a reasonable thing to do.  It basically
assumes the gui-code will have something analogous to a 
"sprite", and either already has a "struct Sprite" (both the
Xaw and Gtk+ clients do, though the struct contents differ), 
or can wrap the appropriate data (or another pointer/index) 
up in a "struct Sprite" if necessary.

On the other hand one could consider this an unnecessary
imposition on the gui-code, and instead do something similar 
to currently, where sprites only appear in gui-code, and are 
referenced elsewhere as integer indices into the big 
tile_sprites array.

However I like the opaque pointer approach, as it makes some
things more convenient and simpler, and probably slightly more
efficient.  Also, and importantly, I think it will help to 
allow more functions and prototypes to be changed from 
gui-dependent to gui-independent, which would of course 
be good.

Any opinions?

Regards,
-- David

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