fix #K3514 - unpaid_cost() impossible

Fix the reported bug of using Passes_walls to carry an unpaid item
from inside a shop into the wall it shares with another shop
producing a situation where examining inventory issued an impossible
"unpaid_cost: object wasn't on any bill" when trying to append the
cost to the formatted inventory line.  u.ushops[], u.ushops0[], and
others are lists that can have up to four entries and the relevant
code was only checking the first one.

Not mentioned in the report:  continuing another step into the other
shop didn't get recognized as robbing the first shop, for a similar
reason.

For either of these bugs, digging a breach in the wall, paying off
the miffed shopkeeper, then stepping into the breach before it gets
repaired will probably trigger the same results without the need for
polymorphing into a xorn or earth elemental.  But not on the tourist
goal level test case since walls there are undiggable.

I didn't go looking for other instances of not checking all relevant
shopkeepers.  It wouldn't surprise me if there are some more.
This commit is contained in:
PatR
2022-01-11 23:32:13 -08:00
parent 8aa7f31b23
commit 5c14f3e81d
2 changed files with 17 additions and 9 deletions

View File

@@ -738,6 +738,13 @@ getting wounded in one leg when the other was already wounded miraculously
when parsing config file entry "BINDINGS=key1:cmd1,key2:cmd2,key3:cmd3" allow
keyN to be either a naked comma or backslash+comma instead requiring
that comma's numeric value be used to bind comma to a command
when two or more shops share a wall and hero uses Passes_walls to carry an
unpaid item from inside a shop into the shared wall, it could yield
impossible "unpaid_cost: object wasn't on any bill" when examining
inventory if the shop code picked wrong shopkeeper to determine cost
when two or more shops share a wall and hero uses Passes_walls to carry an
unpaid item through the shared wall into another shop, theft of that
unpaid item from the first shop wasn't noticed
Fixes to 3.7.0-x Problems that Were Exposed Via git Repository