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

Function pit_flow

src/dig.c:1843–1882  ·  view source on GitHub ↗

* Ensure that all conjoined pits fill up. */

Source from the content-addressed store, hash-verified

1841 * Ensure that all conjoined pits fill up.
1842 */
1843staticfn void
1844pit_flow(struct trap *trap, schar filltyp)
1845{
1846 /*
1847 * FIXME?
1848 * liquid_flow() -> pooleffects() -> {drown(),lava_effects()}
1849 * might kill the hero; the game will end and if that leaves bones,
1850 * remaining conjoined pits will be left unprocessed.
1851 */
1852 if (trap && filltyp != ROOM && is_pit(trap->ttyp)) {
1853 struct trap t;
1854 int idx;
1855
1856 t = *trap;
1857 levl[t.tx][t.ty].typ = filltyp, levl[t.tx][t.ty].flags = 0;
1858 liquid_flow(t.tx, t.ty, filltyp, trap,
1859 u_at(t.tx, t.ty)
1860 ? "Suddenly %s flows in from the adjacent pit!"
1861 : (char *) 0);
1862 for (idx = 0; idx < N_DIRS; ++idx) {
1863 if (t.conjoined & (1 << idx)) {
1864 coordxy x, y;
1865 struct trap *t2;
1866
1867 x = t.tx + xdir[idx];
1868 y = t.ty + ydir[idx];
1869 t2 = t_at(x, y);
1870#if 0
1871 /* cannot do this back-check; liquid_flow()
1872 * called deltrap() which cleaned up the
1873 * conjoined fields on both pits.
1874 */
1875 if (t2 && (t2->conjoined & (1 << DIR_180(idx))))
1876#endif
1877 /* recursion */
1878 pit_flow(t2, filltyp);
1879 }
1880 }
1881 }
1882}
1883
1884struct obj *
1885buried_ball(coord *cc)

Callers 1

zap_digFunction · 0.85

Calls 2

liquid_flowFunction · 0.85
t_atFunction · 0.85

Tested by

no test coverage detected