From 7831df3dda7f811c0609cba0523e6b24bdf1d23e Mon Sep 17 00:00:00 2001 From: Steve Melenchuk Date: Thu, 19 Apr 2012 17:32:07 -0600 Subject: [PATCH] Extra checks for valid locations when applying a bullwhip; fixes C343-383. --- src/apply.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/apply.c b/src/apply.c index 7402431243..09f00a5d49 100644 --- a/src/apply.c +++ b/src/apply.c @@ -2208,7 +2208,7 @@ struct obj *obj; if (Stunned || (Confusion && !rn2(5))) confdir(); rx = u.ux + u.dx; ry = u.uy + u.dy; - mtmp = m_at(rx, ry); + mtmp = (isok(rx, ry)) ? m_at(rx, ry) : (struct monst *)0; /* fake some proficiency checks */ proficient = 0; @@ -2290,6 +2290,13 @@ struct obj *obj; */ const char *wrapped_what = (char *)0; + if (!isok(rx, ry)) { + pline("%s", + Is_airlevel(&u.uz) ? "You snap your whip through thin air." + : msg_snap); + return 1; + } + if (mtmp) { if (bigmonst(mtmp->data)) { wrapped_what = strcpy(buf, mon_nam(mtmp));