[Freeciv-Dev] Re: the directional system
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
On Mon, Sep 10, 2001 at 06:06:45AM -0400, Jason Dorje Short wrote:
> Raimar Falke wrote:
>
> > In a lot of place we removed dependencies on the direction system. I'm
> > sure we will also solve this DIR_DX2 case. So we have code base which
> > is independent of the direction system. You than suggest we should
> > loose this flexibility because two methods can be expressed in a
> > simpler way. This will only happen if these method are moved to map.h
> > (or a new dir.h) and surrounded by a big fat comment telling that
> > these methods depend on a certain system. I would may be also add
> > extra runtime checks like "assert(DIR_DX[0])==0;..." to ensure that
> > the system will not change under our feets. But even then I'm not sure
> > if I would make these changes. dir_ok and straightest_direction can be
> > expressed in a way that is independent of the direction
> > system. However if you show a performance improvement of some amount
> > you may convince me. Thinking about this a bit more: the only current
> > code which should be treated in the way above mentioned (fat warning,
> > extra checks) is DIR_REVERSE.
>
> What Ross is suggesting is not that all of dir_ok and
> straightest_direction be moved into the map.h schema-dependent code. We
> are suggesting that additional macros such as DIR_NEXT and DIR_PREV be
> created. Of course, under the rotational system these are far easier to
> write (and, more importantly, maintain) than they are under the vertical
> system. Any other macros that are similarly needed will likely have
> similar properties.
>
> Personally, I don't care much about small inefficiencies in the code and
> it's not up to me to maintain it. It's obvious to me that the
> rotational system is better, but I'm confident that once we've converted
> all code to be schema-independent it is just a matter of time until a
> conversion to a better directional system is done.
>
> Or, as I said before: the rotational system is without doubt better than
> the vertical system. The only reason for not converting to the better
> system is that you don't think these differences are worth the time
> necessary to convert.
So we may have:
extern int _DIR_REVERSE[8],_DIR_PREV[8],_DIR_NEXT[8];
#define DIR_REVERSE(dir) (_DIR_REVERSE[dir])
...
The arrays are filled once at runtime. I like this since this will be
system independent.
BTW: NEXT and PREV aren't good names. CLOCKWISE and COUNTERCLOCKWISE
would be better.
Raimar
--
email: rf13@xxxxxxxxxxxxxxxxx
A supercomputer is a computer running an endless loop in just a second
- [Freeciv-Dev] Re: the directional system, (continued)
- [Freeciv-Dev] Re: the directional system, Ross W. Wetmore, 2001/09/10
- [Freeciv-Dev] Re: the directional system, Ross W. Wetmore, 2001/09/10
- [Freeciv-Dev] Re: the directional system, Thue, 2001/09/10
- [Freeciv-Dev] Re: the directional system, Ross W. Wetmore, 2001/09/10
- [Freeciv-Dev] Re: the directional system, Thue, 2001/09/11
- [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 <=
- [Freeciv-Dev] Re: the directional system, Ross W. Wetmore, 2001/09/10
- [Freeciv-Dev] Re: the directional system, Raimar Falke, 2001/09/11
- [Freeciv-Dev] Re: the directional system, Reinier Post, 2001/09/10
|
|