/* idx is valid if < 8 */
if (idx < 8) {
int adjidx = (idx + 4) % 8;
- trap_with_u->conjoined[idx] = TRUE;
- trap->conjoined[adjidx] = TRUE;
+ trap_with_u->conjoined |= (1 << idx);
+ trap->conjoined |= (1 << adjidx);
pline(
"You clear some debris from between the pits.");
}
if (adjpit && (adjpit->ttyp == PIT ||
adjpit->ttyp == SPIKED_PIT)) {
int adjidx = (diridx + 4) % 8;
- trap_with_u->conjoined[diridx] = TRUE;
- adjpit->conjoined[adjidx] = TRUE;
+ trap_with_u->conjoined |= (1 << diridx);
+ adjpit->conjoined |= (1 << adjidx);
flow_x = zx;
flow_y = zy;
pitflow = TRUE;
"Suddenly %s flows in from the adjacent pit!":
(char *)0);
for(idx = 0; idx < 8; ++idx) {
- if (t.conjoined[idx]) {
+ if (t.conjoined & (1 << idx)) {
int x, y;
struct trap *t2;
x = t.tx + xdir[idx];
* called deltrap() which cleaned up the
* conjoined fields on both pits.
*/
- if (t2 && t2->conjoined[(idx + 4) % 8])
+
+ if (t2 && (t2->conjoined & (1 << ((idx + 4) % 8))))
#endif
/* recursion */
pit_flow(t2, filltyp);
register struct trap *ttmp;
register struct rm *lev;
register boolean oldplace;
- int idx;
if ((ttmp = t_at(x,y)) != 0) {
if (ttmp->ttyp == MAGIC_PORTAL) return (struct trap *)0;
case ROLLING_BOULDER_TRAP: /* boulder will roll towards trigger */
(void) mkroll_launch(ttmp, x, y, BOULDER, 1L);
break;
- case HOLE:
case PIT:
case SPIKED_PIT:
+ ttmp->conjoined = 0;
+ /* fall through */
+ case HOLE:
case TRAPDOOR:
- for (idx = 0; idx < 8; ++idx)
- ttmp->conjoined[idx] = FALSE;
lev = &levl[x][y];
if (*in_rooms(x, y, SHOPBASE) &&
((typ == HOLE || typ == TRAPDOOR) ||
/* diridx is valid if < 8 */
if (diridx < 8) {
adjidx = (diridx + 4) % 8;
- if (trap1->conjoined[diridx] && trap2->conjoined[adjidx])
+ if ((trap1->conjoined & (1 << diridx)) &&
+ (trap2->conjoined & (1 << adjidx)))
return TRUE;
}
return FALSE;
clear_conjoined_pits(trap)
struct trap *trap;
{
- int tmp, adj, x, y;
+ int diridx, adjidx, x, y;
struct trap *t;
if (trap && (trap->ttyp == PIT || trap->ttyp == SPIKED_PIT)) {
- for(tmp = 0; tmp < 8; ++tmp) {
- if (trap->conjoined[tmp]) {
- x = trap->tx + xdir[tmp];
- y = trap->ty + ydir[tmp];
+ for(diridx = 0; diridx < 8; ++diridx) {
+ if (trap->conjoined & (1 << diridx)) {
+ x = trap->tx + xdir[diridx];
+ y = trap->ty + ydir[diridx];
t = t_at(x,y);
if (isok(x,y) && t &&
(t->ttyp == PIT || t->ttyp == SPIKED_PIT)) {
- adj = (tmp + 4) % 8;
- t->conjoined[adj] = FALSE;
+ adjidx = (diridx + 4) % 8;
+ t->conjoined &= ~(1 << adjidx);
}
- trap->conjoined[tmp] = FALSE;
+ trap->conjoined &= ~(1 << diridx);
}
}
}
struct trap *trap;
{
struct trap *t;
- int tmp, x, y;
+ int diridx, x, y;
if (!trap) return;
- for(tmp = 0; tmp < 8; ++tmp) {
- x = trap->tx + xdir[tmp];
- y = trap->ty + ydir[tmp];
+ for(diridx = 0; diridx < 8; ++diridx) {
+ x = trap->tx + xdir[diridx];
+ y = trap->ty + ydir[diridx];
if (isok(x,y)) {
if (((t = t_at(x,y)) != 0) &&
(t->ttyp == PIT || t->ttyp == SPIKED_PIT)) {
- trap->conjoined[tmp] = TRUE;
+ trap->conjoined |= (1 << diridx);
join_adjacent_pits(t);
- } else trap->conjoined[tmp] = FALSE;
+ } else trap->conjoined &= ~(1 << diridx);
}
}
}