… | |
… | |
78 | maze[(xsize - 1) / 2][(ysize - 1) / 2 + 1] = '<'; |
78 | maze[(xsize - 1) / 2][(ysize - 1) / 2 + 1] = '<'; |
79 | return maze; |
79 | return maze; |
80 | } |
80 | } |
81 | |
81 | |
82 | /* decide on the number of rooms */ |
82 | /* decide on the number of rooms */ |
83 | nrooms = RANDOM () % 10 + 6; |
83 | nrooms = rndm (10) + 6; |
84 | Rooms = (Room *) calloc (nrooms + 1, sizeof (Room)); |
84 | Rooms = (Room *) calloc (nrooms + 1, sizeof (Room)); |
85 | |
85 | |
86 | /* actually place the rooms */ |
86 | /* actually place the rooms */ |
87 | i = 0; |
87 | i = 0; |
88 | while (tries < 450 && i < nrooms) |
88 | while (tries < 450 && i < nrooms) |
… | |
… | |
248 | break; |
248 | break; |
249 | case 2: |
249 | case 2: |
250 | making_circle = 1; |
250 | making_circle = 1; |
251 | break; |
251 | break; |
252 | default: |
252 | default: |
253 | making_circle = ((RANDOM () % 3 == 0) ? 1 : 0); |
253 | making_circle = ((rndm (3) == 0) ? 1 : 0); |
254 | break; |
254 | break; |
255 | } |
255 | } |
256 | |
256 | |
257 | if (walk->sx < walk->sy) |
257 | if (walk->sx < walk->sy) |
258 | R = walk->sx / 2; |
258 | R = walk->sx / 2; |
… | |
… | |
287 | int y1 = walk->y; |
287 | int y1 = walk->y; |
288 | int x2 = (walk - 1)->x; |
288 | int x2 = (walk - 1)->x; |
289 | int y2 = (walk - 1)->y; |
289 | int y2 = (walk - 1)->y; |
290 | int in_wall = 0; |
290 | int in_wall = 0; |
291 | |
291 | |
292 | if (RANDOM () % 2) |
292 | if (rndm (2)) |
293 | { /* connect in x direction first */ |
293 | { /* connect in x direction first */ |
294 | /* horizontal connect */ |
294 | /* horizontal connect */ |
295 | /* swap (x1,y1) (x2,y2) if necessary */ |
295 | /* swap (x1,y1) (x2,y2) if necessary */ |
296 | |
296 | |
297 | if (x2 < x1) |
297 | if (x2 < x1) |