Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2001:
[Freeciv-Dev] Re: the directional system
Home

[Freeciv-Dev] Re: the directional system

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: the directional system
From: Jason Dorje Short <jshort@xxxxxxxxxxxxx>
Date: Wed, 12 Sep 2001 16:09:04 -0400

Raimar Falke wrote:
> 
> On Mon, Sep 10, 2001 at 12:43:03PM +0200, Raimar Falke wrote:
> > On Mon, Sep 10, 2001 at 06:33:48AM -0400, Jason Dorje Short wrote:

> > > >  - get rid of this problem: change the way the road and rail graphics
> > > >  are handled. Instead of indexes use symbolic names. Change
> > > >  11, 1, "r.road0"
> > > >  11, 2, "r.road1"
> > > > to
> > > >  11, 1, "r.road_n"
> > > >  11, 2, "r.road_ne"
> > > > and
> > > >       struct Sprite *dir[8];
> > > > to
> > > >       struct { struct Sprite *n,*nw,*ne,....;} iso;
> > > >
> > > > in struct named_sprites.{road,rail}. This may include some extra work
> > > > but leave us with less problems in the long run.
> > >
> > > This is a far better solution.  It makes things easier to write and
> > > understand.  It may be wise to allow either "n" or "north" to be used
> > > interchangably for the symbolic name.
> >
> > Who makes the patch?
> 
> I made it. Objections?

I think you should keep the loop in tilespec.c rather than hard-coding
all 8 directions.  Something like:

    for (dir=0; dir<8; dir++) {
      my_snprintf(buffer, sizeof(buffer), "r.road%s",
get_dir_name(dir));
      SET_SPRITE(road.dir[dir], buffer);
      my_snprintf(buffer, sizeof(buffer), "r.rail%s",
get_dir_name(dir));
      SET_SPRITE(rail.dir[dir], buffer);
    }

The only problem is that get_dir_name returns a capitalized name. 
However I think it'd be better to change get_dir_name, write a new
function that does lowercase, or use uppercase for the sprite names than
hard-code this loop.

Other than that it looks good.

jason


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