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

Function adj_pit_checks

src/dig.c:1762–1838  ·  view source on GitHub ↗

* This checks what is on the surface above the * location where an adjacent pit might be created if * you're zapping a wand of digging laterally while * down in the pit. */

Source from the content-addressed store, hash-verified

1760 * down in the pit.
1761 */
1762staticfn int
1763adj_pit_checks(coord *cc, char *msg)
1764{
1765 int ltyp;
1766 struct rm *room;
1767 const char *foundation_msg =
1768 "The foundation is too hard to dig through from this angle.";
1769
1770 if (!cc)
1771 return FALSE;
1772 if (!isok(cc->x, cc->y))
1773 return FALSE;
1774 *msg = '\0';
1775 room = &levl[cc->x][cc->y];
1776 ltyp = room->typ, room->flags = 0;
1777
1778 if (is_pool(cc->x, cc->y) || is_lava(cc->x, cc->y)) {
1779 /* this is handled by the caller after we return FALSE */
1780 return FALSE;
1781 } else if (closed_door(cc->x, cc->y) || room->typ == SDOOR) {
1782 /* We reject this here because dighole() isn't
1783 prepared to deal with this case */
1784 Strcpy(msg, foundation_msg);
1785 return FALSE;
1786 } else if (IS_WALL(ltyp)) {
1787 /* if (room->wall_info & W_NONDIGGABLE) */
1788 Strcpy(msg, foundation_msg);
1789 return FALSE;
1790 } else if (IS_TREE(ltyp)) { /* check trees before stone */
1791 /* if (room->wall_info & W_NONDIGGABLE) */
1792 Strcpy(msg, "The tree's roots glow then fade.");
1793 return FALSE;
1794 } else if (ltyp == STONE || ltyp == SCORR) {
1795 if (room->wall_info & W_NONDIGGABLE) {
1796 Strcpy(msg, "The rock glows then fades.");
1797 return FALSE;
1798 }
1799 } else if (ltyp == IRONBARS) {
1800 /* "set of iron bars" */
1801 Strcpy(msg, "The bars go much deeper than your pit.");
1802 return FALSE;
1803#if 0
1804 } else if (is_lava(cc->x, cc->y)) {
1805 } else if (is_ice(cc->x, cc->y)) {
1806 } else if (is_pool(cc->x, cc->y)) {
1807 } else if (IS_GRAVE(ltyp)) {
1808#endif
1809 } else if (IS_SINK(ltyp)) {
1810 Strcpy(msg, "A tangled mass of plumbing remains below the sink.");
1811 return FALSE;
1812 } else if (On_ladder(cc->x, cc->y)) {
1813 Strcpy(msg, "The ladder is unaffected.");
1814 return FALSE;
1815 } else {
1816 const char *supporting = (const char *) 0;
1817
1818 if (IS_FOUNTAIN(ltyp))
1819 supporting = "fountain";

Callers 1

zap_digFunction · 0.85

Calls 8

isokFunction · 0.85
is_poolFunction · 0.85
is_lavaFunction · 0.85
closed_doorFunction · 0.85
is_iceFunction · 0.85
On_ladderFunction · 0.85
On_stairsFunction · 0.85
s_suffixFunction · 0.85

Tested by

no test coverage detected