yet another shrink_glob fix...

When catching up for lost time spent on another level, globs inside
containers that shrank away to nothing didn't need to have those
containers' weight explicitly adjusted because obj_extract_self()
does that, so yesterday I removed the unneeded container_weight()
call.  However, ones that shrank only partially did need to have
their containers' weights adjusted and that wasn't being done.
The weight would be brought up to date within 25 or so turns when
the contained glob's next shrink_glob event took place.  Until then
attempting to pick up the container by hero or monster, or to pick
up something else by a monster already carrying it, could have been
impacted by the weight discrepancy.
This commit is contained in:
PatR
2021-12-01 17:05:27 -08:00
parent 35ac9a09e2
commit 59aedc3b37

View File

@@ -1367,12 +1367,19 @@ shrink_glob(
delta = (delta + 2L) / 3L;
if (delta >= (long) obj->owt) {
/* no newsym() or message here; forthcoming map update for
/* gone; no newsym() or message here--forthcoming map update for
level arrival is all that's needed */
obj_extract_self(obj); /* if contained, updates container's owt */
obj_extract_self(obj); /* if contained, also updates container's
* weight (recursively when nested) */
obfree(obj, (struct obj *) 0);
} else {
/* shrank but not gone; reduce remaining weight */
obj->owt -= (unsigned) delta;
/* won't be in container carried by hero but might be in floor one
or one carried by monster; if so, update container's weight */
if (contnr)
container_weight(contnr);
/* resume regular shrinking */
start_glob_timeout(obj, moddelta);
}
return;