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]
To: jdorje@xxxxxxxxxxxxxxxxxxxxx
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: the directional system
From: Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 9 Sep 2001 12:18:21 +0200
Reply-to: rf13@xxxxxxxxxxxxxxxxxxxxxx

On Sun, Sep 09, 2001 at 06:00:07AM -0400, Jason Dorje Short wrote:
> Raimar Falke wrote:
> > 
> > On Sun, Sep 09, 2001 at 05:08:00AM -0400, Jason Dorje Short wrote:
> 
> > > #define DIR_ADJACENT(dir1, dir2) ((dir1+1)%8==dir2 || (dir2+1)%8==dir1)
> > >
> > > versus
> > >
> > > #define DIR_ADJACENT(dir1, dir2) \
> > >  ( dir1 == DIR8_NORTH  ? (dir2==DIR8_NORTHEAST || dir2==DIR8_NORTHWEST)
> > > :
> > >  ( dir1 == DIR8_NORTHEAST ? (dir2==DIR8_NORTH || dir2==DIR8_EAST) :
> > >  ( dir1 == DIR8_EAST ? (dir2==DIR8_NORTHEAST || dir2==DIR8_SOUTHEAST) :
> > >  ( dir1 == DIR8_SOUTHEAST ? (dir2=DIR8_EAST || dir2==DIR8_SOUTH) :
> > >  ( dir1 == DIR8_SOUTH ? (dir2==DIR8_SOUTHEAST || dir2==DIR8_SOUTHWEST) :
> > >  ( dir1 == DIR8_SOUTHWEST ? (dir2==DIR8_SOUTH || dir2==DIR8_WEST) :
> > >  ( dir1 == DIR8_WEST ? (dir2==DIR8_SOUTHWEST || dir2==DIR8_NORTHWEST) :
> > >  ( dir1 == DIR8_NORTHWEST ? (dir2==DIR8_WEST ||
> > > dir2==DIR8_NORTH)))))))))
> > 
> > $ grep -Ir DIR_ADJACENT .|wc -l
> >       0
> 
> No, there is not yet such a macro.  However dir_ok and
> straightest_direction use code very similar to this.  They are also
> incomprehensible.
> 
> > So I can't comment on this. The second DIR_ADJACENT looks more ugly
> > but the first one holds knowledge about the ordering.
> 
> If this macro were placed into map.h, it would be acceptable for it to
> hold knowledge about the ordering.

Ack.

> This is exactly what has already been done with DIR_IS_CARDINAL: the
> macro has been created but no simplifications are easily possible under
> the current directional system.  If the directional system were changed
> it would be possible to have more elegance and better efficiency in
> these macros.

So we have a trade off between elegance and efficiency and
independence of the underlying system.

> > > I really don't see how you can argue the rotational system isn't
> > > better.
> > 
> > Because the current non-rotational system is in place and works.
> 
> You are saying it's not worth the trouble to fix.

        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


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