… | |
… | |
158 | |
158 | |
159 | // use this in new code |
159 | // use this in new code |
160 | INTERFACE_CLASS(layout) |
160 | INTERFACE_CLASS(layout) |
161 | struct layout |
161 | struct layout |
162 | { |
162 | { |
163 | char **col; |
163 | typedef char cell; |
|
|
164 | |
|
|
165 | cell **data; |
164 | int w, h; |
166 | int w, h; |
165 | |
167 | |
166 | layout (int w, int h); |
168 | layout (int w, int h); |
|
|
169 | layout (layout ©); |
167 | ~layout (); |
170 | ~layout (); |
168 | |
171 | |
169 | operator char **() const |
172 | operator cell **() const |
170 | { |
173 | { |
171 | return col; |
174 | return data; |
172 | } |
175 | } |
173 | |
176 | |
174 | void swap (layout &maze) |
177 | void swap (layout &maze) |
175 | { |
178 | { |
176 | ::swap (maze.col, col); |
179 | ::swap (maze.data, data); |
177 | ::swap (maze.w , w ); |
180 | ::swap (maze.w , w ); |
178 | ::swap (maze.h , h ); |
181 | ::swap (maze.h , h ); |
179 | } |
182 | } |
|
|
183 | |
|
|
184 | MTH void swap (layout *maze) { swap (*maze); } |
180 | |
185 | |
181 | // for debugging, print maze to stdout |
186 | // for debugging, print maze to stdout |
182 | MTH void print () const; |
187 | MTH void print () const; |
183 | |
188 | |
184 | // simple inpainting |
189 | // simple inpainting |
… | |
… | |
203 | MTH void expand2x (); |
208 | MTH void expand2x (); |
204 | MTH void symmetrize (int symmetry); |
209 | MTH void symmetrize (int symmetry); |
205 | MTH void rotate (int rotation); // rotate by 1=90, 2=180, 3=270 degrees |
210 | MTH void rotate (int rotation); // rotate by 1=90, 2=180, 3=270 degrees |
206 | |
211 | |
207 | void generate (random_map_params *RP); |
212 | void generate (random_map_params *RP); |
|
|
213 | private: |
|
|
214 | void alloc (int w, int h); |
208 | }; |
215 | }; |
209 | |
216 | |
210 | // utility functions, to use rmg_rndm instead of rndm. |
217 | // utility functions, to use rmg_rndm instead of rndm. |
211 | static inline int |
218 | static inline int |
212 | rmg_find_free_spot (const object *ob, maptile *m, int x, int y, int start, int stop) |
219 | rmg_find_free_spot (const object *ob, maptile *m, int x, int y, int start, int stop) |