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: Thue <thue@xxxxxxx>
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: the directional system
From: "Ross W. Wetmore" <rwetmore@xxxxxxxxxxxx>
Date: Mon, 10 Sep 2001 01:28:53 -0400

At 12:33 PM 01/09/09 +0200, Thue wrote:
>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.

DIR_REVERSE(dir) = (dir^4) doesn't strike me as any more difficult.

>­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.)

Raimar doen't like you to intuit knowledge frmm the values.

But try to do the same thing for the right and left cases, which should
be just as frequently needed and just as simple topologically.

And explain to me why the direction after 2 is 4 and the one after that
7 in a simple outward walk.

>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)

You haven't been looking at any patches submitted recently, obviously.

And you are making the same limiting assumption that because you can't
do anything more sophisticated in the current deadend system, that there
is no reason to change it, or look beyond its current application.

>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.

The simple fact that you chose a new system because it was more obvious
rather than use the existing array based system, which you could have
done in the same code since that is what the enums do should perhaps tell 
us something if we were listening at all?

>-Thue

Cheers,
RossW
=====




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