Project

General

Profile

Bug #655 » 0001-cardinal_-adjc_-_iterate-use-given-map-s-dirlists.patch

S3_2, S3_1 - Alina Lenk, 05/21/2024 12:56 AM

View differences:

common/map.h
/* As adjc_iterate() but also set direction8 iterator variable dir_itr */
#define adjc_dir_iterate(nmap, center_tile, itr_tile, dir_itr) \
adjc_dirlist_iterate(nmap, center_tile, itr_tile, dir_itr, \
wld.map.valid_dirs, wld.map.num_valid_dirs)
(nmap)->valid_dirs, (nmap)->num_valid_dirs)
#define adjc_dir_iterate_end adjc_dirlist_iterate_end
/* Only set direction8 dir_itr (not tile) */
#define adjc_dir_base_iterate(nmap, center_tile, dir_itr) \
adjc_dirlist_base_iterate(nmap, center_tile, dir_itr, \
wld.map.valid_dirs, wld.map.num_valid_dirs)
(nmap)->valid_dirs, (nmap)->num_valid_dirs)
#define adjc_dir_base_iterate_end \
adjc_dirlist_base_iterate_end
......
* position. The order of positions is unspecified. */
#define cardinal_adjc_iterate(nmap, center_tile, itr_tile) \
adjc_dirlist_iterate(nmap, center_tile, itr_tile, _dir_itr##itr_tile, \
wld.map.cardinal_dirs, wld.map.num_cardinal_dirs)
(nmap)->cardinal_dirs, (nmap)->num_cardinal_dirs)
#define cardinal_adjc_iterate_end adjc_dirlist_iterate_end
/* As cardinal_adjc_iterate but also set direction8 variable dir_itr */
#define cardinal_adjc_dir_iterate(nmap, center_tile, itr_tile, dir_itr) \
adjc_dirlist_iterate(nmap, center_tile, itr_tile, dir_itr, \
wld.map.cardinal_dirs, wld.map.num_cardinal_dirs)
(nmap)->cardinal_dirs, (nmap)->num_cardinal_dirs)
#define cardinal_adjc_dir_iterate_end adjc_dirlist_iterate_end
/* Only set direction8 dir_itr (not tile) */
#define cardinal_adjc_dir_base_iterate(nmap, center_tile, dir_itr) \
adjc_dirlist_base_iterate(nmap, center_tile, dir_itr, \
wld.map.cardinal_dirs, wld.map.num_cardinal_dirs)
(nmap)->cardinal_dirs, (nmap)->num_cardinal_dirs)
#define cardinal_adjc_dir_base_iterate_end \
adjc_dirlist_base_iterate_end
......
for (; \
_tile##_index < (dircount); \
_tile##_index++) { \
_dir = dirlist[_tile##_index]; \
_dir = (dirlist)[_tile##_index]; \
DIRSTEP(_tile##_x, _tile##_y, _dir); \
_tile##_x += _tile##_cx; \
_tile##_y += _tile##_cy; \
......
for (; \
_tile##_index < (dircount); \
_tile##_index++) { \
_dir = dirlist[_tile##_index]; \
_dir = (dirlist)[_tile##_index]; \
DIRSTEP(_tile##_x, _tile##_y, _dir); \
_tile##_x += _center##_x; \
_tile##_y += _center##_y; \
(2-2/2)