| [Freeciv-Dev] Re: (PR#3444) index_to_map_pos macro[Top] [All Lists][Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
 
 Gregory Berkolaiko wrote:
> The macro inverts the action of map_inx: extracts the map coordinates from 
> the index.  Also added are macros CHECK_INDEX (similar to CHECK_MAP_POS) 
> and MAX_INDEX for sanity checking and allocations.
> 
> I intend to adapt the PF code to use this and map_inx code shortly, so 
> please commit.
Unfortunately both of our patches had a hideous typo bug.
jason
 Index: common/map.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/map.h,v
retrieving revision 1.138
diff -u -r1.138 map.h
--- common/map.h        2003/02/17 12:54:23     1.138
+++ common/map.h        2003/02/19 23:19:11
@@ -231,7 +231,7 @@
 #define index_to_map_pos(pmap_x, pmap_y, index) \
   (CHECK_INDEX(index),                          \
    *(pmap_x) = (index) % map.xsize,             \
-   *(pmap_y) = (index) / map.ysize)
+   *(pmap_y) = (index) / map.xsize)
 
 #define DIRSTEP(dest_x, dest_y, dir)   \
 (    (dest_x) = DIR_DX[(dir)],         \
 
 |  |