Complete.Org: Mailing Lists: Archives: freeciv-dev: June 2004:
[Freeciv-Dev] Re: (PR#8959) remove CAR_DIR_D[XY]
Home

[Freeciv-Dev] Re: (PR#8959) remove CAR_DIR_D[XY]

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: jdorje@xxxxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#8959) remove CAR_DIR_D[XY]
From: "Gregory Berkolaiko" <Gregory.Berkolaiko@xxxxxxxxxxxxx>
Date: Sun, 20 Jun 2004 10:52:45 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=8959 >

On Sun, 20 Jun 2004, Jason Short wrote:

> <URL: http://rt.freeciv.org/Ticket/Display.html?id=8959 >
>
> Ross, you still haven't suggested a workable alternative.  It is not
> sufficient to say "almost any programmer could work this one out at a
> moment's need".  If you believe a better alternative is possible you
> should tell us what it is.

What Ross probably means is [skipping the flames here] if you do
adj_iterate by means of indexing into an array (as it is done now but the
ordering of the directions is a bit funny) then cart_iterate can be done
using the the same indices, but taking every second.  Even if you are in
iso-mode, it is still every second (maybe starting index is different).
If you are truly hex, it's every index.

So in all cases the iterations are controlled by three parameters: start
index, increment (e.g. "every second") and stop index. These parameters
can be relatively easily selected.

[I'm skipping some more flames here]

My opinion is that the pressure on the brains of present and future coders
might be too much for the benefit accrued.  As a compromise, I can suggest
implementing cart_iterate not as
adj_iterate() {
 if (not_cartesian) skip;

but as an exact copy of adj_iterate code with "if (not_cartesian) skip"
done right after "for()".  Instruction-wise this would be half-way
between the above and the perfect solution.

If the ordering of the directions is changed to rotational, the test for
cardinal-ness is just a test for even-ness (or odd-ness).

G.




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