[Freeciv-Dev] Re: the directional system
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
At 12:26 PM 01/09/10 +0200, Raimar Falke wrote:
>On Mon, Sep 10, 2001 at 06:06:45AM -0400, Jason Dorje Short wrote:
[...]
>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.
Actually, since you are using macros, how you implement them is a matter
of changing a few lines of header code, and should not be a cause for
great debate or concern.
It is probably foolish to define arrays for either the rotational or
array based order reverse operations since they have a simple more
efficient expression implementation. Provided you aren't doing shared
object loads where you might mix systems with incompatible shared
objects and this will have otehr worse problems, this will work fine.
Filling arrays once at runtime is a recipe for disaster. Better to define
them at compile time as const objects and never have to worry about the
setup order etc.
For just next and previous (note next implies clockwise) or left and right
again in a rotational system the expression works well. But for an array
based system, the array is definitely the way to go.
Except, that you don't want to limit yourself to single steps. You really
want a DIR_LEFT(n, dir) and DIR_RIGHT(n, dir) where in fact you don't put
any limits on how many elements there are in the array. For the 2nd ring
outwards there are 16 elements, in a hexagonal map there are 6.
Again these are simple expressions in a rotational system, and the only
arrays needed are the primary ones for X and Y increments.
The array technique may be useful when more complex systems are tried
but there is no need to go overboard until it is needed - it is a good
fallback to have on the shelf though.
>BTW: NEXT and PREV aren't good names. CLOCKWISE and COUNTERCLOCKWISE
>would be better.
Not really. They are both too long when simpler choices exist. Unless
you want to go for CW and CCW.
> 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, 2001/09/10
- [Freeciv-Dev] Re: the directional system,
Ross W. Wetmore <=
- [Freeciv-Dev] Re: the directional system, Raimar Falke, 2001/09/11
- [Freeciv-Dev] Re: the directional system, Reinier Post, 2001/09/10
|
|