… | |
… | |
27 | |
27 | |
28 | #include "util.h" |
28 | #include "util.h" |
29 | |
29 | |
30 | struct random_map_params : zero_initialised |
30 | struct random_map_params : zero_initialised |
31 | { |
31 | { |
32 | char wallstyle[512]; |
|
|
33 | char miningstyle[512]; |
|
|
34 | char wall_name[512]; |
32 | char wall_name[512]; |
35 | char floorstyle[512]; |
|
|
36 | char monsterstyle[512]; |
33 | char monsterstyle[512]; |
37 | char treasurestyle[512]; |
|
|
38 | char layoutstyle[512]; |
34 | char layoutstyle[512]; |
39 | char doorstyle[512]; |
35 | char doorstyle[512]; |
40 | char decorstyle[512]; |
|
|
41 | shstr origin_map; |
36 | shstr origin_map; |
42 | shstr final_map; |
37 | shstr final_map; |
43 | char exitstyle[512]; |
|
|
44 | shstr this_map; |
38 | shstr this_map; |
45 | char exit_on_final_map[512]; |
39 | char exit_on_final_map[512]; |
46 | char *custom; |
40 | |
47 | |
|
|
48 | int xsize, ysize; |
41 | int xsize, ysize; |
49 | int expand2x; |
42 | int expand2x; |
50 | int layoutoptions1; |
43 | int layoutoptions1; |
51 | int layoutoptions2; |
44 | int layoutoptions2; |
52 | int layoutoptions3; |
45 | int layoutoptions3; |
… | |
… | |
56 | float difficulty_increase; |
49 | float difficulty_increase; |
57 | |
50 | |
58 | int dungeon_level; |
51 | int dungeon_level; |
59 | int dungeon_depth; |
52 | int dungeon_depth; |
60 | |
53 | |
61 | int decoroptions; |
|
|
62 | int orientation; |
54 | int orientation; |
|
|
55 | int origin_x; |
63 | int origin_y; |
56 | int origin_y; |
64 | int origin_x; |
|
|
65 | uint32_t random_seed; |
57 | uint32_t random_seed; |
66 | uint64_t total_map_hp; |
58 | uint64_t total_map_hp; |
67 | int map_layout_style; |
59 | int map_layout_style; |
68 | int treasureoptions; |
|
|
69 | int symmetry_used; |
60 | int symmetry_used; |
70 | |
61 | |
71 | struct region *region; |
62 | struct region *region; |
|
|
63 | |
|
|
64 | HV *hv; |
|
|
65 | void hv_clone (); // replaces the hv by a clone'd copy (%new_hv = { %hv }) |
|
|
66 | |
|
|
67 | shstr_tmp as_shstr () const; |
|
|
68 | |
|
|
69 | // fetch something from the options hash |
|
|
70 | SV *get_sv (const char *option) const; |
|
|
71 | const_utf8_string get_str (const char *option, const_utf8_string fallback = "") const; |
|
|
72 | IV get_iv (const char *option, IV fallback = 0) const; |
|
|
73 | UV get_uv (const char *option, UV fallback = 0) const; |
|
|
74 | NV get_nv (const char *option, NV fallback = 0) const; |
|
|
75 | |
|
|
76 | void set (const char *option, SV *value) const; |
|
|
77 | void set (const char *option, const_utf8_string value) const; |
|
|
78 | void set (const char *option, IV value) const; |
|
|
79 | void set (const char *option, UV value) const; |
|
|
80 | void set (const char *option, NV value) const; |
|
|
81 | |
|
|
82 | void set (const char *option, int value) const { set (option, (IV)value); } |
72 | |
83 | |
73 | // "private", adjusted sizes |
84 | // "private", adjusted sizes |
74 | int Xsize; |
85 | int Xsize; |
75 | int Ysize; |
86 | int Ysize; |
|
|
87 | |
|
|
88 | ~random_map_params (); |
76 | }; |
89 | }; |
77 | |
90 | |
78 | enum { |
91 | enum { |
79 | LAYOUT_NONE, |
92 | LAYOUT_NONE, |
80 | LAYOUT_ONION, |
93 | LAYOUT_ONION, |
… | |
… | |
193 | { |
206 | { |
194 | ::swap (layout.ptr->col, ptr->col); |
207 | ::swap (layout.ptr->col, ptr->col); |
195 | ::swap (layout.ptr->w , ptr->w ); |
208 | ::swap (layout.ptr->w , ptr->w ); |
196 | ::swap (layout.ptr->h , ptr->h ); |
209 | ::swap (layout.ptr->h , ptr->h ); |
197 | } |
210 | } |
|
|
211 | |
|
|
212 | // for debugging, print layout to stdout |
|
|
213 | void print (); |
198 | }; |
214 | }; |
199 | |
215 | |
200 | // utility functions, to use rmg_rndm instead of rndm. |
216 | // utility functions, to use rmg_rndm instead of rndm. |
201 | static inline int |
217 | static inline int |
202 | rmg_find_free_spot (const object *ob, maptile *m, int x, int y, int start, int stop) |
218 | rmg_find_free_spot (const object *ob, maptile *m, int x, int y, int start, int stop) |