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

Function add_quoted_engraving

src/pager.c:1630–1667  ·  view source on GitHub ↗

when farlook is reporting on an engraving, include its text */

Source from the content-addressed store, hash-verified

1628
1629/* when farlook is reporting on an engraving, include its text */
1630staticfn boolean
1631add_quoted_engraving(
1632 coordxy x, coordxy y,
1633 char *buf,
1634 boolean force) /* True: '/e' or '/E', False: '//' or ';' */
1635{
1636 char temp_buf[BUFSZ];
1637 struct engr *ep = engr_at(x, y);
1638 boolean floorengr = !strcmp(buf, " (engraving"),
1639 headstone = !strcmp(buf, " (grave");
1640
1641 /*
1642 * If there is no engraving here, there's nothing to do; just return.
1643 *
1644 * When buf[] is " (engraving" or " (grave" then we're looking at an
1645 * engraving and we'll add its text. Caller supplies the closing paren.
1646 *
1647 * If buf[] contains anything else, we're looking at something (monster
1648 * or object) that happens to be on top of an engraving, so we won't
1649 * append the engraving text.
1650 */
1651 if (!ep)
1652 return FALSE;
1653
1654 if (!floorengr && !headstone && !force)
1655 return FALSE;
1656
1657 if (ep->eread)
1658 Snprintf(temp_buf, sizeof temp_buf, " with %s: \"%s\"",
1659 headstone ? "headstone reading" : "remembered text",
1660 ep->engr_txt[remembered_text]);
1661 else
1662 Snprintf(temp_buf, sizeof temp_buf, " %s you haven't read",
1663 headstone ? "whose headstone" : "that");
1664
1665 (void) strncat(buf, temp_buf, BUFSZ - strlen(buf) - 1);
1666 return TRUE;
1667}
1668
1669/* also used by getpos hack in getpos.c */
1670const char what_is_a_location[] = "a monster, object or location";

Callers 2

do_screen_descriptionFunction · 0.85
look_engrsFunction · 0.85

Calls 1

engr_atFunction · 0.85

Tested by

no test coverage detected