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

Comparing deliantra/server/random_maps/room_gen_onion.C (file contents):
Revision 1.13 by root, Fri Apr 11 21:09:53 2008 UTC vs.
Revision 1.14 by root, Mon Apr 14 22:41:17 2008 UTC

60void bottom_right_centered_onion (char **maze, int xsize, int ysize, int option, int layers); 60void bottom_right_centered_onion (char **maze, int xsize, int ysize, int option, int layers);
61 61
62void draw_onion (char **maze, float *xlocations, float *ylocations, int layers); 62void draw_onion (char **maze, float *xlocations, float *ylocations, int layers);
63void make_doors (char **maze, float *xlocations, float *ylocations, int layers, int options); 63void make_doors (char **maze, float *xlocations, float *ylocations, int layers, int options);
64 64
65Maze 65void
66map_gen_onion (int xsize, int ysize, int option, int layers) 66map_gen_onion (Maze maze, int option, int layers)
67{ 67{
68 int i, j; 68 int i, j;
69 69
70 Maze maze (xsize, ysize); 70 int xsize = maze->w;
71 int ysize = maze->h;
72
73 maze->clear ();
71 74
72 /* pick some random options if option = 0 */ 75 /* pick some random options if option = 0 */
73 if (option == 0) 76 if (option == 0)
74 { 77 {
75 switch (rndm (3)) 78 switch (rndm (3))
89 if (rndm (2)) option |= RMOPT_IRR_SPACE; 92 if (rndm (2)) option |= RMOPT_IRR_SPACE;
90 } 93 }
91 94
92 /* write the outer walls, if appropriate. */ 95 /* write the outer walls, if appropriate. */
93 if (!(option & RMOPT_WALL_OFF)) 96 if (!(option & RMOPT_WALL_OFF))
94 { 97 maze->border ();
95 for (i = 0; i < xsize; i++) maze[i][0] = maze[i][ysize - 1] = '#';
96 for (j = 0; j < ysize; j++) maze[0][j] = maze[xsize - 1][j] = '#';
97 };
98 98
99 if (option & RMOPT_WALLS_ONLY) 99 if (option & RMOPT_WALLS_ONLY)
100 return maze; 100 return;
101 101
102 /* pick off the mutually exclusive options */ 102 /* pick off the mutually exclusive options */
103 if (option & RMOPT_BOTTOM_R) 103 if (option & RMOPT_BOTTOM_R)
104 bottom_right_centered_onion (maze, xsize, ysize, option, layers); 104 bottom_right_centered_onion (maze, xsize, ysize, option, layers);
105 else if (option & RMOPT_BOTTOM_C) 105 else if (option & RMOPT_BOTTOM_C)
106 bottom_centered_onion (maze, xsize, ysize, option, layers); 106 bottom_centered_onion (maze, xsize, ysize, option, layers);
107 else if (option & RMOPT_CENTERED) 107 else if (option & RMOPT_CENTERED)
108 centered_onion (maze, xsize, ysize, option, layers); 108 centered_onion (maze, xsize, ysize, option, layers);
109
110 return maze;
111} 109}
112 110
113void 111void
114centered_onion (char **maze, int xsize, int ysize, int option, int layers) 112centered_onion (char **maze, int xsize, int ysize, int option, int layers)
115{ 113{

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines