ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/random_maps/random_map.h
(Generate patch)

Comparing deliantra/server/random_maps/random_map.h (file contents):
Revision 1.33 by root, Fri Jul 2 03:40:14 2010 UTC vs.
Revision 1.35 by root, Fri Jul 2 15:43:37 2010 UTC

150// \0 floor only 150// \0 floor only
151// # wall 151// # wall
152// D door 152// D door
153// < up 153// < up
154// > down 154// > down
155// C "center" (of onion layout) 155// C "center" (of onion maze)
156// . ?? (rogue) 156// . ?? (rogue)
157// 157//
158 158
159// use this in new code 159// use this in new code
160INTERFACE_CLASS(layout)
160struct Layout 161struct layout
161{ 162{
162 char **col; 163 typedef char cell;
164
165 cell **data;
163 int w, h; 166 int w, h;
164 167
165 Layout (int w, int h); 168 layout (int w, int h);
166 ~Layout (); 169 ~layout ();
167 170
168 operator char **() const 171 operator cell **() const
169 { 172 {
170 return col; 173 return data;
171 } 174 }
172 175
173 void swap (Layout &layout) 176 void swap (layout &maze)
174 { 177 {
175 ::swap (layout.col, col); 178 ::swap (maze.data, data);
176 ::swap (layout.w , w ); 179 ::swap (maze.w , w );
177 ::swap (layout.h , h ); 180 ::swap (maze.h , h );
178 } 181 }
179 182
183 MTH void swap (layout *maze) { swap (*maze); }
184
180 // for debugging, print layout to stdout 185 // for debugging, print maze to stdout
181 void print () const; 186 MTH void print () const;
182 187
183 // simple inpainting 188 // simple inpainting
184 void fill (char fill); 189 MTH void fill (char fill);
185 void clear () { fill (0); } 190 MTH void clear () { fill (0); }
186 void border (char fill = '#'); 191 MTH void border (char fill = '#');
187 void rect (int x1, int y1, int x2, int y2, char fill); // x2, y2 exclusive 192 MTH void rect (int x1, int y1, int x2, int y2, char fill); // x2, y2 exclusive
188 193
189 void fill_rand (int perc); 194 MTH void fill_rand (int perc);
190 195
191 // makes sure all areas are connected. dirty=true carves rounder but also 196 // makes sure all areas are connected. dirty=true carves rounder but also
192 // more walls, dirty=false carves narrow corridors. 197 // more walls, dirty=false carves narrow corridors.
193 void isolation_remover (bool dirty = 0); 198 MTH void isolation_remover (bool dirty = 0);
194 199
195 // generates a cave, subtype 0 is a rough cave, randomly open or closed 200 // generates a cave, subtype 0 is a rough cave, randomly open or closed
196 void gen_cave (int subtype); 201 MTH void gen_cave (int subtype);
197 202
198 // helper functions to modify the layout 203 // helper functions to modify the maze
199 void erode_1_2 (int c1, int c2 = -1, int repeat = 1); 204 MTH void erode_1_2 (int c1, int c2 = -1, int repeat = 1);
200 void doorify (); 205 MTH void doorify ();
201 void roomify (); // make some rooms in it, works best on onions 206 MTH void roomify (); // make some rooms in it, works best on onions
202 void expand2x (); 207 MTH void expand2x ();
203 void symmetrize (int symmetry); 208 MTH void symmetrize (int symmetry);
204 void rotate (int rotation); // rotate by 1=90, 2=180, 3=270 degrees 209 MTH void rotate (int rotation); // rotate by 1=90, 2=180, 3=270 degrees
205 210
206 void generate (random_map_params *RP); 211 void generate (random_map_params *RP);
207}; 212};
208 213
209// utility functions, to use rmg_rndm instead of rndm. 214// utility functions, to use rmg_rndm instead of rndm.

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines