multiple gold stacks in invent

The pull request that fixed a couple of instances where it was
possible to have multiple entries for gold in inventory indirectly
pointed out that the error checking was clumsy.  If you executed
the #adjust command while having two '$' items in inventory, you
were told twice that you had multiple stacks of gold in inventory.
Change how that's handled so that the warning appears at most once
for any given #adjust command.  Also avoids having #adjust's use
of getobj() re-scan entire invent for every item in invent.

Also, if player did manage to get two or more '$' entries, #adjust
would allow moving any but the last to a letter entry.  Once in a
letter, further #adjust with count specified could split the letter
gold entries into even more gold entries.  Now, if the player picks
gold as the #adjust 'from' item (which is only possible when there
are wrong letter gold entries or multiple ones or both) then #adjust
will now force 'to' slot to be '$' (without asking player to pick).

Lastly, the inventory check for multiple and/or wrong slot gold is
now performed by wizard mode sanity_check() in addition to #adjust.
This commit is contained in:
PatR
2021-03-17 10:36:42 -07:00
parent ac37aba4bd
commit a06f5ec494
4 changed files with 64 additions and 29 deletions

View File

@@ -2906,6 +2906,7 @@ RESTORE_WARNING_FORMAT_NONLITERAL
void
sanity_check(void)
{
(void) check_invent_gold("invent");
obj_sanity_check();
timer_sanity_check();
mon_sanity_check();