Project

General

Profile

Feature #306 ยป 0024-Use-MAP_-NUM_-VALID-CARDINAL-_DIRS-where-applicable.patch

Marko Lindqvist, 03/13/2024 03:20 PM

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)
MAP_VALID_DIRS, MAP_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)
MAP_VALID_DIRS, MAP_NUM_VALID_DIRS)
#define adjc_dir_base_iterate_end \
#define adjc_dir_base_iterate_end \
adjc_dirlist_base_iterate_end
/* Iterate itr_tile through all map tiles cardinally adjacent to the given
* center map position, with normalization. Does not include the center
* 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)
#define cardinal_adjc_iterate(nmap, center_tile, itr_tile) \
adjc_dirlist_iterate(nmap, center_tile, itr_tile, _dir_itr##itr_tile, \
MAP_CARDINAL_DIRS, MAP_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)
MAP_CARDINAL_DIRS, MAP_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)
MAP_CARDINAL_DIRS, MAP_NUM_CARDINAL_DIRS)
#define cardinal_adjc_dir_base_iterate_end \
adjc_dirlist_base_iterate_end
server/generator/mapgen.c
connectable_river_around = FALSE;
ocean_around = FALSE;
for (k = 0; k < MAP_NUM_VALID_DIRS; k++) {
if (wld.map.valid_dirs[k] == DIR_REVERSE(MAP_VALID_DIRS[j])) {
if (MAP_VALID_DIRS[k] == DIR_REVERSE(MAP_VALID_DIRS[j])) {
continue;
}
    (1-1/1)