From 40ce97752252a6c2a3f6418c2ba74c584b9cc8a8 Mon Sep 17 00:00:00 2001 From: PatR Date: Sun, 18 Nov 2018 18:48:59 -0800 Subject: [PATCH 1/2] fix #H7573 - impossible zero payment in money2mon When paying for shop door or wall damage, if the entire amount was covered by shop credit then impossible "zero payment in money2mon" would occur as the shop code tried to transfer 0 zorkmids from hero to shopkeeper after using credit to pay. --- doc/fixes36.2 | 2 ++ src/shk.c | 12 ++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/doc/fixes36.2 b/doc/fixes36.2 index ff9594aa0..f4cfd00a1 100644 --- a/doc/fixes36.2 +++ b/doc/fixes36.2 @@ -200,6 +200,8 @@ nurse corpse/tin chance to convey poison resistance when eaten was not honored make tame vampires be more aggressive when shifted to bat/fog/wolf form a stale gold symbol could be displayed on the status line following a switch to a new symset, as observed and reported for Windows RogueEpyx symset +successfully paying for shop damage with shop credit would be followed by + impossible "zero payment in money2mon" Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository diff --git a/src/shk.c b/src/shk.c index 6eb4ab71a..472b1f165 100644 --- a/src/shk.c +++ b/src/shk.c @@ -1827,9 +1827,10 @@ int croaked; eshkp->robbed -= umoney; if (eshkp->robbed < 0L) eshkp->robbed = 0L; - if (umoney > 0) + if (umoney > 0L) { money2mon(shkp, umoney); - context.botl = 1; + context.botl = 1; + } pline("%s %s all your possessions.", Shknam(shkp), takes); taken = TRUE; /* where to put player's invent (after disclosure) */ @@ -2795,6 +2796,7 @@ boolean peaceful, silent; if (peaceful) { boolean credit_use = !!ESHK(shkp)->credit; + value = check_credit(value, shkp); /* 'peaceful' affects general treatment, but doesn't affect * the fact that other code expects that all charges after the @@ -4027,8 +4029,10 @@ boolean cant_mollify; currency(cost_of_damage), !animal ? "\"" : ""); if (yn(qbuf) != 'n') { cost_of_damage = check_credit(cost_of_damage, shkp); - money2mon(shkp, cost_of_damage); - context.botl = 1; + if (cost_of_damage > 0L) { + money2mon(shkp, cost_of_damage); + context.botl = 1; + } pline("Mollified, %s accepts your restitution.", shkname(shkp)); /* move shk back to his home loc */ home_shk(shkp, FALSE); From a58571a475d9d7ff66bada4f3d3d400efc8c8300 Mon Sep 17 00:00:00 2001 From: nhmall Date: Sun, 18 Nov 2018 23:53:49 -0500 Subject: [PATCH 2/2] .gitignore update --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 3c766268f..68829cef2 100644 --- a/.gitignore +++ b/.gitignore @@ -53,4 +53,5 @@ Makefile.gcc-orig # VS 2017 caches data into the hidden directory .vs .vs # Win32-specific ignores end +.DS_Store