[Freeciv-Dev] Re: the directional system
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
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.
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.
> > 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.
jason
- [Freeciv-Dev] Re: the directional system, (continued)
- [Freeciv-Dev] Re: the directional system, Ross W. Wetmore, 2001/09/07
- [Freeciv-Dev] Re: the directional system, Jason Dorje Short, 2001/09/08
- [Freeciv-Dev] Re: the directional system, Raimar Falke, 2001/09/09
- [Freeciv-Dev] Re: the directional system, Jason Dorje Short, 2001/09/09
- [Freeciv-Dev] Re: the directional system, Raimar Falke, 2001/09/09
- [Freeciv-Dev] Re: the directional system, Jason Dorje Short, 2001/09/09
- [Freeciv-Dev] Re: the directional system, Raimar Falke, 2001/09/09
- [Freeciv-Dev] Re: the directional system,
Jason Dorje Short <=
- [Freeciv-Dev] Re: the directional system, Raimar Falke, 2001/09/09
- [Freeciv-Dev] Re: the directional system, Thue, 2001/09/09
- [Freeciv-Dev] Re: the directional system, Ross W. Wetmore, 2001/09/10
- [Freeciv-Dev] Re: the directional system, Thue, 2001/09/09
- [Freeciv-Dev] Re: the directional system, Raimar Falke, 2001/09/09
- [Freeciv-Dev] Re: the directional system, Thue, 2001/09/09
- [Freeciv-Dev] Re: the directional system, Raimar Falke, 2001/09/10
- [Freeciv-Dev] Re: the directional system, Jason Dorje Short, 2001/09/10
- [Freeciv-Dev] Re: the directional system, Raimar Falke, 2001/09/10
- [Freeciv-Dev] Re: the directional system, Raimar Falke, 2001/09/12
|
|