* Search for a door in a room on a specified wall. */
| 2489 | * Search for a door in a room on a specified wall. |
| 2490 | */ |
| 2491 | staticfn boolean |
| 2492 | search_door( |
| 2493 | struct mkroom *croom, |
| 2494 | coordxy *x, coordxy *y, |
| 2495 | xint16 wall, int cnt) |
| 2496 | { |
| 2497 | int dx, dy; |
| 2498 | int xx, yy; |
| 2499 | |
| 2500 | switch (wall) { |
| 2501 | case W_SOUTH: |
| 2502 | dy = 0; |
| 2503 | dx = 1; |
| 2504 | xx = croom->lx; |
| 2505 | yy = croom->hy + 1; |
| 2506 | break; |
| 2507 | case W_NORTH: |
| 2508 | dy = 0; |
| 2509 | dx = 1; |
| 2510 | xx = croom->lx; |
| 2511 | yy = croom->ly - 1; |
| 2512 | break; |
| 2513 | case W_EAST: |
| 2514 | dy = 1; |
| 2515 | dx = 0; |
| 2516 | xx = croom->hx + 1; |
| 2517 | yy = croom->ly; |
| 2518 | break; |
| 2519 | case W_WEST: |
| 2520 | dy = 1; |
| 2521 | dx = 0; |
| 2522 | xx = croom->lx - 1; |
| 2523 | yy = croom->ly; |
| 2524 | break; |
| 2525 | default: |
| 2526 | panic("search_door: Bad wall!"); |
| 2527 | /*NOTREACHED*/ |
| 2528 | } |
| 2529 | while (xx <= croom->hx + 1 && yy <= croom->hy + 1) { |
| 2530 | if (IS_DOOR(levl[xx][yy].typ) || levl[xx][yy].typ == SDOOR) { |
| 2531 | *x = xx; |
| 2532 | *y = yy; |
| 2533 | if (cnt-- <= 0) |
| 2534 | return TRUE; |
| 2535 | } |
| 2536 | xx += dx; |
| 2537 | yy += dy; |
| 2538 | } |
| 2539 | return FALSE; |
| 2540 | } |
| 2541 | |
| 2542 | /* |
| 2543 | * Dig a corridor between two points, using terrain ftyp. |
no test coverage detected