13#ifndef FC__MAPGEN_UTILS_H
14#define FC__MAPGEN_UTILS_H
18#define MG_UNUSED mapgen_terrain_property_invalid()
42#define do_in_map_pos(nmap, ptile, nat_x, nat_y) \
44 struct tile *ptile = native_pos_to_tile(nmap, (nat_x), (nat_y)); \
47#define do_in_map_pos_end \
57#define axis_iterate(nmap, center_tile, _tile, _index, dist, is_X_axis) \
59 int _tile##_x, _tile##_y; \
61 const struct tile *_tile##_center = (center_tile); \
62 const bool _index##_axis = (is_X_axis); \
63 const int _index##_d = (dist); \
64 int _index = -(_index##_d); \
66 for (; _index <= _index##_d; _index++) { \
67 int _nat##_x, _nat##_y; \
68 index_to_native_pos(&_nat##_x, &_nat##_y, tile_index(_tile##_center)); \
69 _tile##_x = _nat##_x + (_index##_axis ? _index : 0); \
70 _tile##_y = _nat##_y + (_index##_axis ? 0 : _index); \
71 _tile = native_pos_to_tile(nmap, _tile##_x, _tile##_y); \
74#define axis_iterate_end \
82#define whole_map_iterate_filtered(_tile, pdata, pfilter) \
84 bool (*_tile##_filter)(const struct tile *vtile, const void *vdata) = (pfilter);\
85 const void *_tile##_data = (pdata); \
87 whole_map_iterate(&(wld.map), _tile) { \
88 if (NULL == _tile##_filter || (_tile##_filter)(_tile, _tile##_data)) {
90#define whole_map_iterate_filtered_end \
92 } whole_map_iterate_end; \
100 bool (*filter)(
const struct tile *ptile,
102#define adjust_int_map(int_map, int_map_min, int_map_max) \
103 adjust_int_map_filtered(int_map, int_map_min, int_map_max, \
105 (bool (*)(const struct tile *ptile, const void *data))NULL)
struct extra_type * pick_resource(const struct terrain *pterrain)
void smooth_int_map(int *int_map, bool zeroes_at_edges)
void set_all_ocean_tiles_placed(void)
void create_placed_map(void)
void(* tile_knowledge_cb)(struct tile *ptile)
void map_set_placed(struct tile *ptile)
void destroy_placed_map(void)
void adjust_int_map_filtered(int *int_map, int int_map_min, int int_map_max, void *data, bool(*filter)(const struct tile *ptile, const void *data))
bool not_placed(const struct tile *ptile)
struct terrain * pick_terrain_by_flag(enum terrain_flag_id flag)
void assign_continent_numbers(void)
void regenerate_lakes(void)
void set_placed_near_pos(struct tile *ptile, int dist)
void generator_free(void)
void smooth_water_depth(void)
bool placed_map_is_initialized(void)
bool is_normal_nat_pos(int x, int y)
struct terrain * pick_terrain(enum mapgen_terrain_property target, enum mapgen_terrain_property prefer, enum mapgen_terrain_property avoid)
struct terrain * most_shallow_ocean(bool frozen)
struct terrain * pick_ocean(int depth, bool frozen)
void map_unset_placed(struct tile *ptile)