5 #include "fixedarray.h"
8 // The caller is responsible for ensuring that env.heightmap is set.
9 static inline short &dgn_height_at(const coord_def
&c
)
11 return (*env
.heightmap
)(c
);
14 typedef FixedArray
<bool, GXM
, GYM
> grid_bool
;
15 typedef FixedArray
<short, GXM
, GYM
> grid_short
;
16 typedef std::pair
<int, int> int_range
;
18 const int DGN_UNDEFINED_HEIGHT
= -10000;
20 int resolve_range(int_range range
, int nrolls
= 1);
22 void dgn_initialise_heightmap(int initial_height
= 0);
23 void dgn_smooth_height_at(coord_def c
, int radius
= 1,
24 int max_height
= DGN_UNDEFINED_HEIGHT
);
25 void dgn_smooth_heights(int radius
= 1, int npasses
= 1);
28 void dgn_island_centred_at(const coord_def
&c
,
29 // Number of times to raise heights of
33 // Radius within which all height
34 // increments are applied.
37 // Lower and upper limits to the height
38 // delta per perturbation.
39 int_range height_delta_range
,
41 int border_margin
= 6,
43 // If make_atoll is set, all points chosen for
44 // height increment will be close to the specified
45 // radius from c, thus producing a ragged ring.
46 bool make_atoll
= false);
48 struct dgn_island_plan
51 // Number of squares of border to leave around the level.
52 int level_border_depth
;
54 // Number of auxiliary high points for each island.
55 int_range n_aux_centres
;
57 // Distance from the island centre where the aux high points are placed.
58 int_range aux_centre_offset_range
;
60 // Percentage of island (aux) centres that are built as atolls.
63 // The positions of the primary centre of each island.
64 std::vector
<coord_def
> islands
;
66 // The square of the minimum distance that must separate any two
67 // island centres. This is not intended to prevent island overlap, only
68 // to prevent too much clumping of islands.
69 int island_separation_dist2
;
71 // Number of points near each island centre that will be raised by
72 // the island builder.
73 int_range n_island_centre_delta_points
;
75 // Range of radii for island primary centres.
76 int_range island_centre_radius_range
;
78 int_range island_centre_point_height_increment
;
80 // Number of points near secondary island centres that will be
81 // raised by the island builder.
82 int_range n_island_aux_delta_points
;
84 // Range of radii for island aux centres.
85 int_range island_aux_radius_range
;
87 int_range island_aux_point_height_increment
;
90 void build(int nislands
);
91 coord_def
pick_and_remove_random_island();
94 coord_def
pick_island_spot();