obj_no_longer_held consistency

Call obj_no_longer_held whenever an object hits the floor, no matter what
previously held it.  Also handle stoning of prior holder.
This commit is contained in:
cohrs
2002-02-09 21:55:45 +00:00
parent 38d84ba3c8
commit 316a94d50f
7 changed files with 30 additions and 17 deletions

View File

@@ -531,7 +531,6 @@ register struct obj *obj;
if (!u.uswallow && flooreffects(obj,u.ux,u.uy,"drop")) return;
/* uswallow check done by GAN 01/29/87 */
obj_no_longer_held(obj);
if(u.uswallow) {
boolean could_petrify;
if (obj != uball) { /* mon doesn't pick up ball */
@@ -557,25 +556,28 @@ register struct obj *obj;
}
}
/* things that must change when not held; recurse into containers.
Called for both player and monsters */
void
obj_no_longer_held(obj) /* things that must change when not held; recurse into containers */
obj_no_longer_held(obj)
struct obj *obj;
{
if (!obj) {
return;
return;
} else if ((Is_container(obj) || obj->otyp == STATUE) && obj->cobj) {
struct obj *contents;
for(contents=obj->cobj; contents; contents=contents->nobj)
obj_no_longer_held(contents);
struct obj *contents;
for(contents=obj->cobj; contents; contents=contents->nobj)
obj_no_longer_held(contents);
}
switch(obj->otyp) {
case CRYSKNIFE:
/* KMH -- Fixed crysknives have only 10% chance of reverting */
if (!obj->oerodeproof || !rn2(10)) {
obj->otyp = WORM_TOOTH;
obj->oerodeproof = 0;
}
break;
case CRYSKNIFE:
/* KMH -- Fixed crysknives have only 10% chance of reverting */
/* only changes when not held by player or monster */
if (!obj->oerodeproof || !rn2(10)) {
obj->otyp = WORM_TOOTH;
obj->oerodeproof = 0;
}
break;
}
}