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

Comparing deliantra/server/random_maps/rogue_layout.C (file contents):
Revision 1.13 by root, Wed Jun 30 20:51:02 2010 UTC vs.
Revision 1.14 by root, Thu Jul 1 01:22:44 2010 UTC

61 61
62/* actually make the layout: we work by a reduction process: 62/* actually make the layout: we work by a reduction process:
63 * first we make everything a wall, then we remove areas to make rooms 63 * first we make everything a wall, then we remove areas to make rooms
64 */ 64 */
65void 65void
66roguelike_layout_gen (Layout maze, int options) 66roguelike_layout_gen (Layout &maze, int options)
67{ 67{
68 int i, j; 68 int i, j;
69 Room *walk; 69 Room *walk;
70 int nrooms = 0; 70 int nrooms = 0;
71 int tries = 0; 71 int tries = 0;
72 72
73 int xsize = maze->w; 73 int xsize = maze.w;
74 int ysize = maze->h; 74 int ysize = maze.h;
75 75
76 /* minimum room size is basically 5x5: if xsize/ysize is 76 /* minimum room size is basically 5x5: if xsize/ysize is
77 less than 3x that then hollow things out, stick in 77 less than 3x that then hollow things out, stick in
78 a stairsup and stairs down, and exit */ 78 a stairsup and stairs down, and exit */
79 if (xsize < 11 || ysize < 11) 79 if (xsize < 11 || ysize < 11)
80 { 80 {
81 maze->clear (); 81 maze.clear ();
82 maze->border (); 82 maze.border ();
83 83
84 maze[(xsize - 1) / 2][(ysize - 1) / 2 ] = '>'; 84 maze[(xsize - 1) / 2][(ysize - 1) / 2 ] = '>';
85 maze[(xsize - 1) / 2][(ysize - 1) / 2 + 1] = '<'; 85 maze[(xsize - 1) / 2][(ysize - 1) / 2 + 1] = '<';
86 86
87 return; 87 return;
88 } 88 }
89 89
90 maze->fill ('#'); 90 maze.fill ('#');
91 91
92 /* decide on the number of rooms */ 92 /* decide on the number of rooms */
93 nrooms = rmg_rndm (10) + 6; 93 nrooms = rmg_rndm (10) + 6;
94 Room *rooms = salloc0<Room> (nrooms + 1); 94 Room *rooms = salloc0<Room> (nrooms + 1);
95 95
104 i++; 104 i++;
105 } 105 }
106 106
107 if (i == 0) /* no can do! */ 107 if (i == 0) /* no can do! */
108 { 108 {
109 maze->clear (); 109 maze.clear ();
110 maze->border (); 110 maze.border ();
111 111
112 maze [(xsize - 1) / 2][(ysize - 1) / 2 ] = '>'; 112 maze [(xsize - 1) / 2][(ysize - 1) / 2 ] = '>';
113 maze [(xsize - 1) / 2][(ysize - 1) / 2 + 1] = '<'; 113 maze [(xsize - 1) / 2][(ysize - 1) / 2 + 1] = '<';
114 114
115 sfree (rooms, nrooms + 1); 115 sfree (rooms, nrooms + 1);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines