glob nutrition should match owt reduction
reported directly to devteam as an impossible() call within eaten_stat() (internal tracking number 3216)
This commit is contained in:
@@ -83,6 +83,8 @@ cmdstr[] buffer was not being initialized in handler_rebind_keys_add()
|
|||||||
don't catch thrown objects while asleep
|
don't catch thrown objects while asleep
|
||||||
don't refer to pet as "Your pet" until after the taming process has finished
|
don't refer to pet as "Your pet" until after the taming process has finished
|
||||||
checkpoint fixes (pr #1660 by k21971)
|
checkpoint fixes (pr #1660 by k21971)
|
||||||
|
upon return to a level, catch up on remaining nutrition value by the same
|
||||||
|
percentage as the catch up for the weight
|
||||||
|
|
||||||
|
|
||||||
Platform- and/or Interface-Specific Fixes
|
Platform- and/or Interface-Specific Fixes
|
||||||
|
|||||||
+17
-2
@@ -1510,7 +1510,7 @@ shrink_glob(
|
|||||||
shrink = FALSE, gone = FALSE, updinv = FALSE;
|
shrink = FALSE, gone = FALSE, updinv = FALSE;
|
||||||
struct obj *contnr = (obj->where == OBJ_CONTAINED) ? obj->ocontainer : 0,
|
struct obj *contnr = (obj->where == OBJ_CONTAINED) ? obj->ocontainer : 0,
|
||||||
*topcontnr = 0;
|
*topcontnr = 0;
|
||||||
unsigned old_top_owt = 0;
|
unsigned old_top_owt = 0, old_owt = obj->owt;
|
||||||
|
|
||||||
if (!obj->globby) {
|
if (!obj->globby) {
|
||||||
impossible("shrink_glob for non-glob [%d: %s]?",
|
impossible("shrink_glob for non-glob [%d: %s]?",
|
||||||
@@ -1539,12 +1539,25 @@ shrink_glob(
|
|||||||
obj->owt = 0; /* not required; accurately reflects obj's state */
|
obj->owt = 0; /* not required; accurately reflects obj's state */
|
||||||
shrinking_glob_gone(obj);
|
shrinking_glob_gone(obj);
|
||||||
} else {
|
} else {
|
||||||
/* shrank but not gone; reduce remaining weight */
|
|
||||||
|
/* shrank but not gone; reduce remaining weight
|
||||||
|
and food-content (if needed) */
|
||||||
obj->owt -= (unsigned) delta;
|
obj->owt -= (unsigned) delta;
|
||||||
/* when contained, update container's weight (recursively if
|
/* when contained, update container's weight (recursively if
|
||||||
nested); won't be in a container carried by hero (since
|
nested); won't be in a container carried by hero (since
|
||||||
catching up for lost time never applies in that situation)
|
catching up for lost time never applies in that situation)
|
||||||
but might be in one on floor or one carried by a monster */
|
but might be in one on floor or one carried by a monster */
|
||||||
|
if (old_owt && obj->oeaten) {
|
||||||
|
unsigned percent_reduction = 100 - ((obj->owt * 100) / old_owt),
|
||||||
|
oeaten_reduction;
|
||||||
|
|
||||||
|
/* reduce remaining nutrition by same percentage */
|
||||||
|
oeaten_reduction = (percent_reduction * obj->oeaten + 50) / 100;
|
||||||
|
|
||||||
|
if (oeaten_reduction <= obj->oeaten)
|
||||||
|
obj->oeaten -= oeaten_reduction;
|
||||||
|
|
||||||
|
}
|
||||||
if (contnr)
|
if (contnr)
|
||||||
container_weight(contnr);
|
container_weight(contnr);
|
||||||
/* resume regular shrinking */
|
/* resume regular shrinking */
|
||||||
@@ -1674,6 +1687,8 @@ shrinking_glob_gone(struct obj *obj)
|
|||||||
{
|
{
|
||||||
xint16 owhere = obj->where;
|
xint16 owhere = obj->where;
|
||||||
|
|
||||||
|
/* obfree() should take care of eating_glob() food fixups */
|
||||||
|
|
||||||
if (owhere == OBJ_INVENT) {
|
if (owhere == OBJ_INVENT) {
|
||||||
if (obj->owornmask) {
|
if (obj->owornmask) {
|
||||||
remove_worn_item(obj, FALSE);
|
remove_worn_item(obj, FALSE);
|
||||||
|
|||||||
Reference in New Issue
Block a user