Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2001:
[Freeciv-Dev] Re: Core code cleanups [Was: Profiling Civserver again]
Home

[Freeciv-Dev] Re: Core code cleanups [Was: Profiling Civserver again]

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: "Ross W. Wetmore" <rwetmore@xxxxxxxxxxxx>
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: Core code cleanups [Was: Profiling Civserver again]
From: Jason Dorje Short <jshort@xxxxxxxxxxxxx>
Date: Wed, 01 Aug 2001 23:04:05 -0400

"Ross W. Wetmore" wrote:
> 
> Attached is the diff patch from Jul29 to my current playground that fixes
> some of the issues raised below, and may get things over the first hump
> if you are still gung-ho for tackling some of this. If we converge to a
> common patch base, I can pitch in as well as I have a number of things
> partway along this path.

I seem to have duplicated a lot of this work :-( in converting the code
to entirely use the DIR_D[XY]2 directions with the adcj_dir_iterate
macro.

Obviously nothing's going to be done with this before 1.12.0.  I'll try
to merge our work, and see what comes of it.


--- Technical details ---

Most or all of the work I did was trivial, I remember only about three
tricky parts:

1.  128>>dir is intended as 1<<reverse_dir(dir).

2.  There are some loops that have alternate code for non-normal cases,
which won't work under the macro.  These were inevitably one-liners, and
could be solved by pre-setting the values using memcpy, memset, or a
simple for loop.

3.  A very few places in the code use specific values.  Here the best
solution IMO is to convert to an enumeration ASAP - then changing the
enumeration will cause these to fall into place.  In particular, the
dir_ok function uses specific values (and can also be written much
shorter using the DIR_DX2 directions), and the client has several checks
for (dir == NN) that are special cases for tile drawing.

Of course, many of the loops are adjusting the same data and so must be
converted to the "new" directional system together to work.  However,
everything does seem to work...


jason short


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