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.
This commit is contained in:
PatR
2018-11-18 18:48:59 -08:00
parent bc8be48a92
commit 40ce977522
2 changed files with 10 additions and 4 deletions

View File

@@ -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

View File

@@ -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);