fix pull request #478 - homemade tin nutrition

Homemade tin would yield a flat 50 points of nutrition even when
made from a corpse that provides less than 50 points.  Take the
minimum of the two amounts instead of always 50.

Fixes #478
This commit is contained in:
PatR
2021-04-01 13:09:00 -07:00
parent 2805a135a3
commit 39bd259bd3
2 changed files with 14 additions and 4 deletions

View File

@@ -1352,10 +1352,19 @@ consume_tin(const char *mesg)
/* charge for one at pre-eating cost */
tin = costly_tin(COST_OPEN);
if (tintxts[r].nut < 0) /* rotten */
if (tintxts[r].nut < 0) { /* rotten */
make_vomiting((long) rn1(15, 10), FALSE);
else
lesshungry(tintxts[r].nut);
} else {
int nutamt = tintxts[r].nut;
/* nutrition from a homemade tin (made from a single corpse)
shouldn't be more than nutrition from the corresponding
corpse; other tinning modes might use more than one corpse
or add extra ingredients so aren't similarly restricted */
if (r == HOMEMADE_TIN && nutamt > mons[mnum].cnutrit)
nutamt = mons[mnum].cnutrit;
lesshungry(nutamt);
}
if (tintxts[r].greasy) {
/* Assume !Glib, because you can't open tins when Glib. */