13 #define MG_UNUSED mapgen_terrain_property_invalid()
29 enum mapgen_terrain_property prefer,
30 enum mapgen_terrain_property avoid);
39 #define do_in_map_pos(nmap, ptile, nat_x, nat_y) \
41 struct tile *ptile = native_pos_to_tile(nmap, (nat_x), (nat_y)); \
44 #define do_in_map_pos_end \
54 #define axis_iterate(nmap, center_tile, _tile, _index, dist, is_X_axis) \
56 int _tile##_x, _tile##_y; \
58 const struct tile *_tile##_center = (center_tile); \
59 const bool _index##_axis = (is_X_axis); \
60 const int _index##_d = (dist); \
61 int _index = -(_index##_d); \
63 for (; _index <= _index##_d; _index++) { \
64 int _nat##_x, _nat##_y; \
65 index_to_native_pos(&_nat##_x, &_nat##_y, \
66 tile_index(_tile##_center)); \
67 _tile##_x = _nat##_x + (_index##_axis ? _index : 0); \
68 _tile##_y = _nat##_y + (_index##_axis ? 0 : _index); \
69 _tile = native_pos_to_tile(nmap, _tile##_x, _tile##_y); \
70 if (nullptr != _tile) {
72 #define axis_iterate_end \
80 #define whole_map_iterate_filtered(_tile, pdata, pfilter) \
82 bool (*_tile##_filter)(const struct tile *vtile, const void *vdata) = \
84 const void *_tile##_data = (pdata); \
86 whole_map_iterate(&(wld.map), _tile) \
88 if (nullptr == _tile##_filter \
89 || (_tile##_filter)(_tile, _tile##_data)) {
91 #define whole_map_iterate_filtered_end \
94 whole_map_iterate_end; \
99 bool (*filter)(
const struct tile *ptile,
101 #define adjust_int_map(int_map, int_map_max) \
102 adjust_int_map_filtered( \
103 int_map, int_map_max, (void *) nullptr, \
104 (bool (*)(const struct tile *ptile, const void *data)) nullptr)
signed short Continent_id
int get_continent_size(Continent_id id)
Return size in tiles of the given continent (not ocean)
void smooth_int_map(int *int_map, bool zeroes_at_edges)
Apply a Gaussian diffusion filter on the map.
void map_set_placed(struct tile *ptile)
Mark tile terrain as placed.
bool not_placed(const struct tile *ptile)
Checks if land has not yet been placed on pmap at (x, y)
struct terrain * pick_ocean(int depth, bool frozen)
Picks an ocean terrain to match the given depth.
void create_placed_map()
Create a clean pmap.
void adjust_int_map_filtered(int *int_map, int int_map_max, void *data, bool(*filter)(const struct tile *ptile, const void *data))
Change the values of the integer map, so that they contain ranking of each tile scaled to [0 .
void destroy_placed_map()
Free the pmap.
void set_all_ocean_tiles_placed()
Set all oceanics tiles in placed_map.
void set_placed_near_pos(struct tile *ptile, int dist)
Set all nearby tiles as placed on pmap.
bool placed_map_is_initialized()
Return TRUE if initialized.
struct terrain * most_shallow_ocean(bool frozen)
Return most shallow ocean terrain type.
int get_ocean_size(Continent_id id)
Return size in tiles of the given ocean.
void regenerate_lakes()
Regenerate all oceanic tiles for small water bodies as lakes.
void generator_free()
Free resources allocated by the generator.
struct terrain * pick_terrain_by_flag(enum terrain_flag_id flag)
Return a random terrain that has the specified flag.
void smooth_water_depth()
Makes a simple depth map for all ocean tiles based on their proximity to any land tiles and reassigne...
struct terrain * pick_terrain(enum mapgen_terrain_property target, enum mapgen_terrain_property prefer, enum mapgen_terrain_property avoid)
Pick a terrain based on the target property and a property to avoid.
void assign_continent_numbers()
Assigns continent and ocean numbers to all tiles, and set map.num_continents and map....
void map_unset_placed(struct tile *ptile)
Mark tile terrain as not placed.
int get_lake_surrounders(Continent_id cont)
Get continent surrounding lake, or -1 if there is multiple continents.