Prevent illegal positions for tmp_at

It seems like m_throw() can call tmp_at() with !isok coordinates,
so prevent those in both functions
This commit is contained in:
Pasi Kallinen
2015-04-15 20:35:48 +03:00
parent 97f6834730
commit 5a08671fc0
2 changed files with 2 additions and 1 deletions

View File

@@ -900,6 +900,7 @@ tmp_at(x, y)
break;
default: /* do it */
if (!isok(x,y)) break;
if (tglyph->style == DISP_BEAM || tglyph->style == DISP_ALL) {
if (tglyph->style != DISP_ALL && !cansee(x,y)) break;
if (tglyph->sidx >= TMP_AT_MAX_GLYPHS) break; /* too many locations */

View File

@@ -440,7 +440,7 @@ struct obj *obj; /* missile (or stack providing it) */
tmp_at(bhitpos.x, bhitpos.y);
delay_output();
}
tmp_at(bhitpos.x, bhitpos.y);
if (isok(bhitpos.x, bhitpos.y)) tmp_at(bhitpos.x, bhitpos.y);
delay_output();
tmp_at(DISP_END, 0);