shopkeeper feedback (trunk only)

Use verbalize instead of pline for shop "thank you, scum" message
(From a bug report.  Suppress shop "you sneaky cad" message
when removing a hero-owned pick-axe from a container inside a shop if the
shk is unable to speak; also give it at most one time per move (taking
multiple pick-axes out of a bag at once was way too verbose).  Honor
addtobill's silent flag for the bill overflow message when/if that occurs.

     Also adds a safe_qbuf usage for the #tip command that I had pending
for pickup.c.
This commit is contained in:
nethack.rankin
2006-11-07 02:49:09 +00:00
parent 1e0960f8ef
commit 0a7c5d6ad2
3 changed files with 27 additions and 7 deletions

View File

@@ -1969,6 +1969,7 @@ E char FDECL(inside_shop, (XCHAR_P,XCHAR_P));
E void FDECL(u_left_shop, (char *,BOOLEAN_P));
E void FDECL(remote_burglary, (XCHAR_P,XCHAR_P));
E void FDECL(u_entered_shop, (char *));
E void FDECL(pick_pick, (struct obj *));
E boolean FDECL(same_price, (struct obj *,struct obj *));
E void NDECL(shopper_financial_report);
E int FDECL(inhishop, (struct monst *));

View File

@@ -1959,8 +1959,7 @@ register struct obj *obj;
obj->oy = current_container->oy;
addtobill(obj, FALSE, FALSE, FALSE);
}
if (is_pick(obj) && !obj->unpaid && *u.ushops && shop_keeper(*u.ushops))
verbalize("You sneaky cad! Get out of here with that pick!");
if (is_pick(obj)) pick_pick(obj); /* shopkeeper feedback */
otmp = addinv(obj);
loadlev = near_capacity();
@@ -2440,7 +2439,7 @@ dotip()
struct obj *cobj, *nobj;
coord cc;
int boxes;
char c, buf[BUFSZ];
char c, buf[BUFSZ], qbuf[BUFSZ];
const char *spillage = 0;
/*
@@ -2463,8 +2462,8 @@ dotip()
nobj = cobj->nexthere;
if (!Is_container(cobj)) continue;
Sprintf(buf, "There is %s here, tip it?", doname(cobj));
c = ynq(buf);
c = ynq(safe_qbuf(qbuf, "There is ", " here, tip it?",
cobj, doname, ansimpleoname, "container"));
if (c == 'q') return 0;
if (c == 'n') continue;

View File

@@ -603,6 +603,26 @@ register char *enterstring;
return;
}
/* called when removing a pick-axe or mattock from a container */
void
pick_pick(obj)
struct obj *obj;
{
struct monst *shkp;
if (obj->unpaid || !is_pick(obj)) return;
shkp = shop_keeper(*u.ushops);
if (shkp && inhishop(shkp) && !muteshk(shkp)) {
static NEARDATA long pickmovetime = 0L;
/* if you bring a sack of N picks into a shop to sell,
don't repeat this N times when they're taken out */
if (moves != pickmovetime)
verbalize("You sneaky cad! Get out of here with that pick!");
pickmovetime = moves;
}
}
/*
Decide whether two unpaid items are mergable; caller is responsible for
making sure they're unpaid and the same type of object; we check the price
@@ -2222,7 +2242,7 @@ boolean ininv, dummy, silent;
costly_gold(obj->ox, obj->oy, obj->quan);
return;
} else if (ESHK(shkp)->billct == BILLSZ) {
You("got that for free!");
if (!silent) You("got that for free!");
return;
}
@@ -2622,7 +2642,7 @@ xchar x, y;
if (ANGRY(shkp)) { /* they become shop-objects, no pay */
if (!muteshk(shkp))
pline("Thank you, scum!");
verbalize("Thank you, scum!");
subfrombill(obj, shkp);
return;
}