--- deliantra/server/random_maps/random_map.h 2010/06/30 20:51:02 1.29 +++ deliantra/server/random_maps/random_map.h 2010/06/30 23:03:40 1.30 @@ -96,6 +96,7 @@ LAYOUT_ROGUELIKE, LAYOUT_SNAKE, LAYOUT_SQUARE_SPIRAL, + LAYOUT_CAVE, NROFLAYOUTS, }; @@ -152,6 +153,7 @@ // . ?? (rogue) // +// use this in new code struct LayoutData { char **col; @@ -165,16 +167,34 @@ return col; } + // for debugging, print layout to stdout + void print (); + + // 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 + void fill_rand (int perc); + // makes sure all areas are connected. dirty=true carves rounder but also - // mroe walls, dirty=false carves narrow corridors. + // more walls, dirty=false carves narrow corridors. void isolation_remover (bool dirty = 0); + + // generates a cave, subtype 0 is a rough cave, randomly open or closed + void gen_cave (int subtype); + void erode_1_2 (int c1, int c2 = -1, int repeat = 1); + + void swap (LayoutData &layout) + { + ::swap (layout.col, col); + ::swap (layout.w , w ); + ::swap (layout.h , h ); + } }; +// basically a layoutdata point - do not use in new code struct Layout { LayoutData *ptr; @@ -208,15 +228,10 @@ return *ptr; } - void swap (const Layout &layout) const + void swap (Layout &layout) { - ::swap (layout.ptr->col, ptr->col); - ::swap (layout.ptr->w , ptr->w ); - ::swap (layout.ptr->h , ptr->h ); + ::swap (layout.ptr, ptr); } - - // for debugging, print layout to stdout - void print (); }; // utility functions, to use rmg_rndm instead of rndm. @@ -229,6 +244,7 @@ return i; } +// a simple point helper struct struct point { short x; @@ -244,6 +260,8 @@ } }; +// something like a vector or stack, but without +// out of bounds checking template struct fixed_stack {