MCPcopy Create free account
hub / github.com/NetHack/NetHack / shop_object

Function shop_object

src/shk.c:5385–5402  ·  view source on GitHub ↗

called by dotalk(sounds.c) when #chatting; returns obj if location contains shop goods and shopkeeper is willing & able to speak */

Source from the content-addressed store, hash-verified

5383/* called by dotalk(sounds.c) when #chatting; returns obj if location
5384 contains shop goods and shopkeeper is willing & able to speak */
5385struct obj *
5386shop_object(coordxy x, coordxy y)
5387{
5388 struct obj *otmp;
5389 struct monst *shkp;
5390
5391 shkp = shop_keeper(*in_rooms(x, y, SHOPBASE));
5392 if (!shkp || !inhishop(shkp))
5393 return (struct obj *) 0;
5394
5395 for (otmp = svl.level.objects[x][y]; otmp; otmp = otmp->nexthere)
5396 if (otmp->oclass != COIN_CLASS)
5397 break;
5398 /* note: otmp might have ->no_charge set, but that's ok */
5399 return (otmp && costly_spot(x, y) && NOTANGRY(shkp) && !muteshk(shkp))
5400 ? otmp
5401 : (struct obj *) 0;
5402}
5403
5404/* give price quotes for all objects linked to this one (ie, on this spot) */
5405void

Callers 1

dochatFunction · 0.85

Calls 4

shop_keeperFunction · 0.85
in_roomsFunction · 0.85
inhishopFunction · 0.85
costly_spotFunction · 0.85

Tested by

no test coverage detected