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:
@@ -243,7 +243,7 @@ E int FDECL(object_detect, (struct obj *, int));
|
|||||||
E int FDECL(monster_detect, (struct obj *, int));
|
E int FDECL(monster_detect, (struct obj *, int));
|
||||||
E int FDECL(trap_detect, (struct obj *));
|
E int FDECL(trap_detect, (struct obj *));
|
||||||
E const char *FDECL(level_distance, (d_level *));
|
E const char *FDECL(level_distance, (d_level *));
|
||||||
E void FDECL(use_crystal_ball, (struct obj *));
|
E void FDECL(use_crystal_ball, (struct obj **));
|
||||||
E void NDECL(do_mapping);
|
E void NDECL(do_mapping);
|
||||||
E void NDECL(do_vicinity_map);
|
E void NDECL(do_vicinity_map);
|
||||||
E void FDECL(cvt_sdoor_to_door, (struct rm *));
|
E void FDECL(cvt_sdoor_to_door, (struct rm *));
|
||||||
|
|||||||
@@ -3486,7 +3486,7 @@ doapply()
|
|||||||
res = use_towel(obj);
|
res = use_towel(obj);
|
||||||
break;
|
break;
|
||||||
case CRYSTAL_BALL:
|
case CRYSTAL_BALL:
|
||||||
use_crystal_ball(obj);
|
use_crystal_ball(&obj);
|
||||||
break;
|
break;
|
||||||
case MAGIC_MARKER:
|
case MAGIC_MARKER:
|
||||||
res = dowrite(obj);
|
res = dowrite(obj);
|
||||||
|
|||||||
@@ -1401,13 +1401,13 @@ doinvoke()
|
|||||||
|
|
||||||
STATIC_OVL int
|
STATIC_OVL int
|
||||||
arti_invoke(obj)
|
arti_invoke(obj)
|
||||||
register struct obj *obj;
|
struct obj *obj;
|
||||||
{
|
{
|
||||||
register const struct artifact *oart = get_artifact(obj);
|
register const struct artifact *oart = get_artifact(obj);
|
||||||
|
|
||||||
if (!oart || !oart->inv_prop) {
|
if (!oart || !oart->inv_prop) {
|
||||||
if (obj->otyp == CRYSTAL_BALL)
|
if (obj->otyp == CRYSTAL_BALL)
|
||||||
use_crystal_ball(obj);
|
use_crystal_ball(&obj);
|
||||||
else
|
else
|
||||||
pline1(nothing_happens);
|
pline1(nothing_happens);
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
@@ -891,11 +891,12 @@ static const struct {
|
|||||||
};
|
};
|
||||||
|
|
||||||
void
|
void
|
||||||
use_crystal_ball(obj)
|
use_crystal_ball(optr)
|
||||||
struct obj *obj;
|
struct obj **optr;
|
||||||
{
|
{
|
||||||
char ch;
|
char ch;
|
||||||
int oops;
|
int oops;
|
||||||
|
struct obj *obj = *optr;
|
||||||
|
|
||||||
if (Blind) {
|
if (Blind) {
|
||||||
pline("Too bad you can't see %s.", the(xname(obj)));
|
pline("Too bad you can't see %s.", the(xname(obj)));
|
||||||
@@ -930,7 +931,7 @@ struct obj *obj;
|
|||||||
case 5:
|
case 5:
|
||||||
pline("%s!", Tobjnam(obj, "explode"));
|
pline("%s!", Tobjnam(obj, "explode"));
|
||||||
useup(obj);
|
useup(obj);
|
||||||
obj = 0; /* it's gone */
|
*optr = obj = 0; /* it's gone */
|
||||||
/* physical damage cause by the shards and force */
|
/* physical damage cause by the shards and force */
|
||||||
losehp(Maybe_Half_Phys(rnd(30)), "exploding crystal ball",
|
losehp(Maybe_Half_Phys(rnd(30)), "exploding crystal ball",
|
||||||
KILLED_BY_AN);
|
KILLED_BY_AN);
|
||||||
|
|||||||
Reference in New Issue
Block a user