--- deliantra/server/random_maps/random_map.C 2007/01/25 03:54:45 1.26 +++ deliantra/server/random_maps/random_map.C 2007/01/27 02:19:37 1.27 @@ -92,7 +92,7 @@ RP->Ysize = MIN_RANDOM_MAP_SIZE + rndm (25) + 5; if (RP->symmetry == SYMMETRY_RANDOM) - RP->symmetry_used = (RANDOM () % (SYMMETRY_XY)) + 1; + RP->symmetry_used = rndm (SYMMETRY_XY) + 1; else RP->symmetry_used = RP->symmetry; @@ -135,7 +135,7 @@ /* No style found - choose one randomly */ if (RP->map_layout_style == LAYOUT_NONE) - RP->map_layout_style = (RANDOM () % (NROFLAYOUTS - 1)) + 1; + RP->map_layout_style = rndm (NROFLAYOUTS - 1) + 1; layout = layoutgen (RP); @@ -452,21 +452,25 @@ int dx, dy; /* starting location for looking at creating a door */ int cx, cy; /* results of checking on creating walls. */ - dx = RANDOM () % RP->Xsize; - dy = RANDOM () % RP->Ysize; + dx = rndm (RP->Xsize); + dy = rndm (RP->Ysize); + cx = can_make_wall (maze, dx, dy, 0, RP); /* horizontal */ cy = can_make_wall (maze, dx, dy, 1, RP); /* vertical */ if (cx == -1) { if (cy != -1) make_wall (maze, dx, dy, 1); + continue; } + if (cy == -1) { make_wall (maze, dx, dy, 0); continue; } + if (cx < cy) make_wall (maze, dx, dy, 0); else @@ -622,15 +626,17 @@ int di; int sindex; - di = RANDOM () % doorlocs; + di = rndm (doorlocs); i = doorlist_x[di]; j = doorlist_y[di]; sindex = surround_flag (maze, i, j, RP); + if (sindex == 3 || sindex == 12) /* these are possible door sindex */ { maze[i][j] = 'D'; ndoors--; } + /* reduce the size of the list */ doorlocs--; doorlist_x[di] = doorlist_x[doorlocs];