--- deliantra/server/random_maps/square_spiral.C 2007/01/18 19:42:10 1.8 +++ deliantra/server/random_maps/square_spiral.C 2007/01/27 02:19:37 1.9 @@ -61,14 +61,15 @@ void find_top_left_corner (char **maze, int *cx, int *cy) { + --(*cy); - (*cy)--; /* find the top wall. */ while (maze[*cx][*cy] == 0) - (*cy)--; + --(*cy); + /* proceed right until a corner is detected */ while (maze[*cx][*cy + 1] == 0) - (*cx)++; + ++(*cx); /* cx and cy should now be the top-right corner of the onion layer */ } @@ -89,21 +90,21 @@ cy = 0; for (i = 0; i < xsize; i++) for (j = 0; j < ysize; j++) - { - if (maze[i][j] == 'C') - { - cx = i; - cy = j; - } - } + if (maze[i][j] == 'C') + { + cx = i; + cy = j; + } + tx = cx; ty = cy; - while (1) + for (;;) { find_top_left_corner (maze, &tx, &ty); if (ty < 2 || tx < 2 || tx > xsize - 2 || ty > ysize - 2) break; + make_wall (maze, tx, ty - 1, 1); /* make a vertical wall with a door */ maze[tx][ty - 1] = '#'; /* convert the door that make_wall puts here to a wall */ @@ -144,3 +145,4 @@ return maze; } +