"new boulder" fix
The default value for obj->corpsenm is NON_PM which is -1, so the default value of boulder->next_boulder was non-zero instead of 0 as expected. Because of that, boulder object formatting by xname() was yielding "next boulder" when plain "boulder" was intended. Until the boulder or one in a pile above it got pushed, then it was explicitly reset.
This commit is contained in:
21
src/mkobj.c
21
src/mkobj.c
@@ -1049,8 +1049,7 @@ mksobj(int otyp, boolean init, boolean artif)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ROCK_CLASS:
|
case ROCK_CLASS:
|
||||||
switch (otmp->otyp) {
|
if (otmp->otyp == STATUE) {
|
||||||
case STATUE:
|
|
||||||
/* possibly overridden by mkcorpstat() */
|
/* possibly overridden by mkcorpstat() */
|
||||||
otmp->corpsenm = rndmonnum();
|
otmp->corpsenm = rndmonnum();
|
||||||
if (!verysmall(&mons[otmp->corpsenm])
|
if (!verysmall(&mons[otmp->corpsenm])
|
||||||
@@ -1058,6 +1057,7 @@ mksobj(int otyp, boolean init, boolean artif)
|
|||||||
(void) add_to_container(otmp,
|
(void) add_to_container(otmp,
|
||||||
mkobj(SPBOOK_no_NOVEL, FALSE));
|
mkobj(SPBOOK_no_NOVEL, FALSE));
|
||||||
}
|
}
|
||||||
|
/* boulder init'd below in the 'regardless of !init' code */
|
||||||
break;
|
break;
|
||||||
case COIN_CLASS:
|
case COIN_CLASS:
|
||||||
break; /* do nothing */
|
break; /* do nothing */
|
||||||
@@ -1099,6 +1099,12 @@ mksobj(int otyp, boolean init, boolean artif)
|
|||||||
/* case TIN: */
|
/* case TIN: */
|
||||||
set_corpsenm(otmp, otmp->corpsenm);
|
set_corpsenm(otmp, otmp->corpsenm);
|
||||||
break;
|
break;
|
||||||
|
case BOULDER:
|
||||||
|
/* next_boulder overloads corpsenm so the default value is NON_PM;
|
||||||
|
since that is non-zero, the "next boulder" case in xname() would
|
||||||
|
happen when it shouldn't; explicitly set it to 0 */
|
||||||
|
otmp->next_boulder = 0;
|
||||||
|
break;
|
||||||
case POT_OIL:
|
case POT_OIL:
|
||||||
otmp->age = MAX_OIL_IN_FLASK; /* amount of oil */
|
otmp->age = MAX_OIL_IN_FLASK; /* amount of oil */
|
||||||
/*FALLTHRU*/
|
/*FALLTHRU*/
|
||||||
@@ -2521,11 +2527,10 @@ insane_object(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Initialize a dummy obj with just enough info
|
/* initialize a dummy obj with just enough info to allow some of the tests in
|
||||||
* to allow some of the tests in obj.h that
|
obj.h that take an obj pointer to work; used when applying a stethoscope
|
||||||
* take an obj pointer to work.
|
toward a mimic mimicking an object */
|
||||||
*/
|
|
||||||
struct obj *
|
struct obj *
|
||||||
init_dummyobj(struct obj *obj, short otyp, long oquan)
|
init_dummyobj(struct obj *obj, short otyp, long oquan)
|
||||||
{
|
{
|
||||||
@@ -2541,6 +2546,8 @@ init_dummyobj(struct obj *obj, short otyp, long oquan)
|
|||||||
: !objects[otyp].oc_uses_known;
|
: !objects[otyp].oc_uses_known;
|
||||||
obj->quan = oquan ? oquan : 1L;
|
obj->quan = oquan ? oquan : 1L;
|
||||||
obj->corpsenm = NON_PM; /* suppress statue and figurine details */
|
obj->corpsenm = NON_PM; /* suppress statue and figurine details */
|
||||||
|
if (obj->otyp == BOULDER)
|
||||||
|
obj->next_boulder = 0; /* overloads corpsenm, avoid NON_PM */
|
||||||
/* but suppressing fruit details leads to "bad fruit #0" */
|
/* but suppressing fruit details leads to "bad fruit #0" */
|
||||||
if (obj->otyp == SLIME_MOLD)
|
if (obj->otyp == SLIME_MOLD)
|
||||||
obj->spe = g.context.current_fruit;
|
obj->spe = g.context.current_fruit;
|
||||||
|
|||||||
Reference in New Issue
Block a user