B03008 - stop_occupation while digging in a pit

If you dug in a pit next to a sleeping, angry monster, you'd stop every
turn due to a complex check at the end of dochugw.  It turned out this
was due to a long-standing bug in the special case vision code that failed
to set the COULD_SEE bit for the locations where it set the IN_SIGHT bit.
It looks like the underwater code had the same problem (it didn't set the
bit, obviously there are no pits underwater).  However, the same could
occur if you see the angry, sleeping monster with Xray vision.  In this
case, setting COULD_SEE is not appropriate, so added a mcanmove check to
the complex check in dochugw.
This commit is contained in:
cohrs
2003-07-14 05:57:11 +00:00
parent 3ef8dfe4aa
commit 17b7bc1bd6
3 changed files with 4 additions and 2 deletions

View File

@@ -116,6 +116,7 @@ dochugw(mtmp)
/* can see it now, or sense it and would normally see it */
(canseemon(mtmp) ||
(sensemon(mtmp) && couldsee(mtmp->mx,mtmp->my))) &&
mtmp->mcanmove &&
!noattacks(mtmp->data) && !onscary(u.ux, u.uy, mtmp))
stop_occupation();

View File

@@ -587,7 +587,7 @@ vision_recalc(control)
next_rmin[row] = min(next_rmin[row], col);
next_rmax[row] = max(next_rmax[row], col);
next_array[row][col] = IN_SIGHT;
next_array[row][col] = IN_SIGHT | COULD_SEE;
}
}
@@ -601,7 +601,7 @@ vision_recalc(control)
next_row = next_array[row];
for(col=next_rmin[row]; col <= next_rmax[row]; col++)
next_row[col] = IN_SIGHT;
next_row[col] = IN_SIGHT | COULD_SEE;
}
} else
view_from(u.uy, u.ux, next_array, next_rmin, next_rmax,