| 412 | } |
| 413 | |
| 414 | staticfn xint16 |
| 415 | parent_dlevel(const char *s, struct proto_dungeon *pd) |
| 416 | { |
| 417 | int i, j, num, base, dnum = parent_dnum(s, pd); |
| 418 | branch *curr; |
| 419 | |
| 420 | i = find_branch(s, pd); |
| 421 | num = level_range(dnum, pd->tmpbranch[i].lev.base, |
| 422 | pd->tmpbranch[i].lev.rand, pd->tmpbranch[i].chain, pd, |
| 423 | &base); |
| 424 | |
| 425 | /* KMH -- Try our best to find a level without an existing branch */ |
| 426 | i = j = rn2(num); |
| 427 | do { |
| 428 | if (++i >= num) |
| 429 | i = 0; |
| 430 | for (curr = svb.branches; curr; curr = curr->next) |
| 431 | if ((curr->end1.dnum == dnum && curr->end1.dlevel == base + i) |
| 432 | || (curr->end2.dnum == dnum && curr->end2.dlevel == base + i)) |
| 433 | break; |
| 434 | } while (curr && i != j); |
| 435 | return (base + i); |
| 436 | } |
| 437 | |
| 438 | /* Convert from the temporary branch type to the dungeon branch type. */ |
| 439 | staticfn int |
no test coverage detected