--- deliantra/server/random_maps/random_map.h 2010/07/03 00:39:57 1.37 +++ deliantra/server/random_maps/random_map.h 2010/07/03 13:14:36 1.42 @@ -30,13 +30,6 @@ struct random_map_params : zero_initialised { char wall_name[512]; - char monsterstyle[512]; - char layoutstyle[512]; - char doorstyle[512]; - shstr origin_map; - shstr final_map; - shstr this_map; - char exit_on_final_map[512]; int xsize, ysize; int expand2x; @@ -52,17 +45,12 @@ int dungeon_depth; int orientation; - int origin_x; - int origin_y; uint32_t random_seed; uint64_t total_map_hp; int map_layout_style; int symmetry_used; - struct region *region; - HV *hv; - void hv_clone (); // replaces the hv by a clone'd copy (%new_hv = { %hv }) shstr_tmp as_shstr () const; @@ -85,6 +73,9 @@ int Xsize; int Ysize; + random_map_params (); + random_map_params (random_map_params *RP); + random_map_params (HV *hv); ~random_map_params (); }; @@ -97,6 +88,8 @@ LAYOUT_SNAKE, LAYOUT_SQUARE_SPIRAL, LAYOUT_CAVE, + LAYOUT_CASTLE, + LAYOUT_MULTIPLE, NROFLAYOUTS, }; @@ -167,6 +160,11 @@ layout (int w, int h); layout (layout ©); + + // reference rect in other layout - will not keep the data alive, + // so never swap with it's orig, or free the orig when in use. + layout (layout &orig, int x1, int y1, int x2, int y2); + ~layout (); operator cell **() const @@ -177,8 +175,9 @@ void swap (layout &maze) { ::swap (maze.data, data); - ::swap (maze.w , w ); - ::swap (maze.h , h ); + ::swap (maze.w , w ); + ::swap (maze.h , h ); + ::swap (maze.size, size); } MTH void swap (layout *maze) { swap (*maze); } @@ -196,10 +195,14 @@ MTH void fill_rand (int perc); // makes sure all areas are connected - MTH void isolation_remover (); + // perturb = 0 - very horz/vert tunnels + // perturb = 1 - straight but round + // perturb = 2 - snaky tunnels + MTH void isolation_remover (int perturb = 2); // generates a cave, subtype 0 is a rough cave, randomly open or closed MTH void gen_cave (int subtype); + MTH void gen_castle (); // generates straightish structures // helper functions to modify the maze MTH void erode_1_2 (int c1, int c2 = -1, int repeat = 1); @@ -211,6 +214,7 @@ void generate (random_map_params *RP); private: + int size; void alloc (int w, int h); };