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: rf13@xxxxxxxxxxxxxxxxxxxxxx
Cc: jdorje@xxxxxxxxxxxxxxxxxxxxx, "Ross W. Wetmore" <rwetmore@xxxxxxxxxxxx>, freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: the directional system
From: Jason Dorje Short <jshort@xxxxxxxxxxxxx>
Date: Sun, 09 Sep 2001 03:39:51 -0400
Reply-to: jdorje@xxxxxxxxxxxxxxxxxxxxx

Raimar Falke wrote:

> I still don't understand it. DIR_DX2 is only used in one method. Why
> not just convert this and be fine (at least as an immediate step) with
> one system. Why to switch all over to the DIR_DX2 system? Why is the
> DIR_DX2 inferior to the DIR_DX system (not the naming but the
> ordering)?

The problem is the DIR_DX2 "rotational" system is superior to the DIR_DX
"vertical" system: easier to code with, more efficient for most
algorithms, and all-around more understandable.  (For a more detailed
explanation ask Ross.)

Thus, it would be desirable to convert the DIR_DX arrays and ALL FreeCiv
code to use the "rotational" system.  But, this isn't possible to do
immediately because there is a huge amount of code that may or may not
assume it's using the current "vertical" system.

So, our goal is to whittle down this huge amount of code.  First we will
find all of the obvious spots where "magic" code is used.  Then we will
do some hard-core testing and close reviews of existing code.  Finally
the switch may be made.

My plan was/is to wait until we can convert all code at once.  Thus, one
of the first steps is to get rid of the DIR_DX2 arrays entirely so that
there's just one system.  Ross thinks it would be more efficient to
convert a piece at a time, so as part of his "corecleanup" patches he
has converted almost all of the core code to use the DIR_DX2 arrays
(with "rotational" system) while leaving the GUI and perhaps other code
with the DIR_DX arrays (with "vertical" system).  The biggest problem I
see with this is that it's very difficult to tell when code overlaps
because "dir" is passed around so frequently in function calls.  I also
think it duplicates work because you have to reintroduce the "magic"
code to the regions that still use the old system.  Ross, on the other
hand, believes that by doing it piece-by-piece you are better able to
isolate the changes for testing/review, and you can go ahead and start
getting the benefits of the new directional system right away.

In summary, we all want to use the "rotational" system but disagree as
to how to best do the conversion.

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.

jason


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