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

Function doprtool

src/invent.c:4714–4735  ·  view source on GitHub ↗

the #seetools command */

Source from the content-addressed store, hash-verified

4712
4713/* the #seetools command */
4714int
4715doprtool(void)
4716{
4717 struct obj *otmp;
4718 int ct = 0;
4719 char lets[invlet_basic + 1];
4720
4721 for (otmp = gi.invent; otmp; otmp = otmp->nobj)
4722 if (tool_being_used(otmp)) {
4723 /* we could be carrying more than 52 items; theoretically they
4724 might all be lit candles so avoid potential lets[] overflow */
4725 if (ct >= (int) sizeof lets - 1)
4726 break;
4727 lets[ct++] = obj_to_let(otmp);
4728 }
4729 lets[ct] = '\0';
4730 if (!ct)
4731 You("are not using any tools.");
4732 else
4733 (void) dispinv_with_action(lets, TRUE, NULL);
4734 return ECMD_OK;
4735}
4736
4737/* the #seeall command; combines the ')' + '[' + '=' + '"' + '(' commands;
4738 show inventory of all currently wielded, worn, or used objects */

Callers

nothing calls this directly

Calls 4

tool_being_usedFunction · 0.85
obj_to_letFunction · 0.85
YouFunction · 0.85
dispinv_with_actionFunction · 0.85

Tested by

no test coverage detected