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

Function mime_action

src/invent.c:1677–1706  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1675}
1676
1677staticfn void
1678mime_action(const char *word)
1679{
1680 char buf[BUFSZ];
1681 char *bp, *pfx, *sfx;
1682
1683 Strcpy(buf, word);
1684 bp = pfx = sfx = (char *) 0;
1685
1686 if ((bp = strstr(buf, " on the ")) != 0) {
1687 /* rub on the stone[s] */
1688 *bp = '\0';
1689 sfx = (bp + 1); /* "something <sfx>" */
1690 }
1691 if ((!strncmp(buf, "rub the ", 8) && strstr(buf + 8, " on"))
1692 || (!strncmp(buf, "dip ", 4) && strstr(buf + 4, " into"))) {
1693 /* "rub the royal jelly on" -> "rubbing the royal jelly on", or
1694 "dip <foo> into" => "dipping <foo> into" */
1695 buf[3] = '\0';
1696 pfx = &buf[3 + 1]; /* "<pfx> something" */
1697 }
1698 if ((bp = strstr(buf, " or ")) != 0) {
1699 *bp = '\0';
1700 bp = (rn2(2) ? buf : (bp + 4));
1701 } else
1702 bp = buf;
1703
1704 You("mime %s%s%s something%s%s.", ing_suffix(bp),
1705 pfx ? " " : "", pfx ? pfx : "", sfx ? " " : "", sfx ? sfx : "");
1706}
1707
1708/* getobj callback that allows any object - but not hands. */
1709int

Callers 1

getobjFunction · 0.85

Calls 3

rn2Function · 0.85
YouFunction · 0.85
ing_suffixFunction · 0.85

Tested by

no test coverage detected