MCPcopy Index your code
hub / github.com/NetHack/NetHack / conjoined_pits

Function conjoined_pits

src/trap.c:6551–6577  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6549}
6550
6551boolean
6552conjoined_pits(
6553 struct trap *trap2,
6554 struct trap *trap1,
6555 boolean u_entering_trap2)
6556{
6557 coordxy dx, dy;
6558 int diridx, adjidx;
6559
6560 if (!trap1 || !trap2)
6561 return FALSE;
6562 if (!isok(trap2->tx, trap2->ty) || !isok(trap1->tx, trap1->ty)
6563 || !is_pit(trap2->ttyp)
6564 || !is_pit(trap1->ttyp)
6565 || (u_entering_trap2 && !(u.utrap && u.utraptype == TT_PIT)))
6566 return FALSE;
6567 dx = sgn(trap2->tx - trap1->tx);
6568 dy = sgn(trap2->ty - trap1->ty);
6569 diridx = xytodir(dx, dy);
6570 if (diridx != DIR_ERR) {
6571 adjidx = DIR_180(diridx);
6572 if ((trap1->conjoined & (1 << diridx))
6573 && (trap2->conjoined & (1 << adjidx)))
6574 return TRUE;
6575 }
6576 return FALSE;
6577}
6578
6579staticfn void
6580clear_conjoined_pits(struct trap *trap)

Callers 5

pick_can_reachFunction · 0.85
use_pick_axe2Function · 0.85
zap_digFunction · 0.85
trapeffect_pitFunction · 0.85
dotrapFunction · 0.85

Calls 3

isokFunction · 0.85
sgnFunction · 0.85
xytodirFunction · 0.85

Tested by

no test coverage detected