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.16 by root, Sun Jul 4 22:12:26 2010 UTC vs.
Revision 1.17 by root, Mon Jul 5 00:07:21 2010 UTC

190 ty = rmg_rndm (ysize); 190 ty = rmg_rndm (ysize);
191 191
192 /* generate a distribution of sizes centered about basesize */ 192 /* generate a distribution of sizes centered about basesize */
193 sx = rmg_rndm (x_basesize) + rmg_rndm (x_basesize) + rmg_rndm (x_basesize); 193 sx = rmg_rndm (x_basesize) + rmg_rndm (x_basesize) + rmg_rndm (x_basesize);
194 sy = rmg_rndm (y_basesize) + rmg_rndm (y_basesize) + rmg_rndm (y_basesize); 194 sy = rmg_rndm (y_basesize) + rmg_rndm (y_basesize) + rmg_rndm (y_basesize);
195 sy = (int) (sy * .5); /* renormalize */ 195 sy >>= 1; /* renormalize */
196 196
197 /* find the corners */ 197 /* find the corners */
198 ax = tx - sx / 2; 198 ax = tx - sx / 2;
199 zx = tx + sx / 2 + sx % 2; 199 zx = tx + sx / 2 + sx % 2;
200 200
220 } 220 }
221 221
222 /* if we've got here, presumably the room is OK. */ 222 /* if we've got here, presumably the room is OK. */
223 223
224 /* get a pointer to the first free room */ 224 /* get a pointer to the first free room */
225 for (walk = rooms; walk->x != 0; walk++) 225 for (walk = rooms; walk->x; walk++)
226 ; 226 ;
227 227
228 walk->x = tx; 228 walk->x = tx;
229 walk->y = ty; 229 walk->y = ty;
230 walk->sx = sx; 230 walk->sx = sx;
231 walk->sy = sy; 231 walk->sy = sy;
232 walk->ax = ax; 232 walk->ax = ax;
233 walk->ay = ay; 233 walk->ay = ay;
234 walk->zx = zx; 234 walk->zx = zx;
240/* write all the rooms into the maze */ 240/* write all the rooms into the maze */
241static void 241static void
242roguelike_make_rooms (Room *rooms, char **maze, int options) 242roguelike_make_rooms (Room *rooms, char **maze, int options)
243{ 243{
244 int making_circle = 0; 244 int making_circle = 0;
245 int i, j;
246 int R; 245 int R;
247 Room *walk; 246 Room *walk;
248 247
249 for (walk = rooms; walk->x != 0; walk++) 248 for (walk = rooms; walk->x; walk++)
250 { 249 {
251 /* first decide what shape to make */ 250 /* first decide what shape to make */
252 switch (options) 251 switch (options)
253 { 252 {
254 case 1: 253 case 1:
266 R = walk->sx / 2; 265 R = walk->sx / 2;
267 else 266 else
268 R = walk->sy / 2; 267 R = walk->sy / 2;
269 268
270 /* enscribe a rectangle */ 269 /* enscribe a rectangle */
271 for (i = walk->ax; i < walk->zx; i++) 270 for (int i = walk->ax; i < walk->zx; i++)
272 for (j = walk->ay; j < walk->zy; j++) 271 for (int j = walk->ay; j < walk->zy; j++)
273 if (!making_circle || ((int) (0.5 + hypot (walk->x - i, walk->y - j))) <= R) 272 if (!making_circle || ((int) (0.5 + hypot (walk->x - i, walk->y - j))) <= R)
274 maze[i][j] = '.'; 273 maze[i][j] = '.';
275 } 274 }
276} 275}
277 276

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines