| 3551 | |
| 3552 | /* in wizard mode, readobjnam() can accept wishes for traps and terrain */ |
| 3553 | staticfn struct obj * |
| 3554 | wizterrainwish(struct _readobjnam_data *d) |
| 3555 | { |
| 3556 | struct rm *lev; |
| 3557 | boolean madeterrain = FALSE, badterrain = FALSE, is_dbridge; |
| 3558 | int trap; |
| 3559 | unsigned oldtyp, ltyp; |
| 3560 | coordxy x = u.ux, y = u.uy; |
| 3561 | char *bp = d->bp, *p; |
| 3562 | |
| 3563 | for (trap = NO_TRAP + 1; trap < TRAPNUM; trap++) { |
| 3564 | struct trap *t; |
| 3565 | const char *tname; |
| 3566 | |
| 3567 | tname = trapname(trap, TRUE); |
| 3568 | if (!str_start_is(bp, tname, TRUE)) |
| 3569 | continue; |
| 3570 | /* found it; avoid stupid mistakes */ |
| 3571 | if (is_hole(trap) && !Can_fall_thru(&u.uz)) |
| 3572 | trap = ROCKTRAP; |
| 3573 | if ((t = maketrap(x, y, trap)) != 0) { |
| 3574 | trap = t->ttyp; |
| 3575 | tname = trapname(trap, TRUE); |
| 3576 | pline("%s%s.", An(tname), |
| 3577 | (trap != MAGIC_PORTAL) ? "" : " to nowhere"); |
| 3578 | } else { |
| 3579 | pline("Creation of %s failed.", an(tname)); |
| 3580 | } |
| 3581 | return &hands_obj; |
| 3582 | } |
| 3583 | |
| 3584 | /* furniture and terrain (use at your own risk; can clobber stairs |
| 3585 | or place furniture on existing traps which shouldn't be allowed) */ |
| 3586 | lev = &levl[x][y]; |
| 3587 | oldtyp = lev->typ; |
| 3588 | is_dbridge = (oldtyp == DRAWBRIDGE_DOWN || oldtyp == DRAWBRIDGE_UP); |
| 3589 | p = eos(bp); |
| 3590 | if (!BSTRCMPI(bp, p - 8, "fountain")) { |
| 3591 | lev->typ = FOUNTAIN; |
| 3592 | if (oldtyp != FOUNTAIN) |
| 3593 | svl.level.flags.nfountains++; |
| 3594 | lev->looted = d->looted ? F_LOOTED : 0; /* overlays 'flags' */ |
| 3595 | lev->blessedftn = d->blessed || !strncmpi(bp, "magic ", 6); |
| 3596 | pline("A %sfountain.", lev->blessedftn ? "magic " : ""); |
| 3597 | madeterrain = TRUE; |
| 3598 | } else if (!BSTRCMPI(bp, p - 6, "throne")) { |
| 3599 | lev->typ = THRONE; |
| 3600 | lev->looted = d->looted ? T_LOOTED : 0; /* overlays 'flags' */ |
| 3601 | pline("A throne."); |
| 3602 | madeterrain = TRUE; |
| 3603 | } else if (!BSTRCMPI(bp, p - 4, "sink")) { |
| 3604 | lev->typ = SINK; |
| 3605 | if (oldtyp != SINK) |
| 3606 | svl.level.flags.nsinks++; |
| 3607 | lev->looted = d->looted ? (S_LPUDDING | S_LDWASHER | S_LRING) : 0; |
| 3608 | pline("A sink."); |
| 3609 | madeterrain = TRUE; |
| 3610 |
no test coverage detected