--- deliantra/server/random_maps/room_gen_onion.C 2006/12/30 18:45:28 1.5 +++ deliantra/server/random_maps/room_gen_onion.C 2006/12/31 19:02:24 1.6 @@ -1,3 +1,4 @@ + /* CrossFire, A Multiplayer game for X-windows @@ -82,15 +83,15 @@ { switch (RANDOM () % 3) { - case 0: - option |= RMOPT_CENTERED; - break; - case 1: - option |= RMOPT_BOTTOM_C; - break; - case 2: - option |= RMOPT_BOTTOM_R; - break; + case 0: + option |= RMOPT_CENTERED; + break; + case 1: + option |= RMOPT_BOTTOM_C; + break; + case 2: + option |= RMOPT_BOTTOM_R; + break; } if (RANDOM () % 2) option |= RMOPT_LINEAR; @@ -140,7 +141,7 @@ /* place all the walls */ - if (option & RMOPT_IRR_SPACE) /* randomly spaced */ + if (option & RMOPT_IRR_SPACE) /* randomly spaced */ { int x_spaces_available, y_spaces_available; @@ -207,7 +208,7 @@ /* place all the walls */ - if (option & RMOPT_IRR_SPACE) /* randomly spaced */ + if (option & RMOPT_IRR_SPACE) /* randomly spaced */ { int x_spaces_available, y_spaces_available; @@ -316,30 +317,30 @@ { /* linear door placement. */ switch (which_wall) { - case 1: - { /* left hand wall */ - x1 = (int) xlocations[l]; - y1 = (int) ((ylocations[l] + ylocations[2 * layers - l - 1]) / 2); - break; - } - case 2: - { /* top wall placement */ - x1 = (int) ((xlocations[l] + xlocations[2 * layers - l - 1]) / 2); - y1 = (int) ylocations[l]; - break; - } - case 3: - { /* right wall placement */ - x1 = (int) xlocations[2 * layers - l - 1]; - y1 = (int) ((ylocations[l] + ylocations[2 * layers - l - 1]) / 2); - break; - } - case 4: - { /* bottom wall placement */ - x1 = (int) ((xlocations[l] + xlocations[2 * layers - l - 1]) / 2); - y1 = (int) ylocations[2 * layers - l - 1]; - break; - } + case 1: + { /* left hand wall */ + x1 = (int) xlocations[l]; + y1 = (int) ((ylocations[l] + ylocations[2 * layers - l - 1]) / 2); + break; + } + case 2: + { /* top wall placement */ + x1 = (int) ((xlocations[l] + xlocations[2 * layers - l - 1]) / 2); + y1 = (int) ylocations[l]; + break; + } + case 3: + { /* right wall placement */ + x1 = (int) xlocations[2 * layers - l - 1]; + y1 = (int) ((ylocations[l] + ylocations[2 * layers - l - 1]) / 2); + break; + } + case 4: + { /* bottom wall placement */ + x1 = (int) ((xlocations[l] + xlocations[2 * layers - l - 1]) / 2); + y1 = (int) ylocations[2 * layers - l - 1]; + break; + } } } else @@ -347,47 +348,47 @@ which_wall = RANDOM () % freedoms + 1; switch (which_wall) { - case 1: - { /* left hand wall */ - x1 = (int) xlocations[l]; - y2 = (int) (ylocations[2 * layers - l - 1] - ylocations[l] - 1); - if (y2 > 0) - y1 = (int) (ylocations[l] + RANDOM () % y2 + 1); - else - y1 = (int) (ylocations[l] + 1); - break; - } - case 2: - { /* top wall placement */ - x2 = (int) ((-xlocations[l] + xlocations[2 * layers - l - 1])) - 1; - if (x2 > 0) - x1 = (int) (xlocations[l] + RANDOM () % x2 + 1); - else - x1 = (int) (xlocations[l] + 1); - y1 = (int) ylocations[l]; - break; - } - case 3: - { /* right wall placement */ - x1 = (int) xlocations[2 * layers - l - 1]; - y2 = (int) ((-ylocations[l] + ylocations[2 * layers - l - 1])) - 1; - if (y2 > 0) - y1 = (int) (ylocations[l] + RANDOM () % y2 + 1); - else - y1 = (int) (ylocations[l] + 1); - - break; - } - case 4: - { /* bottom wall placement */ - x2 = (int) ((-xlocations[l] + xlocations[2 * layers - l - 1])) - 1; - if (x2 > 0) - x1 = (int) (xlocations[l] + RANDOM () % x2 + 1); - else - x1 = (int) (xlocations[l] + 1); - y1 = (int) ylocations[2 * layers - l - 1]; - break; - } + case 1: + { /* left hand wall */ + x1 = (int) xlocations[l]; + y2 = (int) (ylocations[2 * layers - l - 1] - ylocations[l] - 1); + if (y2 > 0) + y1 = (int) (ylocations[l] + RANDOM () % y2 + 1); + else + y1 = (int) (ylocations[l] + 1); + break; + } + case 2: + { /* top wall placement */ + x2 = (int) ((-xlocations[l] + xlocations[2 * layers - l - 1])) - 1; + if (x2 > 0) + x1 = (int) (xlocations[l] + RANDOM () % x2 + 1); + else + x1 = (int) (xlocations[l] + 1); + y1 = (int) ylocations[l]; + break; + } + case 3: + { /* right wall placement */ + x1 = (int) xlocations[2 * layers - l - 1]; + y2 = (int) ((-ylocations[l] + ylocations[2 * layers - l - 1])) - 1; + if (y2 > 0) + y1 = (int) (ylocations[l] + RANDOM () % y2 + 1); + else + y1 = (int) (ylocations[l] + 1); + + break; + } + case 4: + { /* bottom wall placement */ + x2 = (int) ((-xlocations[l] + xlocations[2 * layers - l - 1])) - 1; + if (x2 > 0) + x1 = (int) (xlocations[l] + RANDOM () % x2 + 1); + else + x1 = (int) (xlocations[l] + 1); + y1 = (int) ylocations[2 * layers - l - 1]; + break; + } } } @@ -428,7 +429,7 @@ /* place all the walls */ - if (option & RMOPT_IRR_SPACE) /* randomly spaced */ + if (option & RMOPT_IRR_SPACE) /* randomly spaced */ { int x_spaces_available, y_spaces_available;