Complete.Org:
Mailing Lists:
Archives:
freeciv-dev:
September 2003: [Freeciv-Dev] (PR#6321) is_border_map_pos for iso-maps |
![]() |
[Freeciv-Dev] (PR#6321) is_border_map_pos for iso-maps[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
is_border_map_pos doesn't work as-is for iso-maps. The easiest way to "fix" it is just to always return TRUE for iso-maps. This slows things down a bit (for iso-maps only), but that's okay. Giving a correct implementation is a bit uglier (remember native coordinates are compressed 2x in the X direction). Something like (topo_has_flag(TF_ISO) ? (map_to_native_x(x, y) < 2 * dist || map_to_native_x(x, y) >= map.xsize - 2 * dist || map_to_native_y(x, y) < dist || map_to_native_y(x, y) >= map.ysize - dist) : (...)) which may not be faster at all, depending on optimizations. This can wait until later. Perhaps it would be written simpler as #define X_FACTOR (topo_has_flag(TF_ISO) ? 2 : 1) #define Y_FACTOR 1 #define IS_BORDER_MAP_POS(x, y) (map_to_native_x(x, y) < X_FACTOR * dist || map_to_native_x(x, y) >= map.xsize - X_FACTOR * dist || map_to_native_y(x, y) < Y_FACTOR * dist || map_to_native_y(x, y) >= map.ysize - Y_FACTOR * dist) Either way, it can wait until later. jason Index: common/map.h =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/map.h,v retrieving revision 1.154 diff -u -r1.154 map.h --- common/map.h 2003/09/23 19:47:22 1.154 +++ common/map.h 2003/09/29 13:48:26 @@ -309,9 +309,12 @@ * A "border position" is any one that _may have_ positions within * map distance dist that are non-normal. To see its correctness, * consider the case where dist is 1 or 0. + * + * TODO: implement this for iso-maps. */ #define IS_BORDER_MAP_POS(x, y, dist) \ - ((x) < (dist) || (x) >= map.xsize - (dist) \ + (topo_has_flag(TF_ISO) \ + || (x) < (dist) || (x) >= map.xsize - (dist) \ || (y) < (dist) || (y) >= map.ysize - (dist)) bool normalize_map_pos(int *x, int *y);
|