[Freeciv-Dev] (PR#7304) iso-map support for mapgen
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://rt.freeciv.org/Ticket/Display.html?id=7304 >
Hi,
The new layer are to make less bug prone code and more clear to read
than code usein native_to_map_pos(), this layer create and initialize
the new vars then, if needed convert back the values to the original
coordinate.
This solve some bad coding styles problems as native_to_map_pos(&x, &y,
x, y);
int nat_x = value;
int nat_y = value;
do_in_map_pos( nat_x, nat_y, map_x, map_y) {
/* use and modifie map_? */
} end_do_in_map_pos( nat_x, nat_y, map_x, map_y);
/* there the nat_? Are actualized */
or if we not need copy back value of map_?
do_in_map_pos(nat_x_value, nat_y_value, map_x, map_y) {
/* use the initialized map_? Var */
} do_in_map_pos_end;
/* map_? Vars are no more defined and values lost */
I use at second place in args the names to be create AS in ITERATORS not
at first place as you! If you change it i need change all of my code in
extended topologies(#7287) and in quincuncial (more 200k !)
I see you use some map_to_native_pos(), this is rarely needed to be
used directly! If you define (as me) a do_in_native_pos layer too. But
pleas make args of layers as in iterators!!
Marcelo
#define do_in_map_pos(nat_x, nat_y, map_x, map_y) \
{ \
int map_x, map_y; \
native_to_map_pos(&(map_x), &(map_y), (nat_x), (nat_y));
#define do_in_map_pos_end \
}
#define end_do_in_map_pos(nat_x, nat_y, map_x, map_y) \
map_to_native_pos(&(nat_x), &(nat_y), (map_x), (map_y));\
}
#define do_in_native_pos( map_x, map_y, nat_x, nat_y) \
{ \
int nat_x, nat_y; \
map_to_native_pos(&(nat_x), &(nat_y), (map_x), (map_y));
#define do_in_native_pos_end \
}
#define end_do_in_native_pos( map_x, map_y, nat_x, nat_y) \
native_to_map_pos(&(map_x), &(map_y), (nat_x), (nat_y));\
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] (PR#7304) iso-map support for mapgen,
Marcelo Burda <=
|
|