From 252e661b72dea29d619135e4556bac61f8715b24 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Sat, 9 Dec 2023 13:24:50 +0200 Subject: [PATCH] Prioritize paying shopkeeper next to you even if multiple are detected --- doc/fixes3-7-0.txt | 1 + src/shk.c | 13 +++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/doc/fixes3-7-0.txt b/doc/fixes3-7-0.txt index 4e4a690b8..7e5d658d3 100644 --- a/doc/fixes3-7-0.txt +++ b/doc/fixes3-7-0.txt @@ -1322,6 +1322,7 @@ change wolf and werewolf to grey, warg to black change [master] mind flayer, the Wizard, and the riders to bright magenta walking into a shopkeeper tries to pay the bill show billed items in a menu when paying with non-traditional menustyle +prioritize paying shopkeeper next to you even if multiple are detected Fixes to 3.7.0-x General Problems Exposed Via git Repository diff --git a/src/shk.c b/src/shk.c index 7627449cf..df462debf 100644 --- a/src/shk.c +++ b/src/shk.c @@ -1442,7 +1442,7 @@ dopay(void) struct monst *nxtm, *resident; long ltmp; long umoney; - int pass, tmp, sk = 0, seensk = 0; + int pass, tmp, sk = 0, seensk = 0, nexttosk = 0; boolean paid = FALSE, stashed_gold = (hidden_gold(TRUE) > 0L); gm.multi = 0; @@ -1454,16 +1454,21 @@ dopay(void) for (shkp = next_shkp(fmon, FALSE); shkp; shkp = next_shkp(shkp->nmon, FALSE)) { sk++; - if (ANGRY(shkp) && next2u(shkp->mx, shkp->my)) + if (next2u(shkp->mx, shkp->my)) { + /* next to an irate shopkeeper? prioritize that */ + if (nxtm && ANGRY(nxtm)) + continue; + nexttosk++; nxtm = shkp; + } if (canspotmon(shkp)) seensk++; if (inhishop(shkp) && (*u.ushops == ESHK(shkp)->shoproom)) resident = shkp; } - if (nxtm) { /* Player should always appease an */ - shkp = nxtm; /* irate shk standing next to them. */ + if (nxtm && nexttosk == 1) { + shkp = nxtm; goto proceed; }