* Create an altar in a room. */
| 2443 | * Create an altar in a room. |
| 2444 | */ |
| 2445 | staticfn void |
| 2446 | create_altar(altar *a, struct mkroom *croom) |
| 2447 | { |
| 2448 | schar sproom; |
| 2449 | coordxy x = -1, y = -1; |
| 2450 | unsigned int amask; |
| 2451 | boolean croom_is_temple = TRUE; |
| 2452 | |
| 2453 | if (croom) { |
| 2454 | get_free_room_loc(&x, &y, croom, a->coord); |
| 2455 | if (croom->rtype != TEMPLE) |
| 2456 | croom_is_temple = FALSE; |
| 2457 | } else { |
| 2458 | get_location_coord(&x, &y, DRY, croom, a->coord); |
| 2459 | if ((sproom = (schar) *in_rooms(x, y, TEMPLE)) != 0) |
| 2460 | croom = &svr.rooms[sproom - ROOMOFFSET]; |
| 2461 | else |
| 2462 | croom_is_temple = FALSE; |
| 2463 | } |
| 2464 | |
| 2465 | /* check for existing features */ |
| 2466 | if (!set_levltyp(x, y, ALTAR)) |
| 2467 | return; |
| 2468 | |
| 2469 | amask = sp_amask_to_amask(a->sp_amask); |
| 2470 | |
| 2471 | levl[x][y].altarmask = amask; |
| 2472 | |
| 2473 | if (a->shrine < 0) |
| 2474 | a->shrine = rn2(2); /* handle random case */ |
| 2475 | |
| 2476 | if (!croom_is_temple || !a->shrine) |
| 2477 | return; |
| 2478 | |
| 2479 | if (a->shrine) { /* Is it a shrine or sanctum? */ |
| 2480 | priestini(&u.uz, croom, x, y, (a->shrine > 1)); |
| 2481 | levl[x][y].altarmask |= AM_SHRINE; |
| 2482 | if (a->shrine == 2) /* high altar or sanctum */ |
| 2483 | levl[x][y].altarmask |= AM_SANCTUM; |
| 2484 | svl.level.flags.has_temple = TRUE; |
| 2485 | } |
| 2486 | } |
| 2487 | |
| 2488 | /* |
| 2489 | * Search for a door in a room on a specified wall. |
no test coverage detected