Find the branch that links the named dungeon. */
| 308 | |
| 309 | /* Find the branch that links the named dungeon. */ |
| 310 | staticfn int |
| 311 | find_branch( |
| 312 | const char *s, /* dungeon name */ |
| 313 | struct proto_dungeon *pd) |
| 314 | { |
| 315 | int i; |
| 316 | |
| 317 | if (pd) { |
| 318 | for (i = 0; i < pd->n_brs; i++) |
| 319 | if (!strcmp(pd->tmpbranch[i].name, s)) |
| 320 | break; |
| 321 | if (i == pd->n_brs) |
| 322 | panic("find_branch: can't find %s", s); |
| 323 | } else { |
| 324 | /* support for level tport by name */ |
| 325 | branch *br; |
| 326 | const char *dnam; |
| 327 | |
| 328 | for (br = svb.branches; br; br = br->next) { |
| 329 | dnam = svd.dungeons[br->end2.dnum].dname; |
| 330 | if (!strcmpi(dnam, s) |
| 331 | || (!strncmpi(dnam, "The ", 4) && !strcmpi(dnam + 4, s))) |
| 332 | break; |
| 333 | } |
| 334 | i = br ? ((ledger_no(&br->end1) << 8) | ledger_no(&br->end2)) : -1; |
| 335 | } |
| 336 | return i; |
| 337 | } |
| 338 | |
| 339 | DISABLE_WARNING_UNREACHABLE_CODE |
| 340 |
no test coverage detected