avoid another magic number

Some of the hardcoded +1 scattered about are likely
invlet_gold or invlet_overflow, but I didn't hunt those down.
This commit is contained in:
nhmall
2023-11-30 11:15:32 -05:00
parent 9847fcb5b1
commit d7fef5f194
12 changed files with 44 additions and 26 deletions

View File

@@ -1638,7 +1638,7 @@ lift_object(
availability of open inventory slot iff not already carrying one */
if (obj->otyp == LOADSTONE
|| (obj->otyp == BOULDER && throws_rocks(gy.youmonst.data))) {
if (inv_cnt(FALSE) < 52 || !carrying(obj->otyp)
if (inv_cnt(FALSE) < invlet_basic || !carrying(obj->otyp)
|| merge_choice(gi.invent, obj))
return 1; /* lift regardless of current situation */
/* if we reach here, we're out of slots and already have at least
@@ -1655,7 +1655,8 @@ lift_object(
} else if (obj->oclass != COIN_CLASS
/* [exception for gold coins will have to change
if silver/copper ones ever get implemented] */
&& inv_cnt(FALSE) >= 52 && !merge_choice(gi.invent, obj)) {
&& inv_cnt(FALSE) >= invlet_basic
&& !merge_choice(gi.invent, obj)) {
/* if there is some gold here (and we haven't already skipped it),
we aren't limited by the 52 item limit for it, but caller and
"grandcaller" aren't prepared to skip stuff and then pickup