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

Function surface

src/dungeon.c:1749–1788  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1747}
1748
1749const char *
1750surface(coordxy x, coordxy y)
1751{
1752 struct rm *lev = &levl[x][y];
1753 int levtyp = SURFACE_AT(x, y);
1754
1755 if (u_at(x, y) && u.uswallow && is_animal(u.ustuck->data))
1756 /* 'husk' is iffy but maw is wrong for 't' class */
1757 return digests(u.ustuck->data) ? "maw"
1758 : enfolds(u.ustuck->data) ? "husk"
1759 : "nonesuch"; /* can't happen (fingers crossed...) */
1760 else if (IS_AIR(levtyp))
1761 return Is_waterlevel(&u.uz) ? "air bubble"
1762 : (levtyp == CLOUD) ? "cloud" : "air";
1763 else if (is_pool(x, y))
1764 return (Underwater && !Is_waterlevel(&u.uz))
1765 ? "bottom" : hliquid("water");
1766 else if (is_ice(x, y))
1767 return "ice";
1768 else if (is_lava(x, y))
1769 return hliquid("lava");
1770 else if (lev->typ == DRAWBRIDGE_DOWN)
1771 return "bridge";
1772 else if (IS_ALTAR(levtyp))
1773 return "altar";
1774 else if (IS_GRAVE(levtyp))
1775 return "headstone";
1776 else if (IS_FOUNTAIN(levtyp))
1777 return "fountain";
1778 else if (On_stairs(x, y))
1779 return "stairs";
1780 else if (IS_WALL(levtyp) || levtyp == SDOOR)
1781 return "wall"; /* 'surface' during Passes_walls */
1782 else if (IS_DOOR(levtyp))
1783 return "doorway"; /* even for closed door */
1784 else if (IS_ROOM(levtyp) && !Is_earthlevel(&u.uz))
1785 return "floor";
1786 else
1787 return "ground";
1788}
1789
1790/*
1791 * It is expected that the second argument of get_level is a depth value,

Callers 15

dositFunction · 0.85
peffect_paralysisFunction · 0.85
itemactionsFunction · 0.85
canwearobjFunction · 0.85
select_offFunction · 0.85
disintegrate_armFunction · 0.85
dismount_steedFunction · 0.85
level_teleFunction · 0.85
dodownFunction · 0.85
retouch_objectFunction · 0.85
moverock_coreFunction · 0.85
trapmoveFunction · 0.85

Calls 5

is_poolFunction · 0.85
hliquidFunction · 0.85
is_iceFunction · 0.85
is_lavaFunction · 0.85
On_stairsFunction · 0.85

Tested by

no test coverage detected