--- deliantra/server/random_maps/random_map.h 2010/07/02 03:40:14 1.33 +++ deliantra/server/random_maps/random_map.h 2010/07/02 15:43:37 1.35 @@ -152,56 +152,61 @@ // D door // < up // > down -// C "center" (of onion layout) +// C "center" (of onion maze) // . ?? (rogue) // // use this in new code -struct Layout +INTERFACE_CLASS(layout) +struct layout { - char **col; + typedef char cell; + + cell **data; int w, h; - Layout (int w, int h); - ~Layout (); + layout (int w, int h); + ~layout (); - operator char **() const + operator cell **() const { - return col; + return data; } - void swap (Layout &layout) + void swap (layout &maze) { - ::swap (layout.col, col); - ::swap (layout.w , w ); - ::swap (layout.h , h ); + ::swap (maze.data, data); + ::swap (maze.w , w ); + ::swap (maze.h , h ); } - // for debugging, print layout to stdout - void print () const; + MTH void swap (layout *maze) { swap (*maze); } + + // for debugging, print maze to stdout + MTH void print () const; // simple inpainting - void fill (char fill); - void clear () { fill (0); } - void border (char fill = '#'); - void rect (int x1, int y1, int x2, int y2, char fill); // x2, y2 exclusive + MTH void fill (char fill); + MTH void clear () { fill (0); } + MTH void border (char fill = '#'); + MTH void rect (int x1, int y1, int x2, int y2, char fill); // x2, y2 exclusive - void fill_rand (int perc); + MTH void fill_rand (int perc); // makes sure all areas are connected. dirty=true carves rounder but also // more walls, dirty=false carves narrow corridors. - void isolation_remover (bool dirty = 0); + MTH void isolation_remover (bool dirty = 0); // generates a cave, subtype 0 is a rough cave, randomly open or closed - void gen_cave (int subtype); + MTH void gen_cave (int subtype); - // helper functions to modify the layout - void erode_1_2 (int c1, int c2 = -1, int repeat = 1); - void doorify (); - void roomify (); // make some rooms in it, works best on onions - void expand2x (); - void symmetrize (int symmetry); - void rotate (int rotation); // rotate by 1=90, 2=180, 3=270 degrees + // helper functions to modify the maze + MTH void erode_1_2 (int c1, int c2 = -1, int repeat = 1); + MTH void doorify (); + MTH void roomify (); // make some rooms in it, works best on onions + MTH void expand2x (); + MTH void symmetrize (int symmetry); + MTH void rotate (int rotation); // rotate by 1=90, 2=180, 3=270 degrees void generate (random_map_params *RP); };