return legal indexes for some display.h macros

Some static analyzers flagged the last-resort values as
out of bounds (which they were).

There's a small number of other complaint-suppression items in here too,
but nothing drastic.
This commit is contained in:
nhmall
2022-09-06 10:00:07 -04:00
parent 817b4686ce
commit 0086e01967
6 changed files with 93 additions and 84 deletions

View File

@@ -3161,13 +3161,12 @@ static boolean
find_poleable_mon(coord *pos, int min_range, int max_range)
{
struct monst *mtmp;
coord mpos;
coord mpos = { 0, 0 }; /* no candidate location yet */
boolean impaired;
coordxy x, y, lo_x, hi_x, lo_y, hi_y, rt;
int glyph;
impaired = (Confusion || Stunned || Hallucination);
mpos.x = mpos.y = 0; /* no candidate location yet */
rt = isqrt(max_range);
lo_x = max(u.ux - rt, 1), hi_x = min(u.ux + rt, COLNO - 1);
lo_y = max(u.uy - rt, 0), hi_y = min(u.uy + rt, ROWNO - 1);