a pair of domove_core() blocks
Following line 2425 of hack.c, in domove_core():
mtmp = m_at(x, y);
mtmp can be null.
There were two if blocks following that, both of which
only make sense when mtmp is not null.
One of them was explicitly checking for mtmp being non-null,
and the other was avoiding catastrophe by relying on a
hidden check buried within an _is_safepet(mon) macro.
Place both of those blocks into an
if (mtmp) { }
block.
99% of the diff is just indentation.
This commit is contained in:
@@ -2557,6 +2557,8 @@ domove_core(void)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
mtmp = m_at(x, y);
|
mtmp = m_at(x, y);
|
||||||
|
/* mtmp can be null at this point */
|
||||||
|
|
||||||
/* tentatively move the hero plus steed; leave CLIPPING til later */
|
/* tentatively move the hero plus steed; leave CLIPPING til later */
|
||||||
u.ux += u.dx;
|
u.ux += u.dx;
|
||||||
u.uy += u.dy;
|
u.uy += u.dy;
|
||||||
@@ -2567,7 +2569,8 @@ domove_core(void)
|
|||||||
exercise_steed(); /* train riding skill */
|
exercise_steed(); /* train riding skill */
|
||||||
}
|
}
|
||||||
|
|
||||||
if (displaceu && mtmp) {
|
if (mtmp) {
|
||||||
|
if (displaceu) {
|
||||||
boolean noticed_it = (canspotmon(mtmp) || glyph_is_invisible(glyph)
|
boolean noticed_it = (canspotmon(mtmp) || glyph_is_invisible(glyph)
|
||||||
|| glyph_is_warning(glyph));
|
|| glyph_is_warning(glyph));
|
||||||
|
|
||||||
@@ -2608,6 +2611,8 @@ domove_core(void)
|
|||||||
u.usteed->mx = u.ux, u.usteed->my = u.uy;
|
u.usteed->mx = u.ux, u.usteed->my = u.uy;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} /* mtmp != NULL */
|
||||||
|
|
||||||
/* tentative move above didn't handle CLIPPING, in case there was a
|
/* tentative move above didn't handle CLIPPING, in case there was a
|
||||||
monster in the way and the move attempt ended up being blocked;
|
monster in the way and the move attempt ended up being blocked;
|
||||||
do a full re-position now, possibly back to where hero started */
|
do a full re-position now, possibly back to where hero started */
|
||||||
|
|||||||
Reference in New Issue
Block a user