Fix crystal ball use after being destroyed

Crystal ball can be destroyed when used, so pass the object parameter
back as null in that case.
This commit is contained in:
Pasi Kallinen
2015-11-01 18:49:38 +02:00
parent 07e2d6175f
commit 9181f06dab
4 changed files with 8 additions and 7 deletions

View File

@@ -891,11 +891,12 @@ static const struct {
};
void
use_crystal_ball(obj)
struct obj *obj;
use_crystal_ball(optr)
struct obj **optr;
{
char ch;
int oops;
struct obj *obj = *optr;
if (Blind) {
pline("Too bad you can't see %s.", the(xname(obj)));
@@ -930,7 +931,7 @@ struct obj *obj;
case 5:
pline("%s!", Tobjnam(obj, "explode"));
useup(obj);
obj = 0; /* it's gone */
*optr = obj = 0; /* it's gone */
/* physical damage cause by the shards and force */
losehp(Maybe_Half_Phys(rnd(30)), "exploding crystal ball",
KILLED_BY_AN);