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

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

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: Core code cleanups [Was: Profiling Civserveragain]
From: Jason Dorje Short <jshort@xxxxxxxxxxxxx>
Date: Thu, 02 Aug 2001 14:16:49 -0400

Trent Piepho wrote:
> 
> On Thu, 2 Aug 2001, Jason Dorje Short wrote:
> >
> > I now realize that in this case I meant unreal (or non-real, invalid)
> > coordinates.
> 
> Oh, I see what you mean.  I think you can create an alternate version of the
> macro that handles this.  With my system of wrapping, it would look like this:

Actually, I was thinking of something more like

#define adjc_dir_all_iterate(x, y, x1, y1, dir)  \
{ int _border = is_border_tile(x, y), dir;       \
  for(dir=0; dir<8; dir++) {                     \
    int _valid = 1;                              \
    int x1 = x + DIR_DX2[dir];                   \
    int y1 = y + DIR_DY2[dir];                   \
    if (_border)                                 \
      _valid = normalize_map_pos(&x1, &y1);      \
    if (_valid) {                                \

#define adjc_all_iterate_invalid } else {

#define adjc_all_iterate_end  } } }

However, I don't really think this is necessary - the situations where
invalid directions are used are easily handled.

On a separate note, I really don't think your DIR_DX[type][dir] arrays
will work for a lot of wrapping systems that freeciv might like to use. 
We're better off just calling normalize_map_pos.

jason


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