tweak for #914 - attacking nothing
In the code that checks for attacking the edge of the map, the m_at() that was just introduced isn't at risk of using <0,0> because of the way 'glyph' is initialized. But guard against future changes. And I omitted this when checking the PR #914 commit in: Closes #914
This commit is contained in:
12
src/hack.c
12
src/hack.c
@@ -1684,7 +1684,10 @@ domove_bump_mon(struct monst *mtmp, int glyph)
|
||||
sets displaceu, if hero and monster could swap places instead.
|
||||
*/
|
||||
static boolean
|
||||
domove_attackmon_at(struct monst *mtmp, coordxy x, coordxy y, boolean *displaceu)
|
||||
domove_attackmon_at(
|
||||
struct monst *mtmp,
|
||||
coordxy x, coordxy y,
|
||||
boolean *displaceu)
|
||||
{
|
||||
/* only attack if we know it's there */
|
||||
/* or if we used the 'F' command to fight blindly */
|
||||
@@ -1899,9 +1902,10 @@ domove_fight_empty(coordxy x, coordxy y)
|
||||
int glyph = !off_edge ? glyph_at(x, y) : GLYPH_UNEXPLORED;
|
||||
|
||||
if (off_edge)
|
||||
x = y = 0; /* for forcefight against the edge of the map; make
|
||||
* sure 'bad' coordinates are within array bounds in
|
||||
* case a bounds check gets overlooked */
|
||||
x = 0, y = 1; /* for forcefight against the edge of the map; make
|
||||
* sure 'bad' coordinates are within array bounds in
|
||||
* case a bounds check gets overlooked; avoid <0,0>
|
||||
* because m_at() might find a vault guard there */
|
||||
|
||||
/* specifying 'F' with no monster wastes a turn */
|
||||
if (g.context.forcefight
|
||||
|
||||
@@ -160,7 +160,7 @@ attack_checks(
|
||||
|
||||
/* cache the shown glyph;
|
||||
cases which might change it (by placing or removing
|
||||
'rembered, unseen monster' glyph or revealing a mimic)
|
||||
'remembered, unseen monster' glyph or revealing a mimic)
|
||||
always return without further reference to this */
|
||||
glyph = glyph_at(g.bhitpos.x, g.bhitpos.y);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user