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: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: the directional system
From: Thue <thue@xxxxxxx>
Date: Sun, 9 Sep 2001 12:33:23 +0200

On Sunday 09 September 2001 10:08, Raimar Falke wrote:
> > The DIR_DX2 system, by the way, was recently introduced to FreeCiv
> > by (IIRC) Thue.  But, he didn't get very far in converting FreeCiv
> > over to its use: it's only used in one place.
>
> Exactly. And even at this one place it provides no advantage. Thue?
>
>       Raimar

The advantages of the DIR_D[XY] arrays is:
-It is easy to find the opposite direction as (7-dir). This is the 
DIR_REVERSE macro.
­The first 3 directions are above the center, and the last 3 are below. 
So you could potentially optimize an iteration. (I don't know if this 
is used.)

Most uses of iterations don't case which of the adjacent tiles it uses, 
it just needs to be fed them all one at a time, so the unintuitive 
sequence doesn't do any harm there. (The fact that DIR_D[XY]2 is only 
used one place seems to support this argument)

The DIR_D[XY]2 was used that place because we actually needed to map 
array indices to their direction. Using the new "enum direction8" with 
DIR_D[XY] would be a cleaner solution here, and allow you to remove 
DIR_D[XY]2.

-Thue


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