[Freeciv-Dev] Re: Core code cleanups [Was: Profiling Civserveragain]
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
On Thu, 2 Aug 2001, Jason Dorje Short wrote:
> 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 } } }
That seems a lot more complex and none of the other iterator macros are like
that. And it requires that the code have two completely separate paths for
valid/invalid tiles. For instance:
adjc_all_iterate(x,y, x1, y1, dir, valid) {
do_something(x,y,dir);
if(valid) something_else(x1,y1);
} adjc_all_iterate_end;
.vs.
adjc_all_iterate(x,y, x1, y1, dir)
do_something(x,y,dir);
something_else(x1,y1);
adjc_all_iterate_invalid
do_something(x,y,dir);
adhc_all_iterate_end
Now if do_something() ends up being a dozen lines of code, it can make quite a
difference.
> 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.
I think the system can handle quite a few different types of map wrapping.
And once you add all those types of wrapping into normalize_map_pos(), it's
going to become a very complex function.
[Freeciv-Dev] Re: Core code cleanups, Ross W. Wetmore, 2001/08/01
Message not available[Freeciv-Dev] Re: Isometric maps, Lino Mastrodomenico, 2001/08/04
|
|