create random corridors between rooms */
| 519 | |
| 520 | /* create random corridors between rooms */ |
| 521 | void |
| 522 | makecorridors(void) |
| 523 | { |
| 524 | int a, b, i; |
| 525 | boolean any = TRUE; |
| 526 | |
| 527 | for (a = 0; a < svn.nroom - 1; a++) { |
| 528 | join(a, a + 1, FALSE); |
| 529 | if (!rn2(50)) |
| 530 | break; /* allow some randomness */ |
| 531 | } |
| 532 | for (a = 0; a < svn.nroom - 2; a++) |
| 533 | if (gs.smeq[a] != gs.smeq[a + 2]) |
| 534 | join(a, a + 2, FALSE); |
| 535 | for (a = 0; any && a < svn.nroom; a++) { |
| 536 | any = FALSE; |
| 537 | for (b = 0; b < svn.nroom; b++) |
| 538 | if (gs.smeq[a] != gs.smeq[b]) { |
| 539 | join(a, b, FALSE); |
| 540 | any = TRUE; |
| 541 | } |
| 542 | } |
| 543 | /* add some extra corridors which may be blocked off */ |
| 544 | if (svn.nroom > 2) |
| 545 | for (i = rn2(svn.nroom) + 4; i; i--) { |
| 546 | a = rn2(svn.nroom); |
| 547 | b = rn2(svn.nroom - 2); |
| 548 | if (b >= a) |
| 549 | b += 2; |
| 550 | join(a, b, TRUE); |
| 551 | } |
| 552 | } |
| 553 | |
| 554 | /* (re)allocate space for svd.doors array */ |
| 555 | staticfn void |
no test coverage detected