[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]
<URL: http://rt.freeciv.org/Ticket/Display.html?id=8959 >
Gregory Berkolaiko wrote:
> <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.
Jason, this shows you clearly read neither previous postings, documentation
nor code. If you won't read the suggestions typing them every time isn't
going to help a lot more. So please stop the useless flame war comments and
try to restrict yourself to and work on understanding of technical issues as
Greg suggests. If others can so can you.
> 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.
And as you recognize next, inserting a filter or transformation in addition
to index increment and length done either as code (ugh) or data lookup (!),
but a macro or two can easily be expanded to either or coded as a nullop, is
a trivial way to augment the basic iterator for almost any needs. It is a
rather feeble brain stretch for most I would hope over the monolithic hacks
of random pieces of iterator code being added all over the place, all of
which will probably need to be tweaked for different topologies over time.
Again, most of this is in the (now 3 year old corecleanups patches) with a
bit more extensive flavour in the mapgen standalone program for core map
iterators along with extra documentation to help programmers that need to
modify this and comments that normal developers just need to use the
iterators according to the published API (ignoring brain wrenching details
that the three or 4 lines of core code causes such people).
> 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.
Feel free to recode and rename for NIH purposes. You might want to try to
understand what the current names actually mean and do to help you get the
revised version not too far off the actual meaning.
> 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).
The base order is actually more for convenience than rotational and can be
altered at will with no effect other than on the rearrangement of the incs,
filters and transforms that depend on some initial pick, but it turns out
that walking around the base tile in a circular manner is a little more
convenient and understandable than tiling or picking some random list order.
> G.
Cheers,
RossW
=====
- [Freeciv-Dev] Re: (PR#8959) remove CAR_DIR_D[XY], rwetmore@xxxxxxxxxxxx, 2004/06/11
- [Freeciv-Dev] Re: (PR#8959) remove CAR_DIR_D[XY], Jason Short, 2004/06/11
- [Freeciv-Dev] Re: (PR#8959) remove CAR_DIR_D[XY], rwetmore@xxxxxxxxxxxx, 2004/06/13
- [Freeciv-Dev] Re: (PR#8959) remove CAR_DIR_D[XY], Jason Short, 2004/06/13
- [Freeciv-Dev] Re: (PR#8959) remove CAR_DIR_D[XY], Jason Short, 2004/06/20
- [Freeciv-Dev] Re: (PR#8959) remove CAR_DIR_D[XY], Gregory Berkolaiko, 2004/06/20
- [Freeciv-Dev] Re: (PR#8959) remove CAR_DIR_D[XY],
rwetmore@xxxxxxxxxxxx <=
- [Freeciv-Dev] Re: (PR#8959) remove CAR_DIR_D[XY], Jason Short, 2004/06/21
- [Freeciv-Dev] Re: (PR#8959) remove CAR_DIR_D[XY], Gregory Berkolaiko, 2004/06/22
- [Freeciv-Dev] Re: (PR#8959) remove CAR_DIR_D[XY], Jason Short, 2004/06/22
- [Freeciv-Dev] Re: (PR#8959) remove CAR_DIR_D[XY], Jason Short, 2004/06/22
- [Freeciv-Dev] Re: (PR#8959) remove CAR_DIR_D[XY], rwetmore@xxxxxxxxxxxx, 2004/06/23
- [Freeciv-Dev] (PR#8959) remove CAR_DIR_D[XY], Marcelo Burda, 2004/06/30
|
|