add entries to there_cmd_menu, when x,y is next to hero */
| 4521 | |
| 4522 | /* add entries to there_cmd_menu, when x,y is next to hero */ |
| 4523 | staticfn int |
| 4524 | there_cmd_menu_next2u( |
| 4525 | winid win, |
| 4526 | coordxy x, coordxy y, |
| 4527 | int mod, |
| 4528 | int *act) |
| 4529 | { |
| 4530 | int K = 0; |
| 4531 | char buf[BUFSZ]; |
| 4532 | schar typ = levl[x][y].typ; |
| 4533 | struct trap *ttmp; |
| 4534 | struct monst *mtmp; |
| 4535 | |
| 4536 | if (!next2u(x, y)) |
| 4537 | return K; |
| 4538 | |
| 4539 | if (IS_DOOR(typ)) { |
| 4540 | boolean key_or_pick, card; |
| 4541 | int dm = levl[x][y].doormask; |
| 4542 | |
| 4543 | if ((dm & (D_CLOSED | D_LOCKED))) { |
| 4544 | mcmd_addmenu(win, MCMD_OPEN_DOOR, "Open the door"), ++K; |
| 4545 | /* unfortunately there's no lknown flag for doors to |
| 4546 | remember the locked/unlocked state */ |
| 4547 | key_or_pick = (carrying(SKELETON_KEY) || carrying(LOCK_PICK)); |
| 4548 | card = (carrying(CREDIT_CARD) != 0); |
| 4549 | if (key_or_pick || card) { |
| 4550 | Sprintf(buf, "%sunlock the door", |
| 4551 | key_or_pick ? "lock or " : ""); |
| 4552 | mcmd_addmenu(win, MCMD_LOCK_DOOR, upstart(buf)), ++K; |
| 4553 | } |
| 4554 | /* unfortunately there's no tknown flag for doors (or chests) |
| 4555 | to remember whether a trap had been found */ |
| 4556 | mcmd_addmenu(win, MCMD_UNTRAP_DOOR, |
| 4557 | "Search the door for a trap"), ++K; |
| 4558 | /* [what about #force?] */ |
| 4559 | mcmd_addmenu(win, MCMD_KICK_DOOR, "Kick the door"), ++K; |
| 4560 | } else if ((dm & D_ISOPEN) && (mod == CLICK_2)) { |
| 4561 | mcmd_addmenu(win, MCMD_CLOSE_DOOR, "Close the door"), ++K; |
| 4562 | } |
| 4563 | } |
| 4564 | |
| 4565 | if (typ <= SCORR) |
| 4566 | mcmd_addmenu(win, MCMD_SEARCH, "Search for secret doors"), ++K; |
| 4567 | |
| 4568 | if ((ttmp = t_at(x, y)) != 0 && ttmp->tseen) { |
| 4569 | mcmd_addmenu(win, MCMD_LOOK_TRAP, "Examine trap"), ++K; |
| 4570 | if (ttmp->ttyp != VIBRATING_SQUARE) |
| 4571 | mcmd_addmenu(win, MCMD_UNTRAP_TRAP, |
| 4572 | "Attempt to disarm trap"), ++K; |
| 4573 | mcmd_addmenu(win, MCMD_MOVE_DIR, "Move on the trap"), ++K; |
| 4574 | } |
| 4575 | |
| 4576 | if (levl[x][y].glyph == objnum_to_glyph(BOULDER)) |
| 4577 | mcmd_addmenu(win, MCMD_MOVE_DIR, "Push the boulder"), ++K; |
| 4578 | |
| 4579 | mtmp = m_at(x, y); |
| 4580 | if (mtmp && !canspotmon(mtmp)) |
no test coverage detected