Issue reported by ars3niy: unpaid containers containing one or more other unpaid items appear on the menu for 'p' along with separate menu entries for those other items. Buying the container buys the contents too, then if any of the contents were also picked in the menu, an attempt will be made to pay for them separately. Since they are no longer on the bill by that point, that triggers an impossible warning. This fixes that by paying for the container but not its contents. (Temporarily, until more extensive changes get implemented.) Then those contents will still be on the bill. It they've been chosen in the 'p' menu, paying for them will work as expected. This also fixes the pay menu for the case where the bill contains any instances of a partly used up portion of some stack and also the unpaid intact portion of the same stack. With itemized billing, you are allowed to buy the used up portion separately, then maybe drop the unpaid portion. (If you try to pay for the intact portion, the shk won't accept the payment and will tell you to pay for the used up portion first.) With the recently added menu for billing, they were lumped together as a single item and you had to pay for their whole stack. And it fixes a much older bug dealing with the cheapest item on the shop bill. If you don't have enough to pay for that, the rest of buying gets skipped. But stacks that had used up and intact portions were lumping those together instead of separately checking the two portions for possibly being the cheapest, so it was possible to have enough gold to pay for one portion but be told that you couldn't affort to pay for anything. If it was the intact portion, you wouldn't be able to buy it anyway, but if the cheapest item was used up portion, being told you didn't have enough gold was wrong. This commit does not fix the longstanding bug that itemized billing reveals the contents of containers which haven't been opened. It was intended to do so but I've run out of steam. (There is groundwork for that, where buying a container would include payment for its unpaid contents without revealing what those are, and they couldn't be purchased separately unless they get taken out of the container. Uncommenting '#define CONTAINED_BUYING' will enable it, with updated pay menu handling but without being able to pay for non-empty containers.) Fixes #1249
165 KiB
165 KiB