MCPcopy Create free account
hub / github.com/NetHack/NetHack / doprring

Function doprring

src/invent.c:4641–4675  ·  view source on GitHub ↗

the #seerings command */

Source from the content-addressed store, hash-verified

4639
4640/* the #seerings command */
4641int
4642doprring(void)
4643{
4644 if (!uleft && !uright) {
4645 You("are not wearing any rings.");
4646 } else {
4647 char lets[3]; /* 3: uright, uleft, terminator */
4648 boolean use_inuse_mode = FALSE;
4649 int ct = 0;
4650
4651 /* if either ring is a meat ring, switch to use_inuse_mode in order
4652 to label it/them as "Rings" rather than "Comestibles" */
4653 if (uright) {
4654 lets[ct++] = obj_to_let(uright);
4655 if (uright->oclass != RING_CLASS)
4656 use_inuse_mode = TRUE;
4657 }
4658 if (uleft) {
4659 lets[ct++] = obj_to_let(uleft);
4660 if (uleft->oclass != RING_CLASS)
4661 use_inuse_mode = TRUE;
4662 }
4663 lets[ct] = '\0';
4664 /* also switch to use_inuse_mode if there are two rings or player
4665 used the 'm' prefix */
4666 if (ct > 1 || iflags.menu_requested)
4667 use_inuse_mode = TRUE;
4668
4669 (void) dispinv_with_action(lets, use_inuse_mode,
4670 /* note; alternate label will be ignored
4671 if 'use_inuse_mode' is False */
4672 (ct == 1) ? "Ring" : "Rings");
4673 }
4674 return ECMD_OK;
4675}
4676
4677/* the #seeamulet command */
4678int

Callers

nothing calls this directly

Calls 3

YouFunction · 0.85
obj_to_letFunction · 0.85
dispinv_with_actionFunction · 0.85

Tested by

no test coverage detected