kicking off edge of map
From a bug report: if you
were at one of the map edges and kicked away from map center while blind,
you'd get impossible("show_glyph: bad pos ..."). That was due to calling
feel_location() for the out of bounds location, which occurred after the
kick code had made use of invalid data so other problems might occur too.
Now you kick "nothing" as if it was something (hence possibly wounding
your leg, taking some damage, potentially dying). I didn't want to try to
classify the surrounding terrain as rock or air or whatever, and the thing
being kicked only shows up if the kick is fatal.
This commit is contained in:
23
src/dokick.c
23
src/dokick.c
@@ -1,4 +1,4 @@
|
||||
/* SCCS Id: @(#)dokick.c 3.5 2007/01/02 */
|
||||
/* SCCS Id: @(#)dokick.c 3.5 2007/01/26 */
|
||||
/* Copyright (c) Izchak Miller, Mike Stephenson, Steve Linhart, 1989. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#define martial() (martial_bonus() || is_bigfoot(youmonst.data) || \
|
||||
(uarmf && uarmf->otyp == KICKING_BOOTS))
|
||||
|
||||
static NEARDATA struct rm *maploc;
|
||||
static NEARDATA struct rm *maploc, nowhere;
|
||||
static NEARDATA const char *gate_str;
|
||||
|
||||
extern boolean notonhead; /* for long worms */
|
||||
@@ -603,6 +603,7 @@ char *buf;
|
||||
const char *what;
|
||||
|
||||
if (kickobj) what = killer_xname(kickobj);
|
||||
if (maploc == &nowhere) what = "nothing";
|
||||
else if (IS_DOOR(maploc->typ)) what = "a door";
|
||||
else if (IS_TREE(maploc->typ)) what = "a tree";
|
||||
else if (IS_STWALL(maploc->typ)) what = "a wall";
|
||||
@@ -739,6 +740,10 @@ dokick()
|
||||
wake_nearby();
|
||||
u_wipe_engr(2);
|
||||
|
||||
if (!isok(x, y)) {
|
||||
maploc = &nowhere;
|
||||
goto ouch;
|
||||
}
|
||||
maploc = &levl[x][y];
|
||||
|
||||
/* The next five tests should stay in */
|
||||
@@ -1012,12 +1017,14 @@ ouch:
|
||||
pline("Ouch! That hurts!");
|
||||
exercise(A_DEX, FALSE);
|
||||
exercise(A_STR, FALSE);
|
||||
if (Blind) feel_location(x,y); /* we know we hit it */
|
||||
if (is_drawbridge_wall(x,y) >= 0) {
|
||||
pline_The("drawbridge is unaffected.");
|
||||
/* update maploc to refer to the drawbridge */
|
||||
(void) find_drawbridge(&x,&y);
|
||||
maploc = &levl[x][y];
|
||||
if (isok(x, y)) {
|
||||
if (Blind) feel_location(x,y); /* we know we hit it */
|
||||
if (is_drawbridge_wall(x,y) >= 0) {
|
||||
pline_The("drawbridge is unaffected.");
|
||||
/* update maploc to refer to the drawbridge */
|
||||
(void) find_drawbridge(&x,&y);
|
||||
maploc = &levl[x][y];
|
||||
}
|
||||
}
|
||||
if(!rn2(3)) set_wounded_legs(RIGHT_SIDE, 5 + rnd(5));
|
||||
dmg = rnd(ACURR(A_CON) > 15 ? 3 : 5);
|
||||
|
||||
Reference in New Issue
Block a user